AcceptN advances the position pointer N times, only if the next N runes are in the set of valid runes provided
(valid string, n int)
| 143 | // AcceptN advances the position pointer N times, only if |
| 144 | // the next N runes are in the set of valid runes provided |
| 145 | func (s *stringLexer) AcceptN(valid string, n int) bool { |
| 146 | count := 0 |
| 147 | for i := 0; i < n; i++ { |
| 148 | if s.Accept(valid) { |
| 149 | count++ |
| 150 | } |
| 151 | } |
| 152 | return count == n |
| 153 | } |
| 154 | |
| 155 | // AcceptUntil accepts any runes until the rune provided is |
| 156 | // encountered |