Change precedence for && and ||
@@ -16,8 +16,8 @@ var precedence = map[token.Type]int{
token.GT: LESSGREATER,
token.GTE: LESSGREATER,
token.COMP: LESSGREATER,
- token.And: LESSGREATER,
- token.Or: LESSGREATER,
+ token.And: LOGIC,
+ token.Or: LOGIC,
token.Plus: SUM,
token.Minus: SUM,
token.Incr: SUM,
@@ -34,6 +34,7 @@ var precedence = map[token.Type]int{
const (
_ int = iota
LOWEST
+ LOGIC
EQUALS
LESSGREATER
SUM
