Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [BUG] In reference to patch 39815, about (z) flag and $( parse error



On 13 października 2017 at 22:55:10, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> On Oct 13, 10:36am, Peter Stephenson wrote:
> }
> } presumably we get away with the other bits we've added to lexflags?
>  
> "make check" doesn't find any that we don't get away with, in any case.
>  
> Sebastian, if you have a minimal test case for this perhaps we could
> add it to D04parameter?
>  

Maybe this:

  local buf=$'asmcmds+=(${(o)$(ls -1 \'.*\' | perl -alne \'\nEND{ print " "; }\'\n)})'
  local -a arr=( "${(@)${(@Z+cn+)buf}/(#m)?/-> $MATCH}" )
  print -rl -- "$arr[@]"
0:$( being closed at next line
>-> asmcmds+=(
>-> ${(o)$(ls -1 '.*' | perl -alne '
>END{ print " "; }'
>)}
>-> )

it precedes lines with "->" to know what's token and what's in-token line break. Attached as diff.

I've ran my unit tests and screened token dumps and everything looks correct.

But I've spotted other thing. Z+cn+ seems to parse "always", (z) seems to parse superficially when it occurs e.g. anonymous function. This doesn't depend on Zsh version used. Attached is diff of token dumps from the zshrc (the one with cgasm), on left we see normal parsing (Z+cn+ flag), on right a shift to "coarse-grained mode" (z-flag) when enterring anon-fun. This doesn't feel right, although I'm happy with (z) flag as I'm using Z+cn+ (just being anxious for bigger changes here).

--  
Sebastian Gniazdowski
psprint /at/ zdharma.org
diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst
index 5ffaaa1..05f886b 100644
--- a/Test/D04parameter.ztst
+++ b/Test/D04parameter.ztst
@@ -2401,3 +2401,13 @@ F:behavior, see http://austingroupbugs.net/view.php?id=888
 0:Append to element of associative array on creation
 >one
 >howsyourfathertoday
+
+  local buf=$'asmcmds+=(${(o)$(ls -1 \'.*\' | perl -alne \'\nEND{ print " "; }\'\n)})'
+  local -a arr=( "${(@)${(@Z+cn+)buf}/(#m)?/-> $MATCH}" )
+  print -rl -- "$arr[@]"
+0:$( being closed at next line
+>-> asmcmds+=(
+>-> ${(o)$(ls -1 '.*' | perl -alne '
+>END{ print " "; }'
+>)}
+>-> )

Attachment: z_vs_zcn.png
Description: PNG image



Messages sorted by: Reverse Date, Date, Thread, Author