>>> "Frans" == Frans Englich <[EMAIL PROTECTED]> writes:

 > I would prefer to do this at the Bison/Parser level because it is
 > convenient: I have access to various information passed to the
 > parse function,

You can easily make them available to the scanner.  And in fact, you
probably should, to have a clean, pure, interface bw the two.

 > the YYERROR macro, and the error function.

There is nothing wrong with defining a token, but not allowing it in
the grammar.  Just return it when there is a comment (and you don't
want them), then you'll have the expected result: a parser error.

 > The problem I see if I let Flex return a COMMENT token and add a
 > non-terminal in the Bison grammar to implement the checking, is how
 > to make it play well with the other rules -- the token gets in the
 > way.

Of course you must not try to use the token COMMENT when comment are
valid, just discard them.




_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to