help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

error handling


From: alexandre.gouraud
Subject: error handling
Date: Wed, 23 May 2001 15:11:39 +0200

Hi all,

I did a parser with bison and flex (bison 1.28 and flex-2.5).
I am parsing strings in memory instead of strings from the
standart input. Each time I encounter an error in the string,
I would like the parser to finish reading the entire string
(up to the end of the string), so that the flex routine can
close its buffer properly.
My grammar looks like :

%%

hostname_group : hostname
   | hostname hostname_group
   | error
      {
         yyerrok;
         yyclearin;
      }
;

hostname : case1
      {
          /* do some stuff */
      }
   | case2
      {
           yyerror("this case is not supported yet\n");
           YYABORT;
      }
;

/* definitin of case1, case2,  etc....*/

%%

It doesn't work as I expect it to work. I am not sure I am
using the error symbol properly. Does anyone have an idee how
I should rewrite my grammar ?

Thanks.

Alexandre.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]