diff options
author | Ben Bridle <bridle.benjamin@gmail.com> | 2025-02-09 18:58:15 +1300 |
---|---|---|
committer | Ben Bridle <bridle.benjamin@gmail.com> | 2025-02-09 18:58:15 +1300 |
commit | 404bf4e4bac16a37692a8f7e9e86ad2c89f38abd (patch) | |
tree | ddfb08889a117accd12fc0214957f9af90f0df69 /src | |
parent | ed80c0abcdfc62d3d2f83ba53682693cb014c83d (diff) | |
download | assembler-404bf4e4bac16a37692a8f7e9e86ad2c89f38abd.zip |
Tidy code
Diffstat (limited to 'src')
-rw-r--r-- | src/tokeniser.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tokeniser.rs b/src/tokeniser.rs index 8e3cb15..7d8ddfd 100644 --- a/src/tokeniser.rs +++ b/src/tokeniser.rs @@ -29,7 +29,7 @@ pub struct Tokeniser { impl Tokeniser { - pub fn new<P: Into<PathBuf>>(source_code: &str,path: Option<P>) -> Self { + pub fn new<P: Into<PathBuf>>(source_code: &str, path: Option<P>) -> Self { Self { chars: source_code.chars().rev().collect(), source_path: path.map(|p| p.into()), @@ -99,7 +99,7 @@ impl Tokeniser { break; } } - token + return token; } /// Consume and return all characters up to and including the delimiter. @@ -133,6 +133,7 @@ impl Tokeniser { self.start_position = self.position; } + /// Only call this once per span, it consumes the token string. pub fn get_source_span(&mut self) -> SourceSpan { let in_merged = SourceLocation { path: self.source_path.to_owned(), |