scanASCIIWhile advances s.pos over the longest run of ASCII bytes for which pred returns true. It stops at end-of-text, the first non-ASCII byte, or the first byte where pred is false.
(pred func(byte) bool)
| 454 | // pred returns true. It stops at end-of-text, the first non-ASCII byte, or the |
| 455 | // first byte where pred is false. |
| 456 | func (s *Scanner) scanASCIIWhile(pred func(byte) bool) { |
| 457 | text := s.text[s.pos:s.end] |
| 458 | i := 0 |
| 459 | for i < len(text) { |
| 460 | b := text[i] |
| 461 | if b >= utf8.RuneSelf || !pred(b) { |
| 462 | break |
| 463 | } |
| 464 | i++ |
| 465 | } |
| 466 | s.pos += i |
| 467 | } |
| 468 | |
| 469 | func (s *Scanner) Scan() ast.Kind { |
| 470 | s.fullStartPos = s.pos |
no test coverage detected