summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-20 01:12:36 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-20 01:12:36 (EST)
commit18636146ac828d3fc6f9a9003a5d3b98e7705fa5 (patch)
tree5910a838fddcec1253296defdba79eef2b2372b3
parent06268aa82c194d6be6cbba05001ba9016ba0d507 (diff)
downloadeggshell-18636146ac828d3fc6f9a9003a5d3b98e7705fa5.zip
eggshell-18636146ac828d3fc6f9a9003a5d3b98e7705fa5.tar.gz
eggshell-18636146ac828d3fc6f9a9003a5d3b98e7705fa5.tar.bz2
Implement "while" and "until" loops
-rw-r--r--parsing/parse.sh20
1 files changed, 15 insertions, 5 deletions
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'