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 ast.UnaryAssign(word.ArithId(w), child)
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 ast.UnaryAssign(op_id, child)
def NullIncDec(p, w, bp): """ ++x or ++x[1] """ right = p.ParseUntil(bp) child = tdop.ToLValue(right) return ast.UnaryAssign(word.ArithId(w), child)