Skip to content
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

Merged
merged 1 commit into from
Jul 24, 2023

Conversation

orizi
Copy link
Collaborator

@orizi orizi commented Jul 6, 2023

@orizi orizi requested a review from spapinistarkware July 6, 2023 14:40
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch from 1b8b4a6 to e028653 Compare July 6, 2023 16:51
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/fa36ec75 branch from 6068607 to cce7d37 Compare July 6, 2023 17:34
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch from e028653 to 7b6aa4c Compare July 6, 2023 17:34
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/fa36ec75 branch from cce7d37 to a3f2a33 Compare July 6, 2023 18:02
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch from 7b6aa4c to 38e20dd Compare July 6, 2023 18:02
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/fa36ec75 branch from a3f2a33 to 7c2472c Compare July 6, 2023 18:37
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch from 38e20dd to 1f9cbcb Compare July 6, 2023 18:37
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/fa36ec75 branch from 7c2472c to a98f78b Compare July 9, 2023 04:35
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch 3 times, most recently from e847b7d to 51eb38d Compare July 10, 2023 03:27
Copy link
Contributor

@spapinistarkware spapinistarkware left a 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())
        }()?

Copy link
Contributor

@spapinistarkware spapinistarkware left a 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)

@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/fa36ec75 branch from 69c76d5 to ef8633f Compare July 24, 2023 10:19
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch 2 times, most recently from 119a1fa to 7cd8370 Compare July 24, 2023 10:48
@orizi orizi changed the base branch from pr/orizi/orizi/signed-ints/fa36ec75 to main July 24, 2023 12:26
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch from 7cd8370 to 67b9d03 Compare July 24, 2023 12:26
@orizi orizi force-pushed the pr/orizi/orizi/signed-ints/295e9468 branch from 67b9d03 to d7339bc Compare July 24, 2023 12:48
@orizi orizi added this pull request to the merge queue Jul 24, 2023
Merged via the queue into main with commit 946f1f4 Jul 24, 2023
@orizi orizi deleted the pr/orizi/orizi/signed-ints/295e9468 branch July 24, 2023 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants