summaryrefslogtreecommitdiffstats
path: root/eshtrans/backend
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-23 12:24:38 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-23 12:25:30 (EST)
commit5a64eb980d99b7c06522bb9062e5eb29ec960ebe (patch)
treeda054106f1b025d7d6fed98f791d0de4d4424230 /eshtrans/backend
parent8213d2db3a7838d3ed4d81bc37475db87bba247f (diff)
downloadeggshell-5a64eb980d99b7c06522bb9062e5eb29ec960ebe.zip
eggshell-5a64eb980d99b7c06522bb9062e5eb29ec960ebe.tar.gz
eggshell-5a64eb980d99b7c06522bb9062e5eb29ec960ebe.tar.bz2
eshtrans/backend: Don't write trailing spaces
Diffstat (limited to 'eshtrans/backend')
-rw-r--r--eshtrans/backend/codegen.esh15
1 files changed, 14 insertions, 1 deletions
diff --git a/eshtrans/backend/codegen.esh b/eshtrans/backend/codegen.esh
index 247618f..42b714a 100644
--- a/eshtrans/backend/codegen.esh
+++ b/eshtrans/backend/codegen.esh
@@ -42,11 +42,13 @@ codegen_sub()
{
local array="${1}"
shift 1
+ local print_spc=
local ionum=
local fname=
local static=
local static_fname=
+ print_spc=false
ionum=false
fname=''
static=false
@@ -54,6 +56,17 @@ codegen_sub()
IFS="${RS}"
for t in ${array}; do
+ if ${print_spc}; then
+ case "${t%${US}*}" in
+ T_NEWLINE)
+ ;;
+ *)
+ printf ' '
+ ;;
+ esac
+ print_spc=false
+ fi
+
# Handle I/O number false positives.
if ${ionum}; then
case "${t%${US}*}" in
@@ -130,7 +143,7 @@ codegen_sub()
ionum=true
;;
*)
- printf ' '
+ print_spc=true
;;
esac
done