[antlr-interest] Fail to pass test in C++ Grammar

=?gb2312?B?xe20+tLj?= vinvinsent at 263.net
Mon Jan 10 08:27:41 PST 2005


Hi, everyone:
	I'm new to ANTLR, and I desired to do something about analyzing data flow in C++. 
	I downloaded the C++ project led by David from www.antlr.org's grammar section. and compiled in MSVC 7.1, it compiles well. However, I can't even pass the simplest test with below contents:

	#include <stdio.h>
	int main()
	{
 		return 0;
	}
	
	I captured the exception and found from where the exception was thrown:
	//	...
	else if ((LA(1) == 0x23 /* '#' */ ) 
					&& (_tokenSet_0.member(LA(2)))) {
					mPREPROC_DIRECTIVE(true);
					theRetToken=_returnToken;
				}
	// ...
	
	I found _tokenSet_0.member(LA(2))) return false, while LA(2) is 'i', so the switch statement eventually went into the "default" block, and threw an exception.
    I want to ask, is there something wrong with the grammar file? or I made any mistake, any
help would be appriciable :)

Cheers!

Vinsent
vinvinsent at 263.net
2005-01-11
-------------- next part --------------
A non-text attachment was scrubbed...
Name: =?gb2312?B?xe20+tLjLnZjZg==?=
Type: text/x-vcard
Size: 514 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20050111/3fd0981d/gb2312Bxe20tLjLnZjZg-0001.vcf


More information about the antlr-interest mailing list