diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-20 01:56:44 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-20 01:56:44 (EST) |
commit | 899b2d00b7e26699c68d8b73cf6e85ce755a28b4 (patch) | |
tree | 4495e65a7c63f1fac90c60fefc461b6f1e51cd08 /parsing | |
parent | 18636146ac828d3fc6f9a9003a5d3b98e7705fa5 (diff) | |
download | eggshell-899b2d00b7e26699c68d8b73cf6e85ce755a28b4.zip eggshell-899b2d00b7e26699c68d8b73cf6e85ce755a28b4.tar.gz eggshell-899b2d00b7e26699c68d8b73cf6e85ce755a28b4.tar.bz2 |
Implement (non-functional) function handling
Diffstat (limited to 'parsing')
-rw-r--r-- | parsing/parse.sh | 18 |
1 files changed, 14 insertions, 4 deletions
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; }' |