[antlr-interest] Type cast exception in CSharp

Gilles BRUNET gillesb68 at hotmail.com
Sun Jul 17 20:34:43 PDT 2005


Hi,

The CSharp generator produces the following lines of code:

...
AST tmp1_AST = null;
tmp1_AST = astFactory.create(LT(1));
astFactory.makeASTRoot(currentAST, tmp1_AST);
...

My parser declaration have the following form:

...
class CommonParser extends Parser;
options {
	k = 2;
	importVocab = CommonAgilePLC;
	classHeaderPrefix = "internal";
	buildAST = true;
}
...

The AST factory creator throws the exception "System.InvalidCastException". 
Its factory operation seems to expect a parameter of type IToken while the 
CommonToken object returned by LT(1) does not implement this interface.

Is here any Token subclass that implement IToken available in the ANTLR's 
API or do I miss some option in the parser declaration?

Best regards,

Gilles B.

_________________________________________________________________
Partagez une seule photo ou un diaporama complet dans MSN Messenger. 
http://join.msn.com/?pgmarket=fr-ca&page=features/messenger Commencez dès 
maintenant à profiter de tous les avantages de MSN Premium et obtenez les 
deux premiers mois GRATUITS*.



More information about the antlr-interest mailing list