Peek returns the next rune. Does not advance the scanner. Returns false if there are no more runes.
()
| 54 | |
| 55 | // Peek returns the next rune. Does not advance the scanner. Returns false if there are no more runes. |
| 56 | func (scanner *Scanner) Peek() (rune, bool) { |
| 57 | if scanner.sourceIdx+1 >= len(scanner.source) { |
| 58 | return 0, false |
| 59 | } |
| 60 | return scanner.source[scanner.sourceIdx+1], true |
| 61 | } |
| 62 | |
| 63 | // PeekBy returns the next rune that is n positions from the current rune. Does not advance the scanner. Returns false |
| 64 | // if we are peeking beyond the source. |