예제 #1
0
파일: tdop.py 프로젝트: sailfish009/oil
def LeftAssign(p, w, left, rbp):
  # type: (TdopParser, word_t, arith_expr_t, int) -> arith_expr_t
  """ Normal binary operator like 1+2 or 2*3, etc. """
  # x += 1, or a[i] += 1

  CheckLhsExpr(left, p.parse_opts.parse_dynamic_arith(), w)
  return arith_expr.BinaryAssign(word_.ArithId(w), left, p.ParseUntil(rbp))
예제 #2
0
def LeftAssign(p, w, left, rbp):
    # type: (TdopParser, word_t, arith_expr_t, int) -> arith_expr_t
    """ Normal binary operator like 1+2 or 2*3, etc. """
    # x += 1, or a[i] += 1
    lhs = ToLValue(left)
    if lhs is None:
        p_die("Can't assign to %r", lhs, word=w)
    return arith_expr.BinaryAssign(word.ArithId(w), lhs, p.ParseUntil(rbp))
예제 #3
0
파일: tdop.py 프로젝트: asokoloski/oil
def LeftAssign(p, w, left, rbp):
    # type: (TdopParser, word_t, arith_expr_t, int) -> arith_expr_t
    """ Normal binary operator like 1+2 or 2*3, etc. """
    # x += 1, or a[i] += 1
    lhs = ToLValue(left)
    if lhs is None:
        # TODO: It would be nice to point at 'left', but osh/word.py doesn't
        # support arbitrary arith_expr_t.
        #p_die("Can't assign to this expression", word=w)
        p_die("Left-hand side of this assignment is invalid", word=w)
    return arith_expr.BinaryAssign(word_.ArithId(w), lhs, p.ParseUntil(rbp))