From af5676a88e2e4313070f5c57176c348881f5187d Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Feb 2016 03:04:02 -0500 Subject: Fix function definitions (almost) --- (limited to 'parsing') 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' -- cgit v0.9.1