Skip to content

Commit

Permalink
Don't ignore extra closing parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
kdkasad committed Apr 1, 2024
1 parent ddfaed0 commit 443c8cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,13 @@ where
///
/// [1]: crate::ast
pub fn parse(mut self) -> Result<Node, ParseError> {
Ok(extract(self.parse_expr(0, false)?))
let result = extract(self.parse_expr(0, false)?);
if self.tokens.next().is_some() {
// The only case where this will happen is if the next token is a group close token
Err(ParseError::UnmatchedGroup)
} else {
Ok(result)
}
}

fn parse_expr(&mut self, min_bp: u32, accept_multi: bool) -> Result<Vec<Node>, ParseError> {
Expand Down

0 comments on commit 443c8cb

Please sign in to comment.