return ast.Compare(left, [ast.Eq()], [right])
+def make_ne_compare(arg):
+ (left, right) = arg
+ return ast.Compare(left, [ast.NotEq()], [right])
+
+
binary_ops = {
"^": ast.BitXor(),
"&": ast.BitAnd(),
"<": make_lt_compare,
">": make_gt_compare,
"=": make_eq_compare,
+ "!=": make_ne_compare,
}
unary_ops = {
"+": ast.UAdd(),
class PowerParser:
precedence = (
- ("left", "EQ", "GT", "LT", "LE", "GE", "LTU", "GTU"),
+ ("left", "EQ", "NE", "GT", "LT", "LE", "GE", "LTU", "GTU"),
("left", "BITOR"),
("left", "BITXOR"),
("left", "BITAND"),
| comparison DIV comparison
| comparison MOD comparison
| comparison EQ comparison
+ | comparison NE comparison
| comparison LE comparison
| comparison GE comparison
| comparison LTU comparison
elif p[2] == '||':
l = check_concat(p[1]) + check_concat(p[3])
p[0] = ast.Call(ast.Name("concat"), l, [])
- elif p[2] in ['<', '>', '=', '<=', '>=']:
+ elif p[2] in ['<', '>', '=', '<=', '>=', '!=']:
p[0] = binary_ops[p[2]]((p[1], p[3]))
elif identify_sint_mul_pattern(p):
keywords=[ast.keyword(arg='repeat', value=p[3])]