From 3008e375da980540d5255c34cec3b7d0999f483f Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 20 Feb 2016 00:37:02 -0500 Subject: Fix handling of unexpected EOF --- 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' -- cgit v0.9.1