[antlr-interest] error

denisignatovich denisignatovich at yahoo.com
Sun Apr 3 03:26:57 PDT 2005


Hi,
 
First of all, greatly admire Antlr and the work that went into it;
second, have a question:
 
Compiling (after writing it under Cygwin and successfully testing the
parser) under VC++ .NET 2003, with Antlr 2.7.4 (2.7.5 doesn't compile
because of something related to overwriting virtual functions,
searched all over and could not find anything, but does compile under
Cygwin). After running the debug version, it crashes on
newParser.script() command:
 
ifstream file ("C:\mySource\test.xml");

myLexer lexer (file);

myParser newParser (lexer);

try {

newParser.script();

....

A more specific call stack is:

> myProg.exe!antlr::RefCount<antlr::LexerInputState>::operator->() 
Line 62 + 0xd C++
  myProg.exe!antlr::CharScanner::resetText()  Line 308 + 0xb C++
  myProg.exe!myLexer::nextToken()  Line 42 C++
  myProg.exe!antlr::TokenBuffer::fill()  Line 50 + 0x19 
  myProg.exe!antlr::TokenBuffer::LA()  Line 58 
  myProg.exe!antlr::LLkParser::LA(unsigned int i=0x00000001)  Line 47 C++
  myProg.exe!antlr::Parser::match()  Line 101 + 0xf 
  myProg.exe!myParser::script()  Line 39 C++
 myProg.exe!myMainFunction()  Line 1362 C++  ------------->>>>>>>
parser declaration, code shown above


in refcount.hpp, it crashes on
 
 T* get() const
 {
>  return ref ? ref->ptr : 0;
 }


in charscanner.hpp

 virtual void resetText()
 {
  text = "";
>  inputState->tokenStartColumn = inputState->column;
  inputState->tokenStartLine = inputState->line;
 }

It tries to get "ptr" value, it's allocated, but memory location is
junk...

I would greatly appreciate any help/comments/suggestions.

Sincerely,

Denis A Ignatovich






More information about the antlr-interest mailing list