[antlr-interest] ANTLR C++ Lexer

Maurizio de Pascale mdepascale at dii.unisi.it
Tue Nov 28 09:28:43 PST 2006


Hi everybody,
I'm evaluating ANTLR for a research project so in order to learn it I'm 
planning to build some very small samples to experiment with.
I've started with a lexer-only demo, and here are some questions:

1) is it possible (and how) to recover from an exception thrown by 
lexer.nextToken?
I would like to do something like this:

do
{
    try{
   
    token = lexer.nextToken();

    } catch (exception)
    {
       //spit output for user but make sure we can continue
       lexer.resume() ?!?
    }
}
while( token->getType() != Lexer::EOF_ );


2) I've noticed the paraphrase option:

Identifier
options{paraphrase = "identifier";}

but is there a way (and how) I can access that string from C++?
it looks like those strings are only contained in the *TokenTypes.txt 
outputted vocabolary but not anywhere in the other C++ generated files :(
is this a parser-only accessible stuff?


thank you very much,
Maurizio de Pascale
mdepascale at dii.unisi.it


More information about the antlr-interest mailing list