Next returns the next rune in the input string, moving the position pointer on by the size of the rune that was decoded. For ASCII text this wouldn't be required, but in JavaScript source we will encounter many runes that have a length of more than one byte
()
| 84 | // source we will encounter many runes that have a length of more |
| 85 | // than one byte |
| 86 | func (s *stringLexer) Next() rune { |
| 87 | if s.pos >= len(s.str) { |
| 88 | s.done = true |
| 89 | return -1 |
| 90 | } |
| 91 | |
| 92 | r, l := utf8.DecodeRuneInString(s.str[s.pos:]) |
| 93 | s.pos += l |
| 94 | return r |
| 95 | } |
| 96 | |
| 97 | // Backup moves the position pointer back by the length of the |
| 98 | // previous rune in the input string. |
no outgoing calls
no test coverage detected