Closed kjwelch closed 3 weeks ago
This looks awesome, but I messed up badly by suggesting adding a new token. Don't worry though, the fix shouldn't be too bad. So, the lexer technically can't distinguish unary and binary minus, but the PARSER can. So what you have to do so in the parse router make a special case for the MINUS token separate from the other binary expression ones, and if there's an operand on the both sides of the minus then use parse binary expression, and if there isn't then use parse unary expression. I'm sorry, that suggestion's on me. I think there's a function is_operand or something in parse_binary_exp you can use to get the two comparisons.
This also may not work if a binary expression is already being parsed, but we can worry about that later...or not at all, honestly.
I think the token should just be dash
and we should repeat this pattern with any other tokens that are trying to infer their semantic meaning. @kjwelch , can you triage with #97 and make sure this is the standard?
This concludes issue #93