summaryrefslogtreecommitdiffstats
path: root/parsing
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-21 02:38:10 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-21 02:38:10 (EST)
commite93028f9d7f47ae42733745d3de2d99bf4fe1651 (patch)
tree192ae7df79dc70da38b5c9b4bad6481b7fbc5484 /parsing
parent33554a524c8fda86e8d41cc91f8e992ef09b0555 (diff)
downloadeggshell-e93028f9d7f47ae42733745d3de2d99bf4fe1651.zip
eggshell-e93028f9d7f47ae42733745d3de2d99bf4fe1651.tar.gz
eggshell-e93028f9d7f47ae42733745d3de2d99bf4fe1651.tar.bz2
Fix handling of newlines with here-documents
Sequential here-documents were getting indented. Everything after a newline was being considered a here-document.
Diffstat (limited to 'parsing')
-rw-r--r--parsing/lexer.sh20
1 files changed, 8 insertions, 12 deletions
diff --git a/parsing/lexer.sh b/parsing/lexer.sh
index dc0b48d..d559274 100644
--- a/parsing/lexer.sh
+++ b/parsing/lexer.sh
@@ -86,8 +86,11 @@ next()
if ${here_awaiting_end}; then
synexp ''
else
- here_awaiting_end=false
- here_awaiting_word=true
+ case "${here_queue}" in *"${RS}"*)
+ here_awaiting_end=false
+ here_awaiting_word=true
+ ;;
+ esac
fi
lgetc
lineno=$((${lineno} + 1))
@@ -195,13 +198,7 @@ next_here()
here_end="${here_end#*${US}}"
here_escaped="${here##*${US}}"
here_queue="${here_queue#*${RS}}"
- case "${here_queue}" in
- *"${RS}"*)
- ;;
- *)
- here_awaiting_word=false
- ;;
- esac
+ here_awaiting_word=false
line=''
word=''
@@ -217,14 +214,13 @@ next_here()
"${here_end}"
;;
"${LF}")
- line="${line}${c}"
word="${word}${line}"
- case "${line}" in "${here_end}${LF}")
- lgetc
+ case "${line}" in "${here_end}")
tok="T_WORD${US}${word}"
return
;;
esac
+ word="${word}${c}"
line=''
;;
"${HT}")