Scan returns the next token and position from the underlying reader. Also returns the literal text read for strings, numbers, and duration tokens since these token types can have different literal representations.
()
| 43 | // Also returns the literal text read for strings, numbers, and duration tokens |
| 44 | // since these token types can have different literal representations. |
| 45 | func (s *Scanner) Scan() (tok Token, pos Pos, lit string) { |
| 46 | tok, pos, lit = s.scan() |
| 47 | if tok != WS { |
| 48 | s.lastNonWSToken = tok |
| 49 | } |
| 50 | return |
| 51 | } |
| 52 | |
| 53 | func (s *Scanner) scan() (tok Token, pos Pos, lit string) { |
| 54 | // Read next code point. |