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 Thu, 12 Oct 2017 08:26:35 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> It'd most likely need to be in bufferwords(), which somehow needs to
> know that the STRING token returned from the lexer is [or not] a
> comment and that therefore it should [or not] ignore the subsequent
> NEWLIN.  However, that cascades all the way down into gettok() which
> is where the "#" character is recognized and everything from there up
> to but not including the newline is consumed.

The traditional fix for this is a hacky state variable.  We'd
incremented it (or set it to 1?) on the comment character, and decrement
it (or set it to 0?) at the newline.  But, if I'm following, either we
might need to decrement it after the newline has been processed, or
tweak bufferwords() to add an extra state for detecting the newline
when it knows it's in that state, which implies an extra stage of the
dance.  It's not very elegant but there is lots of prior art in
terms of signalling between gettok() and the parser.

> (PWS, it would be helpful if you could include workers article numbers
> in your commit logs.)

Most of them do, except the ones anyone actually looks at.

pws



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