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
- X-seq: zsh-workers 41858
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Sebastian Gniazdowski <psprint@xxxxxxxxxxx>, zsh-workers@xxxxxxx
- Subject: Re: [BUG] In reference to patch 39815, about (z) flag and $( parse error
- Date: Tue, 10 Oct 2017 20:49:17 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=gC+r8t9O6LYZRKVSwLOEIPNWmMe9DzsLxKlJyOSqUQI=; b=d8fN0+XoIxr/RbBheJW+Zl14Fz1GHx3tVAUbINvvheAlHW7sb0uBIe08Icxf6wsVte jMC6Ic5p1a1Cnxwq5hEhAh5ANfwuq0GkXreZSDD7Ci5O6TJivlng0JjSHe0ZtCd2a4VN 8f6sZW23SnV1GlvYA+M2SW27npu5yHQZFBC0dWwmwW4IxqYE3+Zo1Ufbx2VPRfMhkYES JULn/OifJRJ6Eh4igJfMwvul7tt3HKUlcSemYiVB45yGXvdjMcR+WFgDXCziYhrcgcGj VRhbXiL/ZVzPYQlaXqi2ZzCCSaeGATWyrYWg+O6uxTxu5JTkjV2uKNZZ+6fUFz51Mpiq B1dA==
- In-reply-to: <etPan.59dcf31d.1706ff79.98a8@zdharma.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <etPan.59dce146.1b81bc1.98a8@zdharma.org> <etPan.59dcf31d.1706ff79.98a8@zdharma.org>
On Oct 10, 6:19pm, Sebastian Gniazdowski wrote:
} Subject: Re: [BUG] In reference to patch 39815, about (z) flag and $( pars
}
} Following parses correctly with (z):
}
} asmcmds+=(${(o)$(ls -1 | perl -alne 'echo foo')
} })
} dbpkgs+=(${(fo@)$(pacman -Qq)})
}
} following doesn't:
}
} asmcmds+=(${(o)$(ls -1 | perl -alne 'echo foo'
} )})
} dbpkgs+=(${(fo@)$(pacman -Qq)})
}
} And looking further, it's about ")" being at the same line as $(
So the doc says that (Z:n:) "causes unquoted newlines to be treated as
ordinary whitespace" but in fact what it really does is cause newline
*not* to be converted into a separator; it is still labeled as its
own separate token, which confuses this parse.
The following fixes it, but it seems a hack -- is there a better way?
diff --git a/Src/lex.c b/Src/lex.c
index 8493d47..a7b71d6 100644
--- a/Src/lex.c
+++ b/Src/lex.c
@@ -308,8 +308,14 @@ zshlex(void)
isnewlin = 0;
else
isnewlin = (inbufct) ? -1 : 1;
- if (tok == SEMI || (tok == NEWLIN && !(lexflags & LEXFLAGS_NEWLINE)))
+ if (tok == SEMI)
tok = SEPER;
+ else if (tok == NEWLIN) {
+ if (lexflags & LEXFLAGS_NEWLINE)
+ zshlex();
+ else
+ tok = SEPER;
+ }
}
/**/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author