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

Cannot create operator with same precedence as pipe #1050

Open
bbrk24 opened this issue Feb 21, 2024 · 4 comments
Open

Cannot create operator with same precedence as pipe #1050

bbrk24 opened this issue Feb 21, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@bbrk24
Copy link
Contributor

bbrk24 commented Feb 21, 2024

operator o right same(|) parses fine, but operator o right same(|>) doesn't parse. For some reason it lexes the latter as [(, |, >)] rather than [(, |>, )].

@edemaine
Copy link
Collaborator

Civet does not consider |> a binary operator. It's not currently possible to put a custom operator at that level.

@bbrk24
Copy link
Contributor Author

bbrk24 commented Feb 21, 2024

I see. The error message is more informative if I type same(▷) instead.

@bbrk24
Copy link
Contributor Author

bbrk24 commented Feb 21, 2024

The TC39 proposal says |> is on the same precedence level as =, but same(=) also doesn't work for much more obvious reasons. Though I am a little surprised same(++=) doesn't work, given that that's a runtime function call rather than actual assignment.

@STRd6
Copy link
Contributor

STRd6 commented Feb 21, 2024

Now that we have precedence and associativity we can adjust the parser to have more things be binary operators but it may not be a small task.

@STRd6 STRd6 added the enhancement New feature or request label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants