| 1 | module lexer |
| 2 | |
| 3 | // SourceState records committed scanner progress, independently of a diagnostic |
| 4 | // position that may point backwards. Reading it allocates no storage. |
| 5 | pub struct SourceState { |
| 6 | pub: |
| 7 | fold_case bool = true |
| 8 | consumed int |
| 9 | } |
| 10 | |
| 11 | @[inline] |
| 12 | pub fn (s &Scanner) source_state() SourceState { |
| 13 | return SourceState{ fold_case: !s.no_fold, consumed: s.pos } |
| 14 | } |
| 15 | |
| 16 | @[inline] |
| 17 | pub fn (s &AltScanner) source_state() SourceState { |
| 18 | return s.scanner.source_state() |
| 19 | } |
| 20 |