[antlr-interest] stop the lexer error when invoking the lexer without calling the parser
Meena Vinod
spprtmail09 at yahoo.com
Tue Jan 27 01:54:40 PST 2009
Hi,
Is there a way where in if there is a lexer error,the antlr reports the error and exits without creating the parser for it ?
for ex:
In the calling program:
lex = LexerNew(input);
{
fprintf(stderr,
exit(ANTLR3_ERR_NOMEM);
}
tokens = antlr3CommonTokenStreamSourceNew(ANTLR3_SIZE_HINT, TOKENSOURCE(lex));
{
fprintf(stderr,
exit(ANTLR3_ERR_NOMEM);
}
//want the lexer to exit here only in case of a lexer error
-------------------------------------------------------------------------
parser = ParserNew(tokens);
//calling the startrule from my .g file
parser ->starting _rule(parser);
Thanksif(lex == NULL)"Unable to create the lexer due to malloc() failure1\n"); if(tokens == NULL)"Out of memory trying to allocate token stream\n");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090127/7180d772/attachment.html
More information about the antlr-interest
mailing list