Closed 64kramsystem closed 6 years ago
This is a bug and should be fixed in Parser
I was looking into this today and I found it only happens with , not ** or other operators. I think it's caused by the registering of asterisk as a prefix expression.
Removing this line and adding the following line seems to fix this specific issue. But running go test ./... yields several parser related test failures before a SIGSEGV. I'm willing to work on this but unsure how to proceed.
p.registerInfix(token.Asterisk, p.parseInfixExpression)
@ear7h Maybe adding check inside p.parseInfixExpression
?
* *
is two tokens for the parser while **
is one. So when we proceed to the second *
the left expression will also be *
, and then we can know user are using it in the wrong way
In Goby, it's allowed to perform an arithmetic operation with two right values:
I think this should be forbidden; if so, probably the best place to forbid this is at parser level, otherwise, argument checks should be added for each operation method.