help-bison
[Top][All Lists]
Advanced

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

RE: How to discard data in scanner?


From: Vincent Zweije
Subject: RE: How to discard data in scanner?
Date: Thu, 6 Mar 2003 11:59:34 +0100

||  This is also my understanding, but it seems those char are
||  ported to stdout. I have
||  to re-define ECHO to null, otherwise it seems all the char
||  I do not return to
||  parser are print out. I am wondering if there is some way
||  to discard those char,
||  but do not bother about such global viriable as ECHO.

In Flex, the default rule can be suppressed with the -s option;
the generated scanner will abort with an error instead.

If you just want to ignore scanned garbage, append this simple
rule to the end:

.       ;

or use this to report an error:

.       fprintf(stderr, "Unexpected character '%c'.\n", yytext[0]);

(completely untested of course)

Ciao,
        Vincent.




reply via email to

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