From 899b2d00b7e26699c68d8b73cf6e85ce755a28b4 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Feb 2016 01:56:44 -0500 Subject: Implement (non-functional) function handling --- (limited to 'parsing') diff --git a/parsing/parse.sh b/parsing/parse.sh index 4d89806..93699f8 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -260,13 +260,22 @@ until_clause() function_defn() { - : TODO: Implement + 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() { - : TODO: Implement + if compound_command; then + redirect_list + fi return 1 } @@ -474,5 +483,6 @@ try() #try 'if foo; then bar; fi' #try 'if foo; then bar; elif baz; then qux; else quux; fi' #try 'if ; then ; fi' -try 'while foo; do bar; done' -try 'while ; do ; done' +#try 'while foo; do bar; done' +#try 'while ; do ; done' +#try 'foo(){ bar; }' -- cgit v0.9.1