On 11 Oct 2017 at 05:49:17, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
> On Oct 10, 6:19pm, Sebastian Gniazdowski wrote:
> ...
> } 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
I've tested the patch. It was easy because I have unit tests that check correctness of parsing of various zshrc files taken from Github. There's a problem with line:
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=("expand-or-complete")
Testing it manually is fine:
% data='ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=("expand-or-complete")'; print -rl "${(Z+cn+)data}"
ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=(
"expand-or-complete"
)
However one test fails on this line. I attach screenshot, left is dump of tokens on 5.3.1, right is on 5.4.2-dev-0 with the patch.
So basically the patch produces single token: ZSH_AUTOSUGGEST_CLEAR_WIDGETS+=("expand-or-complete").
One other problematic line is: hosts=($h ${${${(@M)${(f)"$(cat ~/.ssh/config)"}:#Host *}#Host }:#*[*?]*})
The zshrc is:
https://github.com/zdharma/zplugin-crasis/blob/master/test/_test4/zshrc
The dump is easy to do: data=$(<zshrc); print -rl "${(Z+cn+)data}" > all-5.4.2-dev-0.txt, etc.
--
Sebastian Gniazdowski
psprint /at/ zdharma.org
Attachment:
tokdmp.png
Description: PNG image