> On 18 Jun 2020, at 10:24, Daniele Nicolodi <dani...@grinta.net> wrote:
> 
> On 18/06/2020 00:39, Akim Demaille wrote:
>> 
>> Would you have an example of what you mean?
> …
> In the existing code, on error the lexer emits a LEX_ERROR token. This
> results in a grammar error that triggers error recovery (good) but also
> in an extra error emitted by Bison (bad). Right now the code checks the
> error messages in yyerror() and suppresses the unwanted error reporting
> if it contains the string "LEX_ERROR”.

In my C++ parser, the lexer has rule
.          { return my_parser::token::token_error; }

When it is triggers, I get the error:
  <file>:21.1: error: syntax error, unexpected token error

It might be nicer to actually write out this token, though.



Reply via email to