Precedence fix.

This commit is contained in:
Jussi Pakkanen 2013-08-10 02:11:29 +03:00
parent 98da65f8cc
commit 20d850d21f
2 changed files with 4 additions and 2 deletions

View File

@ -1326,7 +1326,9 @@ class Interpreter():
val2 = v2
else:
val2 = v2.get_value()
assert(type(val1) == type(val2))
if type(val1) != type(val2):
raise InterpreterException('Comparison of different types %s and %s.' %
(str(type(val1)), str(type(val2))))
if node.get_ctype() == '==':
return val1 == val2
elif node.get_ctype() == '!=':

View File

@ -69,10 +69,10 @@ t_ignore = ' \t'
precedence = (
('left', 'COMMA'),
('left', 'ASSIGN'),
('nonassoc', 'EQUALS', 'NEQUALS'),
('left', 'OR'),
('left', 'AND'),
('right', 'NOT'),
('nonassoc', 'EQUALS', 'NEQUALS'),
('nonassoc', 'COLON'),
('left', 'DOT'),
)