コード例 #1
0
def NullIncDec(p, w, bp):
    """ ++x or ++x[1] """
    right = p.ParseUntil(bp)
    child = tdop.ToLValue(right)
    if child is None:
        p_die("This value can't be assigned to", word=w)
    return arith_expr.UnaryAssign(word.ArithId(w), child)
コード例 #2
0
def LeftIncDec(p, w, left, rbp):
    """ For i++ and i--
  """
    if word.ArithId(w) == Id.Arith_DPlus:
        op_id = Id.Node_PostDPlus
    elif word.ArithId(w) == Id.Arith_DMinus:
        op_id = Id.Node_PostDMinus
    else:
        raise AssertionError

    child = tdop.ToLValue(left)
    return arith_expr.UnaryAssign(op_id, child)