[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Best Practice: lexer error to silent parser abort
From: |
Simon Richter |
Subject: |
Best Practice: lexer error to silent parser abort |
Date: |
Tue, 1 Jan 2019 23:19:14 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 |
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.
Is there a better way to do this?
Simon
signature.asc
Description: OpenPGP digital signature
- Best Practice: lexer error to silent parser abort,
Simon Richter <=