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

Re: [PATCH 2/2] clear the heredoc list in case par_event() fails



On Thu, 29 Nov 2018 10:39:15 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Thu, Nov 29, 2018 at 9:42 AM Peter Stephenson
> <p.stephenson@xxxxxxxxxxx> wrote:
> >
> > There's some slightly icky linkage between lex errors and the top level
> > requiring tok to be LEXERR.  The simple fix using the existing
> > signalling looks like the following.  I definitely don't think the tok =
> > LEXERR has a moral right to percolate through in the way it must
> > previously have been doing to avoid this, and the lexer does certainly
> > have the right to update the token when signalling a parse error, so
> > (famous last words) it's hard to see what could be wrong with this...  
> 
> Might this need to be conditional upon ... something ... so that e.g.
> ${(z)...} on a malformed here-document doesn't throw an error?  I
> don't have the code handy to poke around.

All this change is doing is setting the token to LEXERR in a case which
already loudly complains about the error and sets the error flag (this
is in a function parsestr() which calls parsetrnoerr() just above).

In most cases you'd expect the token in such a case already to be
LEXERR: Kamil's test includes an incomplete $( inside a here document so
there was some interesting nested parsing involved.

So anything reacting badly to the change in the token needs fixing.

pws



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