diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-20 13:55:44 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-20 13:57:09 (EST) |
commit | e978b31de0d40fe2054327f9adfc78b9d3fc0e1d (patch) | |
tree | 4635dba4e1be4e9d73891019d7bf0fa595e2d263 /parsing/parse.sh | |
parent | 39b80f0ea4ac78c29799cffd8c81f701fd2ae222 (diff) | |
download | eggshell-e978b31de0d40fe2054327f9adfc78b9d3fc0e1d.zip eggshell-e978b31de0d40fe2054327f9adfc78b9d3fc0e1d.tar.gz eggshell-e978b31de0d40fe2054327f9adfc78b9d3fc0e1d.tar.bz2 |
Don't eat the first token after a command substitution
Diffstat (limited to 'parsing/parse.sh')
-rw-r--r-- | parsing/parse.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh index da9b2e5..d9fb6a1 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -600,14 +600,19 @@ parse_sub() if ${complete} && ! accept T_EOF; then synexp '' fi + if ! ${complete}; then + case "${tok%${US}*}" in + T_RPAREN) + ;; + *) + synerr 'Missing ")"' + ;; + esac + fi get_lineno printf '%c' "${RS}" - if accept T_RPAREN; then - printf ')' - else - get_lexer_char - fi + get_lexer_char printf '%c' "${RS}" get_tokens @@ -675,4 +680,7 @@ try() #try 'case foo in bar) baz;; (qux) quux;; quux);; esac' #try 'foo bar ( baz )' try 'foo $(bar)' +try 'foo $(bar); baz' +try 'foo $(bar)' 'baz' +try 'foo $(bar) baz' #try 'foo $((1 + 1))' |