diff options
author | P. 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) |
commit | 5a64eb980d99b7c06522bb9062e5eb29ec960ebe (patch) | |
tree | da054106f1b025d7d6fed98f791d0de4d4424230 | |
parent | 8213d2db3a7838d3ed4d81bc37475db87bba247f (diff) | |
download | eggshell-5a64eb980d99b7c06522bb9062e5eb29ec960ebe.zip eggshell-5a64eb980d99b7c06522bb9062e5eb29ec960ebe.tar.gz eggshell-5a64eb980d99b7c06522bb9062e5eb29ec960ebe.tar.bz2 |
eshtrans/backend: Don't write trailing spaces
-rw-r--r-- | eshtrans/backend/codegen.esh | 15 |
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 |