help-flex
[Top][All Lists]
Advanced

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

Re: don't want to display yyout


From: Hans Aberg
Subject: Re: don't want to display yyout
Date: Thu, 19 May 2005 12:17:12 +0200

At 10:58 +0200 2005/05/19, Vincent Zweije wrote:
||  I think Flex imnplements a default rule
||     .  ECHO
||  which can be overriden by writing
||     .  { /* whatever you like */ }

True.

However, if you hit your default rule, that means that your
token definitions didn't cover all possible input.  For some
applications, that's a BAD thing.

If so, find the holes in your token definitions, and plug them.

I like to use %option nodefault precisely for that reason.

The default rule, it seems, is mainly quick hack around proper error handling. A proper program should detect the erroneous characters and take proper error handling, rather than just outputting them. One possibility is an error message from the lexer. Another is to send it over to the parser, in the case there is one, and let it generate the error message, admitting any eventual error recovery. Also, one could output the characters to stderr, which later could be redirected.
--
  Hans Aberg




reply via email to

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