[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: parsing template?
From: |
Ben Pfaff |
Subject: |
Re: parsing template? |
Date: |
Sat, 30 May 2015 16:20:50 -0700 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
On Sat, May 30, 2015 at 03:28:27PM -0500, Alan Mead wrote:
> I filed a bug because CLUSTER hangs on unknown subcommands. It turns
> out that (for reasons I don't fully understand) the main parsing loop
> never terminates when an unsupported or invalid subcommand is used. I
> don't understand how the parsing works with all the lex_*() functions.
> It looks like when any unexpected subcommand is present that the rest of
> the command is ignored and the "lex_token (lexer) != T_ENDCMD" condition
> is never met.
>
> Is there a working template of how parsing is supposed to occur?
>
> I can fix the issue by adding a final else at the end of parser:
>
> $ diff quick-cluster.c quick-cluster.c.original
> 579,584d578
> < else
> < {
> < lex_error (lexer, _("Invalid or unsupported subcommand"));
> < goto error;
> < }
> <
>
> Is there a reason not to do this? One reason is that it will break any
> SPSS syntax that uses unsupported subcommands but that seems better than
> having PSPP hang.
It's just a bug. I fixed it with a patch similar to your suggestion.