[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Best Practice: lexer error to silent parser abort
From: |
Akim Demaille |
Subject: |
Re: Best Practice: lexer error to silent parser abort |
Date: |
Fri, 1 May 2020 10:34:24 +0200 |
Hi Simon,
> Le 1 janv. 2019 à 23:19, Simon Richter <address@hidden> a écrit :
>
> Hi,
>
> I'm wondering what would be the best way to communicate from the lexer
> to the parser that the lexer detected something it could not tokenize
> (in my case, characters outside the allowed character set).
>
> In this case, it is fairly obvious that we want to abort, without a call
> to yyerror, but properly destructing and deallocating any values still
> on the stack.
>
> The best way I can think of at the moment would be to define an
> additional token type that isn't used in any rule, return that from the
> lexer, and create a shortcut between lexer and parser that silences yyerror.
Bison 3.6 will offer a means to do this: returning YYerror from the scanner.
Please, have a look at this commit:
https://lists.gnu.org/r/bison-patches/2020-04/msg00180.html
and give a try to this beta:
https://lists.gnu.org/r/bison-patches/2020-04/msg00181.html
Cheers!
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Best Practice: lexer error to silent parser abort,
Akim Demaille <=