Permalink
Browse files

Improve the error message when there are extra arguments to exit/break.

Tickled by 'modernish' repo parsed by 'test/wild.sh all'.
  • Loading branch information...
Andy Chu
Andy Chu committed Jan 24, 2018
1 parent ab9a59f commit a0bc88f7c06fcfa4915b8cb9b4c5c555c1b96a47
Showing with 3 additions and 1 deletion.
  1. +3 −1 osh/cmd_parse.py
View
@@ -618,7 +618,9 @@ def ParseSimpleCommand(self):
elif len(suffix_words) == 2:
arg_word = suffix_words[1]
else:
self.AddErrorContext('Too many arguments')
# Underline the extra word.
self.AddErrorContext(
'Unexpected argument to %r', kw_token.val, word=suffix_words[2])
return None
return ast.ControlFlow(kw_token, arg_word)

0 comments on commit a0bc88f

Please sign in to comment.