From 5d5c6e2dd9c5fbdada5887485b2bc8117ecb0c72 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sun, 21 Feb 2016 13:21:11 -0500 Subject: eshtrans/backend: Don't add a space after "(" --- 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' &&" } -- cgit v0.9.1