Skip to content

Commit

Permalink
rename close() params, use advance() in eat(), fix typo scope
Browse files Browse the repository at this point in the history
  • Loading branch information
NTTVy03 committed Dec 8, 2024
1 parent c76246b commit cd125ab
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions crates/parser/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ impl<'a> Parser<'a> {
}
}

pub fn close(&mut self, marker_close: Marker, kind: TokenKind) -> Marker {
match marker_close {
pub fn close(&mut self, marker_open: Marker, kind: TokenKind) -> Marker {
match marker_open {
Marker::Open(index) => {
self.events[index] = Event::Open { kind };
self.events.push(Event::Close);
Expand Down Expand Up @@ -159,8 +159,7 @@ impl<'a> Parser<'a> {

pub fn eat(&mut self, kind: TokenKind) -> bool {
if self.at(kind) {
self.events.push(Event::TokenPosition(self.pos));
self.skip();
self.advance();
return true;
}
false
Expand Down Expand Up @@ -193,14 +192,14 @@ impl<'a> Parser<'a> {
}

impl Parser<'_> {
pub fn parsing_with_scrope(input: &Input, scope: Scope) -> Output {
pub fn parsing_with_scope(input: &Input, scope: Scope) -> Output {
let mut p = Parser::new(input);
scope.parse(&mut p);
Output::from(p.events)
}

pub fn parsing(input: &Input) -> Output {
let c = Scope::CircomProgram;
Parser::parsing_with_scrope(input, c)
Parser::parsing_with_scope(input, c)
}
}

0 comments on commit cd125ab

Please sign in to comment.