-
Notifications
You must be signed in to change notification settings - Fork 86
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
[BUG] Invalid operation Precedence #367
Conversation
The CI fails ;-) |
This comment was marked as outdated.
This comment was marked as outdated.
…o 364-bug-invalid-operation-precedence
Equality shouldn't have the same precedence as inequality? |
The CI fails because I haven't handled the unary operators yet. Hold on :) |
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.
Why did you add AlreadyParsedExpr
and AlreadyParsedType
? I don't see that we check them anywhere. Expression is an expression - it's parsed by definition, as it is not a token. It's part of the parsing result.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Todo:
|
This reverts commit 88fc6b0.
I reverted the format commit because too much conflicts showed up. I'll do the format when we can merge this |
@KrosFire This PR is now ready for final look. The wiki has been added: https://github.com/amber-lang/amber/wiki |
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.
Looks beautiful
Co-authored-by: Hubert Jabłoński <[email protected]>
Co-authored-by: Hubert Jabłoński <[email protected]>
Co-authored-by: Hubert Jabłoński <[email protected]>
@KrosFire can you reiterate on the changes? |
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.
Just small stuff. Looks good overall. Does someone have exp in macros? I've reached my limits XD
…oks diffrent now)
Co-authored-by: Hubert Jabłoński <[email protected]>
Co-authored-by: Hubert Jabłoński <[email protected]>
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.
LGTM
* feat(expr): overhaul of expression syntax module * feat: adapt binary operator modules to the new structure * merge(precedence): resolve path to command * fix(refactor): Added macros to make writing operator precedence much easier * fix(expr): Attach operators to work with precedence macro * feat(precedence): remove precedence file * fix(format): Cargo clippy and fmt * revert(format): Cargo clippy and fmt This reverts commit 88fc6b0. * fix(lint): resolve clippy errors * Update src/modules/expression/macros.rs Co-authored-by: Hubert Jabłoński <[email protected]> * feat(tests): add validity tests * fix(macro): improved handle binop macro * fix(expr): remove pub from fields * feat(macro): change prev to next * feat(macro): add edge case for one group * Update src/modules/expression/binop/sub.rs Co-authored-by: Hubert Jabłoński <[email protected]> * Update src/modules/expression/binop/eq.rs Co-authored-by: Hubert Jabłoński <[email protected]> * Update src/modules/expression/binop/neq.rs Co-authored-by: Hubert Jabłoński <[email protected]> * Update src/modules/expression/binop/or.rs * Update src/modules/expression/binop/and.rs * feat(error-macro): simplify code in a macro to keep DRY principle * feat(test): Add test for multiple cast * fix(and): remove comment * fix(range): Fix range and remove import from code eval (the stdlib looks diffrent now) * Update src/modules/expression/ternop/ternary.rs Co-authored-by: Hubert Jabłoński <[email protected]> * Update src/modules/expression/ternop/ternary.rs Co-authored-by: Hubert Jabłoński <[email protected]> --------- Co-authored-by: Hubert Jabłoński <[email protected]>
This will be a hefty one since it requires overhaul of an
Expr
syntax module and all operators.What has changed:
!
,-
,nameof
(x)
is
,as
*
,/
%
+
,-
>
,<
,>=
,<=
==
,!=
and
or
..
,..=
then..else
Previously everything was parsed from right to left in the same precedence.
We should add this information to the documentation btw.
The whole parsing couldn't be done in the Heraclitus way to parse everything contained in it's syntax module. This however could influence the development of Heraclitus to create some macro rules that would create an easy way to define precedence. For now as this is a rather important fix - I want to merge what I came up with so far.