Closed J3RN closed 2 years ago
It may make sense to categorize this as a unary operator if there are many others. -
as in -1
comes to mind from other languages. tree-sitter-elixir has a somewhat complicated unary operator rule helper function (complicated because of the precedence). I have a simpler version in tree-sitter-erlang that could be a good reference. It seems like unary operators are not (yet) common in gleam though so I don't think it's necessary - just something to keep in mind for later.
If it helps I've no plans to add any new unary operators
@the-mikedavis You raise a good point! Having a clause/function for unary operators did cross my mind, but in general I try to hew as close to the Gleam parser as possible (makes updates like this one easier). Perhaps if more unary operators are added, we can reconsider.
Cheers all! :tada:
A bit belated :sweat_smile:
From the diff of the Gleam parser, it appears that the only differences from 0.20.1 to 0.21.0 are
As such, this change just adds support for the negation operator.
cc @the-mikedavis