[antlr-interest] Newbie Question : Exception crash in C++ VC7

Thomas Rolfs thomas.rolfs at cox.net
Thu Mar 27 00:12:20 PST 2003


I do not have any experience with exception handling in C++ so any pointers are appreciated...
I am getting a crash when the following exception is caught at the bottom of CSLLexer::nextToken()

catch (ANTLR_USE_NAMESPACE(antlr)CharStreamIOException& csie) {
    throw ANTLR_USE_NAMESPACE(antlr)TokenStreamIOException(csie.io);
}
The crash seems to be due to "csie" being invalid. I am guessing the exception originated from CharBuffer::getChar(), but that is a guess. Obviously the exception is due to a problem with the grammar but having the exception generate it own exception is not helpful.

Some info:

Compiling my project under MS VC7 (.NET). 
Building the antlr 2.7.2 lib code as a separate static library and link it in. (There are quite a lot of warnings when I build the library code but they don't seem relevant.) 
I do not create my own exception handlers. 
Other exceptions such as "unrecognized token" seem to work fine.
Here is my grammar file minus the grammar rules:

options { language="Cpp"; }
class CSLParser extends Parser;
options {
    exportVocab=CSL;
    buildAST = true; 
     k = 2;
}
.....
class CSLLexer extends Lexer;
options {
    charVocabulary = '\0'..'\377';
    testLiterals=false;    // don't automatically test for literals
    k=2;                   // two characters of lookahead
}
....

Again, any help is appreciated.

Thanks,
Thomas Rolfs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030327/b2e71c2f/attachment.html


More information about the antlr-interest mailing list