diff options
-rw-r--r-- | parsing/parse.sh | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh index e0852bb..66506b4 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -85,8 +85,6 @@ command() elif compound_command; then redirect_list return 0 - elif function_defn; then - return 0 fi return 1 } @@ -291,19 +289,6 @@ until_clause() return 1 } -function_defn() -{ - if accept T_FNAME; then - if accept T_LPAREN; then - expect T_RPAREN - if linebreak && function_body; then - return 0 - fi - fi - fi - return 1 -} - function_body() { if compound_command; then @@ -339,8 +324,15 @@ simple_command() fi return 0 elif cmd_name; then - cmd_suffix - return 0 + if accept T_LPAREN; then + expect T_RPAREN + if linebreak && function_body; then + return 0 + fi + else + cmd_suffix + return 0 + fi fi return 1 } @@ -533,7 +525,7 @@ try() } #try '"foo bar" && $baz || qux' '${quux%uux quuux' -try '"foo bar" && $baz || qux' '${quux%uux } quuux' +#try '"foo bar" && $baz || qux' '${quux%uux } quuux' #try 'foo ${bar}' #try 'foo ${#bar}' #try 'foo ${bar#baz}' @@ -549,5 +541,5 @@ try '"foo bar" && $baz || qux' '${quux%uux } quuux' #try 'if ; then ; fi' #try 'while foo; do bar; done' #try 'while ; do ; done' -#try 'foo(){ bar; }' -try 'case foo in bar) baz;; (qux) quux;; quux);; esac' +try 'foo(){ bar; }' +#try 'case foo in bar) baz;; (qux) quux;; quux);; esac' |