Civet
Civet copied to clipboard
Cannot create operator with same precedence as pipe
operator o right same(|) parses fine, but operator o right same(|>) doesn't parse. For some reason it lexes the latter as [(, |, >)] rather than [(, |>, )].
Civet does not consider |> a binary operator. It's not currently possible to put a custom operator at that level.
I see. The error message is more informative if I type same(▷) instead.
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.
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.