py-lua-parser
py-lua-parser copied to clipboard
Bitwise precedence is wrong
Looking at parser/Lua.g4, it seems that the assumed bitwise priority is above multiplication, while it is in fact below concat reference on operator precedence. This is also the case in a small example. In a lua 5.4 console:
> 1&2+3
1
> (1&2)+3
3
The parsed tree for "1&2+3":
AddOp: {} 3 keys
left: {} 3 keys
BAndOp: {} 3 keys
left: {} 2 keys
Number: {} 2 keys
n: 1
right: {} 2 keys
Number: {} 2 keys
n: 2
right: {} 2 keys
Number: {} 2 keys
n: 3