Beispiel #1
0
 def p_expression_binary_operator(p):
     """ expression : expression PLUS expression
                    | expression MINUS expression
                    | expression TIMES expression
                    | expression DIVIDE expression
                    | expression GREATER expression
                    | expression LESS expression
                    | expression GREATER_EQUAL expression
                    | expression LESS_EQUAL expression
                    | expression EQUALS expression
                    | expression NOT_EQUALS expression
                    | expression DOT_PLUS expression
                    | expression DOT_MINUS expression
                    | expression DOT_TIMES expression
                    | expression DOT_DIVIDE expression
     """
     p[0] = AST.OperatorExpression(p.linespan(0), p[2], [p[1], p[3]])
Beispiel #2
0
 def p_expression_right_unary_operator(p):
     """ expression : expression APOSTROPHE """
     p[0] = AST.OperatorExpression(p.linespan(0), p[2], [p[1]])
Beispiel #3
0
 def p_expression_unary_minus(p):
     """ expression : MINUS expression %prec UNARY_MINUS """
     p[0] = AST.OperatorExpression(p.linespan(0), 'u-', [p[2]])