-
Notifications
You must be signed in to change notification settings - Fork 540
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
add conescutive math operator diagnostic to the parser #6392
add conescutive math operator diagnostic to the parser #6392
Conversation
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: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @dean-starkware and @gilbens-starkware)
crates/cairo-lang-parser/src/parser.rs
line 1101 at r1 (raw file):
/// # Returns: /// `true` if the token is a relational or equality operator, otherwise `false`. fn is_math_operator(&self, kind: SyntaxKind) -> bool {
rename method.
-
- / * are all math operators as well.
crates/cairo-lang-parser/src/parser.rs
line 1109 at r1 (raw file):
| SyntaxKind::TerminalGE // >= | SyntaxKind::TerminalEqEq // == | SyntaxKind::TerminalNeq // !=
properly align doc.
Code quote:
| SyntaxKind::TerminalGT // >
| SyntaxKind::TerminalLE // <=
| SyntaxKind::TerminalGE // >=
| SyntaxKind::TerminalEqEq // ==
| SyntaxKind::TerminalNeq // !=
crates/cairo-lang-parser/src/parser_test_data/partial_trees/expr
line 63 at r1 (raw file):
//! > ========================================================================== //! > Test precedence between unary and binary operators1231233
?
Code quote:
1231233
153f2a7
to
0931d0a
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.
Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-parser/src/parser.rs
line 1101 at r1 (raw file):
Previously, orizi wrote…
rename method.
- / * are all math operators as well.
Done.
crates/cairo-lang-parser/src/parser.rs
line 1109 at r1 (raw file):
Previously, orizi wrote…
properly align doc.
Done.
crates/cairo-lang-parser/src/parser_test_data/partial_trees/expr
line 63 at r1 (raw file):
Previously, orizi wrote…
?
Done.
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 1 of 3 files at r1, all commit messages.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @dean-starkware and @gilbens-starkware)
crates/cairo-lang-parser/src/diagnostic.rs
line 42 at r3 (raw file):
AttributesWithoutStatement, DisallowedTrailingSeparatorOr, ConsecutiveMathOperators { first_op: SyntaxKind, second_op: SyntaxKind },
here as well.
crates/cairo-lang-parser/src/parser_test_data/full_trees/test1
line 875 at r3 (raw file):
error: Consecutive math operators are not allowed: 'TerminalEqEq' followed by 'TerminalEqEq' --> src/parser_test_data/cairo_test_files/test1.cairo:15:20 let z = if 0 + x == y {
this doesn't seem right.
Code quote:
let z = if 0 + x == y {
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: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-parser/src/diagnostic.rs
line 42 at r3 (raw file):
Previously, orizi wrote…
here as well.
Please elaborate. It seems fine to me.
99de629
to
cee3908
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.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-parser/src/parser_test_data/full_trees/test1
line 875 at r3 (raw file):
Previously, orizi wrote…
this doesn't seem right.
Done.
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 all commit messages.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @dean-starkware and @gilbens-starkware)
crates/cairo-lang-parser/src/parser.rs
line 1109 at r4 (raw file):
| SyntaxKind::TerminalGE // >= | SyntaxKind::TerminalEqEq // == | SyntaxKind::TerminalNeq // !=
i think you can just drop the comments here - the original names are clear enough.
Suggestion:
SyntaxKind::TerminalLT
| SyntaxKind::TerminalGT
| SyntaxKind::TerminalLE
| SyntaxKind::TerminalGE
| SyntaxKind::TerminalEqEq
| SyntaxKind::TerminalNeq
crates/cairo-lang-parser/src/parser_test_data/full_trees/test1
line 875 at r3 (raw file):
Previously, dean-starkware wrote…
Done.
still doesn't seem right.
8ba7601
to
f973604
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.
Reviewable status: 1 of 4 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-parser/src/parser.rs
line 1109 at r4 (raw file):
Previously, orizi wrote…
i think you can just drop the comments here - the original names are clear enough.
Done.
crates/cairo-lang-parser/src/parser_test_data/full_trees/test1
line 875 at r3 (raw file):
Previously, orizi wrote…
still doesn't seem right.
I think it's fine now.
All tests are successfull now:
https://github.com/starkware-libs/cairo/actions/runs/10958733543
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 1 of 2 files at r3, 3 of 5 files at r5.
Reviewable status: 4 of 6 files reviewed, 2 unresolved discussions (waiting on @dean-starkware and @gilbens-starkware)
crates/cairo-lang-parser/src/parser.rs
line 1101 at r5 (raw file):
/// # Returns: /// `true` if the token is a relational or equality operator, otherwise `false`. fn is_comperison_operator(&self, kind: SyntaxKind) -> bool {
Suggestion:
fn is_comparison_operator(&self, kind: SyntaxKind) -> bool {
crates/cairo-lang-parser/src/parser.rs
line 1154 at r5 (raw file):
} } child_op = Some(self.peek().kind);
Suggestion:
child_op = Some(current_op);
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: 4 of 6 files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @orizi)
crates/cairo-lang-parser/src/parser.rs
line 1101 at r5 (raw file):
/// # Returns: /// `true` if the token is a relational or equality operator, otherwise `false`. fn is_comperison_operator(&self, kind: SyntaxKind) -> bool {
Done.
crates/cairo-lang-parser/src/parser.rs
line 1154 at r5 (raw file):
} } child_op = Some(self.peek().kind);
Done.
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 1 of 5 files at r5, 1 of 1 files at r6.
Reviewable status: all files reviewed (commit messages unreviewed), 1 unresolved discussion (waiting on @dean-starkware and @gilbens-starkware)
crates/cairo-lang-parser/src/parser_test_data/partial_trees/expr
line 79 at r5 (raw file):
//! > expected_diagnostics error: Consecutive math operators are not allowed: 'TerminalLT' followed by 'TerminalGT'
Should be comparison
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 (commit messages unreviewed), 2 unresolved discussions (waiting on @dean-starkware and @gilbens-starkware)
crates/cairo-lang-parser/src/parser_test_data/partial_trees/expr
line 79 at r5 (raw file):
//! > expected_diagnostics error: Consecutive math operators are not allowed: 'TerminalLT' followed by 'TerminalGT'
Also, can you print the actual operators instead, or.only the names are possible?
30d3ef5
to
f21bc0c
Compare
4c92135
to
10bf8ee
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 8 of 8 files at r8, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @dean-starkware, @Draggu, @gilbens-starkware, and @mkaput)
10bf8ee
to
7813ad2
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Arcticae, @Draggu, @gilbens-starkware, @mkaput, and @orizi)
crates/cairo-lang-parser/src/parser_test_data/partial_trees/expr
line 79 at r5 (raw file):
Previously, orizi wrote…
Also, can you print the actual operators instead, or.only the names are possible?
Done.
crates/cairo-lang-parser/src/parser_test_data/partial_trees/expr
line 79 at r5 (raw file):
Previously, orizi wrote…
Should be comparison
Done.
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 4 of 4 files at r9, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @Arcticae, @Draggu, @gilbens-starkware, and @mkaput)
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: complete! all files reviewed, all discussions resolved (waiting on @Arcticae, @Draggu, @gilbens-starkware, and @mkaput)
This change is