diff options
Diffstat (limited to 'src/tokeniser.rs')
-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(), |