summaryrefslogtreecommitdiffstats
path: root/parsing
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-21 01:48:17 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-21 01:48:17 (EST)
commit84c016a9ceb8742604ccb714de0c7fde6ad50d1b (patch)
treeacfab1f46b49831810f7efe11a920773503fb131 /parsing
parent8cd31b6c6cfff683a7a47d925a74c8b9939c5e29 (diff)
downloadeggshell-84c016a9ceb8742604ccb714de0c7fde6ad50d1b.zip
eggshell-84c016a9ceb8742604ccb714de0c7fde6ad50d1b.tar.gz
eggshell-84c016a9ceb8742604ccb714de0c7fde6ad50d1b.tar.bz2
Don't indent lines in generated code
Doing so can break here-documents.
Diffstat (limited to 'parsing')
-rw-r--r--parsing/codegen.sh11
1 files changed, 9 insertions, 2 deletions
diff --git a/parsing/codegen.sh b/parsing/codegen.sh
index 0e32987..2b5f904 100644
--- a/parsing/codegen.sh
+++ b/parsing/codegen.sh
@@ -74,7 +74,13 @@ codegen_sub()
IFS="${RS}"
for t in ${array}; do
toktext "${t}"
- printf ' '
+ case "${t%${US}*}" in
+ T_NEWLINE)
+ ;;
+ *)
+ printf ' '
+ ;;
+ esac
done
unset IFS
}
@@ -108,7 +114,8 @@ parse_stack()
'C')
# Command substitution
sgetc # STX
- array="${array}$(parse_stack)"
+ array="${array}$(parse_stack)."
+ array="${array%.}"
;;
'A')
# Arithmetic expansion