summaryrefslogtreecommitdiffstats
path: root/parsing
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-21 03:21:31 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-21 03:21:31 (EST)
commit2b85678c578cb22d15d449ab70872d3b6b6b9364 (patch)
tree4146901112f5a582057f22678c1835a09e6c3d67 /parsing
parent84bc61b8d596f3d342980e98b9c580d655ea0778 (diff)
downloadeggshell-2b85678c578cb22d15d449ab70872d3b6b6b9364.zip
eggshell-2b85678c578cb22d15d449ab70872d3b6b6b9364.tar.gz
eggshell-2b85678c578cb22d15d449ab70872d3b6b6b9364.tar.bz2
Don't loop forever on unterminated singly quoted string in words
Diffstat (limited to 'parsing')
-rw-r--r--parsing/lexer.sh12
-rw-r--r--parsing/parse.sh9
2 files changed, 14 insertions, 7 deletions
diff --git a/parsing/lexer.sh b/parsing/lexer.sh
index 53af926..292d2fa 100644
--- a/parsing/lexer.sh
+++ b/parsing/lexer.sh
@@ -451,9 +451,15 @@ scan_word()
while :; do
lgetc
word="${word}${c}"
- case "${c}" in \')
- break
- ;;
+ case "${c}" in
+ '')
+ synerr '%s %s' \
+ 'Unterminated' \
+ 'quoted string'
+ ;;
+ \')
+ break
+ ;;
esac
done
;;
diff --git a/parsing/parse.sh b/parsing/parse.sh
index c9e8000..dd340bd 100644
--- a/parsing/parse.sh
+++ b/parsing/parse.sh
@@ -665,7 +665,8 @@ try()
#try 'foo <<\EOF' '$(bar)' 'EOF'
#try 'foo <<EOF1; bar <<EOF2' 'baz' 'EOF1' 'qux' 'EOF2'
#try '\foo'
-try '"foo bar" baz'
-try '"foo'
-try 'foo\" bar'
-try 'foo\'
+#try '"foo bar" baz'
+#try '"foo'
+#try 'foo\" bar'
+#try 'foo\'
+try "foo'"