def p_d_expression_binop_lefti(t): '''d_expression : i_expression PLUS d_expression | i_expression MINUS d_expression | i_expression TIMES d_expression''' try: if t[2] == '+' : t[0] = n(t[1]) + t[3] elif t[2] == '-' : t[0] = n(t[1]) - t[3] elif t[2] == '*': t[0] = n(t[1]) * t[3] except TypeError as te: error_expression_invalid(threading.currentThread().expr,MSG_ERROR_PLY_TYPE + "(%s)" % str(te))
def p_d_expression_binop_righti(t): '''d_expression : d_expression PLUS i_expression | d_expression MINUS i_expression | d_expression TIMES i_expression''' try: if t[2] == '+' : t[0] = t[1] + n(t[3]) elif t[2] == '-' : t[0] = t[1] - n(t[3]) elif t[2] == '*': t[0] = t[1] * n(t[3]) except TypeError as te: error_expression_invalid(threading.currentThread().expr,MSG_ERROR_PLY_TYPE + "(%s)" % str(te))
def p_expression_n(t): 'd_expression : N i_expression' t[0] = n(t[2])
def p_statement_iexpr(t): 'statement : i_expression' t[0] = n(t[1])