Example #1
0
def NullIncDec(p, w, bp):
  # type: (TdopParser, word_t, int) -> arith_expr_t
  """ ++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)
Example #2
0
def LeftIncDec(p, w, left, rbp):
  # type: (TdopParser, word_t, arith_expr_t, int) -> arith_expr_t
  """ 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)
def LeftIncDec(p, w, left, rbp):
    # type: (TdopParser, word_t, arith_expr_t, int) -> arith_expr_t
    """ For i++ and i--
  """
    arith_id = word_.ArithId(w)
    if arith_id == Id.Arith_DPlus:
        op_id = Id.Node_PostDPlus
    elif arith_id == Id.Arith_DMinus:
        op_id = Id.Node_PostDMinus
    else:
        raise AssertionError()

    tdop.CheckLhsExpr(left, p.parse_opts.parse_dynamic_arith(), w)
    return arith_expr.UnaryAssign(op_id, left)
def NullIncDec(p, w, bp):
    # type: (TdopParser, word_t, int) -> arith_expr_t
    """ ++x or ++x[1] """
    right = p.ParseUntil(bp)
    tdop.CheckLhsExpr(right, p.parse_opts.parse_dynamic_arith(), w)
    return arith_expr.UnaryAssign(word_.ArithId(w), right)