Permalink
Browse files

Add location information to arithmetic parse error

  • Loading branch information...
Andy Chu
Andy Chu committed Oct 18, 2017
1 parent c19885e commit 467a4d8328e04bd4c563d9d25564aa8d26dfb8b6
Showing with 3 additions and 2 deletions.
  1. +3 −2 core/tdop.py
View
@@ -72,8 +72,7 @@ def ToLValue(node):
node.left.tag == arith_expr_e.ArithVarRef):
return ast.LhsIndexedName(node.left.name, node.right)
# TODO: Location information needs token instead of op_id.
p_die("Can't assign to %r", node)
return None
#
@@ -133,6 +132,8 @@ def LeftAssign(p, w, left, rbp):
""" 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 ast.BinaryAssign(word.ArithId(w), lhs, p.ParseUntil(rbp))

0 comments on commit 467a4d8

Please sign in to comment.