From 066cefc083a0538a5ecd9722eb22226b451d1845 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 19 Feb 2016 23:42:19 -0500 Subject: Delimit words at unescaped operators Also expect EOF at end of script. --- 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' -- cgit v0.9.1