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

Re: PATCH (!): Re: PATCH: (very) bad syntax error checking



Bart Schaefer wrote:

> ...
> 
> Second, encountering the token "fi" alone on a line is not setting the
> returned token to LEXERR, so in init.c the test of (tok == LEXERR) fails
> (the value of `tok' is, not surpisingly, `FI').
> 
> What follows appears to fix it, but Sven should confirm.  For one thing,
> I wonder why parse_list() doesn't use YYERROR() ... is there some reason
> why `ecused' should not be set to 0 in that specific case?

It doesn't use YYERROR* because it has to return NULL and we have
YYERRORs only for void and integer, I think (I didn't change that
part).

And we don't need to reset ecused there, it's one of the top-level
functions that will set up their environments with init_parse() the
next time round.

Your patch looks good, as far as I can see.

> I included a hunk for the grammar test, but why is the line number `-1'?

Because ZTST_execchunk() uses eval to execute the test code and
bin_eval() uses parse_string() with a last argument of zero to turn of 
line numbering. Hm, the fix would be to add a global variable where
bin_eval()/parse_string() (and other functions?) can store the old
line number and the error functions use (lineno < 0 ? savedlineno : lineno)
or something like that, right?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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