From 404bf4e4bac16a37692a8f7e9e86ad2c89f38abd Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Sun, 9 Feb 2025 18:58:15 +1300 Subject: Tidy code --- src/tokeniser.rs | 5 +++-- 1 file 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>(source_code: &str,path: Option

) -> Self { + pub fn new>(source_code: &str, path: Option

) -> 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(), -- cgit v1.2.3-70-g09d2