diff options
author | Ben Bridle <ben@derelict.engineering> | 2025-02-04 08:44:26 +1300 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2025-02-04 08:44:26 +1300 |
commit | 8d11be64f6c1747e7c4049105a6dd4ea9ab0d27f (patch) | |
tree | c83eda898f7512d50a6a806c6de0f99b0619274e /src/locators/source.rs | |
parent | 8ccb5b96f51bcf8e1a1c3e81d1305ff08825f9b1 (diff) | |
download | assembler-8d11be64f6c1747e7c4049105a6dd4ea9ab0d27f.zip |
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.
Diffstat (limited to 'src/locators/source.rs')
-rw-r--r-- | src/locators/source.rs | 2 |
1 files changed, 2 insertions, 0 deletions
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; } |