summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <bridle.benjamin@gmail.com>2025-03-17 11:44:29 +1300
committerBen Bridle <bridle.benjamin@gmail.com>2025-03-17 11:44:29 +1300
commiteb45fad24cf28035f526eda45cbd5fb2ff1c337d (patch)
treec9d81b15cacf5b9dd9f958353a3ced48512a8b0e
parentc5f60b7ff45ced7c8b8519bc8fcf681486ad09fa (diff)
downloadassembler-eb45fad24cf28035f526eda45cbd5fb2ff1c337d.zip
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.
-rw-r--r--src/tokeniser.rs4
1 files changed, 2 insertions, 2 deletions
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<char>,
/// Path of the whole source file.
pub source_path: Option<PathBuf>,
@@ -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;
}