Skip to content

Commit

Permalink
update fuel to avoid ambiguity (#57)
Browse files Browse the repository at this point in the history
* update fuel to avoid ambiguity

* fmt
  • Loading branch information
vuvoth authored Oct 27, 2024
1 parent 64e8357 commit bcea566
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ 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);
Expand Down

0 comments on commit bcea566

Please sign in to comment.