From 8d11be64f6c1747e7c4049105a6dd4ea9ab0d27f Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Tue, 4 Feb 2025 08:44:26 +1300 Subject: Implement a generic source code tokeniser This is a struct that provides various methods for consuming characters from a character stream and for tracking the provenance of each parsed token. --- src/locators/source.rs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/locators/source.rs') diff --git a/src/locators/source.rs b/src/locators/source.rs index 9fd1b2b..2cf1ef9 100644 --- a/src/locators/source.rs +++ b/src/locators/source.rs @@ -49,6 +49,8 @@ pub struct Position { } impl Position { + pub const ZERO: Self = Self { line: 0, column: 0 }; + pub fn to_next_char(&mut self) { self.column += 1; } -- cgit v1.2.3-70-g09d2