[antlr-interest] Access Violation in InitLiterals()
Kevin J. Cummings
cummings at kjchome.homeip.net
Sat Aug 4 19:29:30 PDT 2007
Hi Folks,
I writing my 3rd of 4 grammars using ANTLR 2.7.7. The first 2 are
done, and because they don't involve any IDENTs, all Keywords were
defined in the Lexer with TOKEN names. In my 3rd and 5th grammars, the
Keywords must co-exist with the IDENTs, so I'm using literals in my
grammar to avoid the non-determinism between my IDENTs and the keywords.
I tested this grammar on my Linux system without many actions in either
the Parser or the TreeWalker. Runs just fine.
BUT, I am developing this in VC++ on a Windows XP system. When I
attempted to run it for the first time, it dies, in InitLiterals() on
the following statement (the first assignment in this routine):
> literals["ends_with"] = 61;
By following the backtrace, I find myself in the following code in
CharScanner.h:
> inline bool CharScannerLiteralsLess::operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const
> {
> if (scanner->getCaseSensitiveLiterals())
> return ANTLR_USE_NAMESPACE(std)less<ANTLR_USE_NAMESPACE(std)string>()(x,y);
> else
> {
> #ifdef NO_STRCASECMP
> return (stricmp(x.c_str(),y.c_str())<0);
> #else
> return (strcasecmp(x.c_str(),y.c_str())<0);
> #endif
> }
> }
On the call to stricmp(), the y.c_str() argument appears to be
un-initialized (the value of the pointer is 0xcdcdcdcd).
What really bugs me is why does this work on Linux and not on windows.
My first 2 grammars don't use literals, so this routine is empty in those.
Does anyone have any advice on what I can do to make this work?
Thanks!
--
Kevin J. Cummings
kjchome at rcn.com
cummings at kjchome.homeip.net
cummings at kjc386.framingham.ma.us
Registered Linux User #1232 (http://counter.li.org)
More information about the antlr-interest
mailing list