Skip to content

Commit

Permalink
Fix more parsing hard failures
Browse files Browse the repository at this point in the history
  • Loading branch information
eejbyfeldt committed Jun 10, 2024
1 parent d70908f commit 99cc39a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9292,20 +9292,20 @@ impl<'a> Parser<'a> {
return self.expected("literal number", next_token);
};
self.expect_token(&Token::RBrace)?;
RepetitionQuantifier::AtMost(n.parse().expect("literal int"))
RepetitionQuantifier::AtMost(Self::parse(n, token.location)?)
}
Token::Number(n, _) if self.consume_token(&Token::Comma) => {
let next_token = self.next_token();
match next_token.token {
Token::Number(m, _) => {
self.expect_token(&Token::RBrace)?;
RepetitionQuantifier::Range(
n.parse().expect("literal int"),
m.parse().expect("literal int"),
Self::parse(n, token.location)?,
Self::parse(m, token.location)?,
)
}
Token::RBrace => {
RepetitionQuantifier::AtLeast(n.parse().expect("literal int"))
RepetitionQuantifier::AtLeast(Self::parse(n, token.location)?)
}
_ => {
return self.expected("} or upper bound", next_token);
Expand All @@ -9314,7 +9314,7 @@ impl<'a> Parser<'a> {
}
Token::Number(n, _) => {
self.expect_token(&Token::RBrace)?;
RepetitionQuantifier::Exactly(n.parse().expect("literal int"))
RepetitionQuantifier::Exactly(Self::parse(n, token.location)?)
}
_ => return self.expected("quantifier range", token),
}
Expand Down

0 comments on commit 99cc39a

Please sign in to comment.