AdvanceBy advances the scanner by the given amount. If the amount is greater than the number of remaining runes, then it advances to the end. Cannot advance backwards.
(n int)
| 95 | // AdvanceBy advances the scanner by the given amount. If the amount is greater than the number of remaining runes, then |
| 96 | // it advances to the end. Cannot advance backwards. |
| 97 | func (scanner *Scanner) AdvanceBy(n int) { |
| 98 | if n < 0 { |
| 99 | n = 0 |
| 100 | } |
| 101 | if scanner.sourceIdx+n >= len(scanner.source) { |
| 102 | n = len(scanner.source) - scanner.sourceIdx - 1 |
| 103 | } |
| 104 | scanner.sourceIdx += n |
| 105 | } |
| 106 | |
| 107 | // Process processes the synopsis and returns the generated tokens. |
| 108 | func (scanner *Scanner) Process() ([]utils.Token, error) { |