Ejemplo n.º 1
0
def NullPrefixOp(p, w, bp):
    # type: (TdopParser, word_t, int) -> arith_expr_t
    """Prefix operator.

  Low precedence:  return, raise, etc.
    return x+y is return (x+y), not (return x) + y

  High precedence: logical negation, bitwise complement, etc.
    !x && y is (!x) && y, not !(x && y)
  """
    right = p.ParseUntil(bp)
    return arith_expr.Unary(word_.ArithId(w), right)
Ejemplo n.º 2
0
def NullUnaryMinus(p, t, bp):
  # type: (TdopParser, word_t, int) -> arith_expr_t
  """ -1, to distinguish from binary operator. """
  right = p.ParseUntil(bp)
  return arith_expr.Unary(Id.Node_UnaryMinus, right)