PeekBy returns the next rune that is n positions from the current rune. Does not advance the scanner. Returns false if we are peeking beyond the source.
(n int)
| 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. |
| 65 | func (scanner *Scanner) PeekBy(n int) (rune, bool) { |
| 66 | if scanner.sourceIdx+n >= len(scanner.source) || scanner.sourceIdx+n < 0 { |
| 67 | return 0, false |
| 68 | } |
| 69 | return scanner.source[scanner.sourceIdx+n], true |
| 70 | } |
| 71 | |
| 72 | // PeekMatch returns whether the given string exactly matches runes starting after the current position. This is |
| 73 | // equivalent to calling PeekMatchOffset with an offset of 1. |
no outgoing calls
no test coverage detected