Permalink
Browse files
Add location info to the 'redirect of assignment' error.
- Loading branch information...
Showing
with
6 additions
and
4 deletions.
-
+1
−1
core/ui.py
-
+4
−3
osh/cmd_parse.py
-
+1
−0
osh/cmd_parse_test.py
|
|
@@ -91,7 +91,7 @@ def MakeStatusLines(): |
|
|
|
|
|
def PrettyPrintError(parse_error, arena, f):
|
|
|
#print(parse_error)
|
|
|
if parse_error.span_id:
|
|
|
if parse_error.span_id is not None:
|
|
|
span_id = parse_error.span_id
|
|
|
elif parse_error.token:
|
|
|
span_id = parse_error.token.span_id
|
|
|
|
|
|
@@ -592,9 +592,10 @@ def ParseSimpleCommand(self): |
|
|
|
|
|
if not suffix_words: # ONE=1 TWO=2 (with no other words)
|
|
|
if redirects:
|
|
|
# TODO: redirect ops should have a token with location info instead of
|
|
|
# an op_id.
|
|
|
self.AddErrorContext('Got redirects in global assignment')
|
|
|
binding1 = prefix_bindings[0]
|
|
|
_, _, _, spid = binding1
|
|
|
self.AddErrorContext('Got redirects in global assignment',
|
|
|
span_id=spid)
|
|
|
return None
|
|
|
|
|
|
pairs = []
|
|
|
|
|
|
@@ -1254,6 +1254,7 @@ def testArraySyntax(self): |
|
|
|
|
|
def testRedirectsInAssignment(self):
|
|
|
err = _assertParseCommandListError(self, 'x=1 >/dev/null')
|
|
|
err = _assertParseCommandListError(self, 'echo hi; x=1 >/dev/null')
|
|
|
err = _assertParseCommandListError(self, 'declare x=1 >/dev/null')
|
|
|
|
|
|
def testEofInDoubleQuoted(self):
|
|
|
|
0 comments on commit
b900561