-
Notifications
You must be signed in to change notification settings - Fork 595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added support for including minus in literals. #3619
Conversation
1b8b4a6
to
e028653
Compare
6068607
to
cce7d37
Compare
e028653
to
7b6aa4c
Compare
cce7d37
to
a3f2a33
Compare
7b6aa4c
to
38e20dd
Compare
a3f2a33
to
7c2472c
Compare
38e20dd
to
1f9cbcb
Compare
7c2472c
to
a98f78b
Compare
e847b7d
to
51eb38d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 36 of 36 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi)
crates/cairo-lang-parser/src/parser.rs
line 795 at r1 (raw file):
} else { self.try_parse_atom(lbrace_allowed)? };
Something like this. Consider extracting to a method as well...
Suggestion:
let mut expr = || {
let Some(precedence) = get_unary_operator_precedence(self.peek().kind) else {
return self.try_parse_atom(lbrace_allowed);
}
let op = if self.peek().kind == SyntaxKind::TerminalMinus {
let minus = self.take::<TerminalMinus>();
if self.peek().kind == SyntaxKind::TerminalNumber {
return LiteralNumber::new_green(self.db, minus.into(), self.take::<TerminalNumber>()).into()
}
minus.into()
} else {
self.expect_unary_operator()
};
let expr = self.parse_expr_limited(precedence, lbrace_allowed);
Some(ExprUnary::new_green(self.db, op, expr).into())
}()?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @orizi)
69c76d5
to
ef8633f
Compare
119a1fa
to
7cd8370
Compare
7cd8370
to
67b9d03
Compare
commit-id:295e9468
67b9d03
to
d7339bc
Compare
Stack:
This change is