Skip to content
Permalink
Browse files

fixed bug reported by Peter Newman on p4-dev (invalid parsing of bool…

…ean expression)
  • Loading branch information...
Antonin Bas
Antonin Bas committed Aug 13, 2015
1 parent ff3c8ef commit 3d6b69511b32daebdc5eb980dec8b56fbefea455
Showing with 9 additions and 4 deletions.
  1. +9 −4 p4_hlir/frontend/parser.py
@@ -2002,31 +2002,36 @@ def p_bool_exp_6(self, p):
p[0] = P4BinaryExpression(self.get_filename(), p.lineno(1),
p[2], p[1], p[3])

def p_exp1(self, p):
def p_exp_1(self, p):
""" exp : field_ref
"""
p[0] = p[1]

def p_exp2(self, p):
def p_exp_2(self, p):
""" exp : NOT exp
| MINUS exp %prec UMINUS
| PLUS exp %prec UMINUS
"""
p[0] = P4UnaryExpression(self.get_filename(), p.lineno(1), p[1], p[2])

def p_exp3(self, p):
def p_exp_3(self, p):
""" exp : exp AND exp
| exp OR exp
| exp XOR exp
"""
p[0] = P4BinaryExpression(self.get_filename(), p.lineno(1),
p[2], p[1], p[3])

def p_exp4(self, p):
def p_exp_4(self, p):
""" exp : const_value
"""
p[0] = p[1]

def p_exp_5(self, p):
""" exp : LPAREN exp RPAREN
"""
p[0] = p[2]


# PARSER EXCEPTIONS

0 comments on commit 3d6b695

Please sign in to comment.
You can’t perform that action at this time.