def p_or_test(p): """or_test : and_test | or_test OR and_test""" if len(p) == 2: p[0] = p[1] else: p[0] = parse_model.BinaryExpression(p[1], p[2], p[3])
def p_and_test(p): """and_test : not_test | and_test AND not_test""" if len(p) == 2: p[0] = p[1] else: p[0] = parse_model.BinaryExpression(p[1], p[2], p[3])
def p_comparison(p): """comparison : a_expr | a_expr cmp_operator a_expr""" if len(p) == 2: p[0] = p[1] else: p[0] = parse_model.BinaryExpression(p[1], p[2], p[3])
def p_a_expr(p): """a_expr : m_expr | a_expr PLUS m_expr | a_expr MINUS m_expr""" if len(p) == 2: p[0] = p[1] else: p[0] = parse_model.BinaryExpression(p[1], p[2], p[3])
def p_m_expr(p): """m_expr : u_expr | m_expr ASTERISK u_expr | m_expr SLASH u_expr | m_expr PERCENT u_expr""" if len(p) == 2: p[0] = p[1] else: p[0] = parse_model.BinaryExpression(p[1], p[2], p[3])