[Libguestfs] [PATCH] builder: better handle some index parsing errors

Pino Toscano ptoscano at redhat.com
Thu Apr 3 08:59:29 UTC 2014


On Thursday 03 April 2014 09:00:43 Richard W.M. Jones wrote:
> On Wed, Apr 02, 2014 at 06:13:59PM +0200, Pino Toscano wrote:
> > Add a new lexer token, unused in the grammar, for the unknown lines
> > in index files; this should allow to better handle such kind of
> > parsing errors, removing the need to exit() directly (and leave
> > things in an unclean state).
> 
> Seems OK, but is the patch incomplete?  Should something in the parser
> handle the new symbol by displaying a better error?

The parser should now just error out when it is given a token it doesn't 
handle- Or, at least, it is how I got it working to try to cleanly 
handle faults in the lexer without resorting to call yyerror manually.

Instead of "unexpected character in input" now there is "syntax error" 
as message.

-- 
Pino Toscano




More information about the Libguestfs mailing list