summaryrefslogtreecommitdiffstats
path: root/parsing/lexer.sh
diff options
context:
space:
mode:
Diffstat (limited to 'parsing/lexer.sh')
-rw-r--r--parsing/lexer.sh21
1 files changed, 21 insertions, 0 deletions
diff --git a/parsing/lexer.sh b/parsing/lexer.sh
index c856d99..53af926 100644
--- a/parsing/lexer.sh
+++ b/parsing/lexer.sh
@@ -429,6 +429,23 @@ scan_word()
'command substitution not supported'
break
;;
+ \\)
+ word="${word}${c}"
+ lgetc
+ case "${c}" in '')
+ # Bash, ksh93, mksh, and zsh ignore a
+ # backslash at the end of a file, but
+ # dash and BusyBox ash include it in the
+ # word. To help with script
+ # portability, we'll throw an error
+ # (which is a reasonable thing to do
+ # anyway).
+ synerr 'Unexpected end of file %s' \
+ 'after "\"'
+ ;;
+ esac
+ word="${word}${c}"
+ ;;
\')
word="${word}${c}"
while :; do
@@ -461,6 +478,10 @@ scan_word()
lgetc
done
+ if ${quoted}; then
+ synerr 'Unterminated quoted string'
+ fi
+
printf "%d${RS}%c${RS}%s" ${lines} "${c}" "${word}"
}