summaryrefslogtreecommitdiffstats
path: root/eshtrans
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2016-02-21 13:21:11 (EST)
committer P. J. McDermott <pj@pehjota.net>2016-02-21 13:31:02 (EST)
commit5d5c6e2dd9c5fbdada5887485b2bc8117ecb0c72 (patch)
tree0177eff2b39a6cfd3f18e0e284902e92f6bac8ce /eshtrans
parente858b7b8330ec9e7b7f91a810ed9b30674299c2a (diff)
downloadeggshell-5d5c6e2dd9c5fbdada5887485b2bc8117ecb0c72.zip
eggshell-5d5c6e2dd9c5fbdada5887485b2bc8117ecb0c72.tar.gz
eggshell-5d5c6e2dd9c5fbdada5887485b2bc8117ecb0c72.tar.bz2
eshtrans/backend: Don't add a space after "("
Diffstat (limited to 'eshtrans')
-rw-r--r--eshtrans/backend/codegen.esh6
-rw-r--r--eshtrans/main.esh7
2 files changed, 8 insertions, 5 deletions
diff --git a/eshtrans/backend/codegen.esh b/eshtrans/backend/codegen.esh
index dea169b..1b2d168 100644
--- a/eshtrans/backend/codegen.esh
+++ b/eshtrans/backend/codegen.esh
@@ -35,7 +35,11 @@ codegen_sub()
for t in ${array}; do
toktext "${t}"
case "${t%${US}*}" in
- T_NEWLINE)
+ T_NEWLINE|T_LPAREN)
+ # Indenting lines can mess up here-documents.
+ # Adding a space after "(" can mess up function
+ # definitions (on zsh at least, while other
+ # shells accept the space).
;;
*)
printf ' '
diff --git a/eshtrans/main.esh b/eshtrans/main.esh
index 9373ff6..8b94861 100644
--- a/eshtrans/main.esh
+++ b/eshtrans/main.esh
@@ -60,14 +60,14 @@ main()
#try 'foo `bar`'
#try 'foo &&'
#try '{ foo; }'
-#try '( foo )'
+try '( foo )'
#try 'for i in 1 2 3; do stuff; done'
#try 'if foo; then bar; fi'
#try 'if foo; then bar; elif baz; then qux; else quux; fi'
#try 'if ; then ; fi'
#try 'while foo; do bar; done'
#try 'while ; do ; done'
-#try 'foo(){ bar; }'
+try 'foo(){ bar; }'
#try 'case foo in bar) baz;; (qux) quux;; quux);; esac'
#try 'foo bar ( baz )'
#try 'foo $(bar)'
@@ -106,7 +106,6 @@ main()
#try '$((1 + $foo))'
#try "foo '\`'"
#try 'foo "`"'
-#dbg=true
#try "\"'\""
-try "foo 'bar" "baz' &&"
+#try "foo 'bar" "baz' &&"
}