Skip to content

Commit

Permalink
update fuel to avoid ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvoth committed Oct 12, 2024
1 parent a533850 commit 27d7580
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,15 @@ impl<'a> Parser<'a> {
}

pub fn next(&mut self) -> TokenKind {
if self.fuel.get() == 0 {
panic!("parser is stuck");
}
self.fuel.set(self.fuel.get() - 1);
if self.pos < self.input.size() {
self.pos += 1;
return self.input.kind_of(self.pos);
}

TokenKind::EOF
}

Expand Down

0 comments on commit 27d7580

Please sign in to comment.