summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-19 23:42:19 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-19 23:42:19 (EST)
commit066cefc083a0538a5ecd9722eb22226b451d1845 (patch)
tree15477d631b2125c46f25ec64bf293505f3e1aad1
parent48996f2bfc32321dbd6c22d8fcdd0bb385f611cc (diff)
downloadeggshell-066cefc083a0538a5ecd9722eb22226b451d1845.zip
eggshell-066cefc083a0538a5ecd9722eb22226b451d1845.tar.gz
eggshell-066cefc083a0538a5ecd9722eb22226b451d1845.tar.bz2
Delimit words at unescaped operators
Also expect EOF at end of script.
-rw-r--r--parsing/lexer.sh2
-rw-r--r--parsing/parse.sh3
2 files changed, 3 insertions, 2 deletions
diff --git a/parsing/lexer.sh b/parsing/lexer.sh
index 01bc721..003ee30 100644
--- a/parsing/lexer.sh
+++ b/parsing/lexer.sh
@@ -203,7 +203,7 @@ scan_word()
lines=$((${lines} + 1))
word="${word}${c}"
;;
- ' '|"${HT}")
+ ' '|"${HT}"|'&'|'|'|';'|'('|')'|'<'|'>')
if ! ${in_param} && ! ${quoted}; then
break
fi
diff --git a/parsing/parse.sh b/parsing/parse.sh
index ff6b5ad..1f638e0 100644
--- a/parsing/parse.sh
+++ b/parsing/parse.sh
@@ -401,6 +401,7 @@ parse()
# If this returns (does not exit), there are no errors.
while complete_command; do :; done
+ expect T_EOF
get_tokens
@@ -441,4 +442,4 @@ try()
#try 'foo &&'
#try '{ foo ; }'
#try '( foo )'
-try 'for i in 1 2 3 ; do stuff ; done'
+try 'for i in 1 2 3; do stuff; done'