summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-20 00:37:02 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-20 00:39:09 (EST)
commit3008e375da980540d5255c34cec3b7d0999f483f (patch)
tree37a50db7606f7ec6ee2d0055883dd6c4d00c513b
parent9b7eb3e9df344c718825b91df4c089525282a8c0 (diff)
downloadeggshell-3008e375da980540d5255c34cec3b7d0999f483f.zip
eggshell-3008e375da980540d5255c34cec3b7d0999f483f.tar.gz
eggshell-3008e375da980540d5255c34cec3b7d0999f483f.tar.bz2
Fix handling of unexpected EOF
-rw-r--r--parsing/parse.sh14
1 files changed, 7 insertions, 7 deletions
diff --git a/parsing/parse.sh b/parsing/parse.sh
index 654199b..da0b07f 100644
--- a/parsing/parse.sh
+++ b/parsing/parse.sh
@@ -21,7 +21,8 @@ complete_command()
separator
return 0
fi
- return 1
+ # Unexpected EOF
+ synexp ''
}
list()
@@ -400,10 +401,9 @@ parse()
init_lexer "${fn}"
# If this returns (does not exit), there are no errors.
- while complete_command; do :; done
- if ! accept T_EOF; then
- synexp ''
- fi
+ while ! accept T_EOF; do
+ complete_command
+ done
get_tokens
@@ -441,7 +441,7 @@ try()
#try 'foo ${#bar#}'
#try 'foo ${^}'
#try 'foo `bar`'
-#try 'foo &&'
-try '{ foo; }'
+try 'foo &&'
+#try '{ foo; }'
#try '( foo )'
#try 'for i in 1 2 3; do stuff; done'