Ejemplo n.º 1
0
def NullPrefixOp(p, w, bp):
    """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 ast.ArithUnary(word.ArithId(w), right)
Ejemplo n.º 2
0
def NullUnaryMinus(p, t, bp):
    """ -1, to distinguish from binary operator. """
    right = p.ParseUntil(bp)
    return ast.ArithUnary(Id.Node_UnaryMinus, right)