From eb45fad24cf28035f526eda45cbd5fb2ff1c337d Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Mon, 17 Mar 2025 11:44:29 +1300 Subject: Fix Tokeniser::end_of_line method The method hadn't been changed since back when the chars field was a stack of characters that were removed as they were consumed. The method now works with the current design of the Tokeniser. --- src/tokeniser.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tokeniser.rs b/src/tokeniser.rs index 0061e7a..0350afe 100644 --- a/src/tokeniser.rs +++ b/src/tokeniser.rs @@ -5,7 +5,7 @@ use std::path::PathBuf; /// Break a character stream down into individual tokens. pub struct Tokeniser { - /// Characters waiting to be parsed. + /// All characters to be parsed, characters are never removed. pub chars: Vec, /// Path of the whole source file. pub source_path: Option, @@ -154,7 +154,7 @@ impl Tokeniser { /// Returns true if the remainder of the line is whitespace. pub fn end_of_line(&self) -> bool { - for c in self.chars.iter().rev() { + for c in &self.chars[self.mark.i..] { if *c == '\n' { return true; } -- cgit v1.2.3-70-g09d2