diff options
| author | Botahamec <botahamec@outlook.com> | 2023-07-30 13:11:53 -0400 |
|---|---|---|
| committer | Botahamec <botahamec@outlook.com> | 2023-07-30 13:11:53 -0400 |
| commit | 40648210f807d18a642cbe2e16aa133d1c38d86f (patch) | |
| tree | 5b7b4b12c6350e5b5150c18d3712574a5a036203 /src/scanner.rs | |
| parent | f212e70c7acc0aa94d5bc2b41f662f795d299e29 (diff) | |
Add way to check for end of file
Diffstat (limited to 'src/scanner.rs')
| -rw-r--r-- | src/scanner.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/scanner.rs b/src/scanner.rs index b5b1850..f792898 100644 --- a/src/scanner.rs +++ b/src/scanner.rs @@ -33,6 +33,10 @@ impl Scanner { self.position } + pub fn is_at_end(&self) -> bool { + self.position == self.source.len() + } + pub fn goto(&mut self, position: usize) -> Option<String> { // allow reverse ranges let production = if self.position < position { |
