From 18636146ac828d3fc6f9a9003a5d3b98e7705fa5 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Feb 2016 01:12:36 -0500 Subject: Implement "while" and "until" loops --- (limited to 'parsing') diff --git a/parsing/parse.sh b/parsing/parse.sh index 577b41e..4d89806 100644 --- a/parsing/parse.sh +++ b/parsing/parse.sh @@ -240,13 +240,21 @@ else_part() while_clause() { - : TODO: Implement + if accept T_WHILE; then + if compound_list && do_group; then + return 0 + fi + fi return 1 } until_clause() { - : TODO: Implement + if accept T_UNTIL; then + if compound_list && do_group; then + return 0 + fi + fi return 1 } @@ -463,6 +471,8 @@ try() #try '{ foo; }' #try '( foo )' #try 'for i in 1 2 3; do stuff; done' -try 'if foo; then bar; fi' -try 'if foo; then bar; elif baz; then qux; else quux; fi' -try 'if ; then ; fi' +#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' -- cgit v0.9.1