[antlr-interest] Type cast exception in CSharp
Gilles BRUNET
gillesb68 at hotmail.com
Mon Jul 18 18:59:05 PDT 2005
I tried the sample "preserveWhiteSpace" and performed some modification and
missed to remove the following line:
lexer.setTokenObjectClass("antlr.CommonHiddenStreamToken");
Thanks a lot.
Gilles B.
>From: "Micheal J" <open.zone at virgin.net>
>To: <antlr-interest at antlr.org>
>Subject: RE: [antlr-interest] Type cast exception in CSharp
>Date: Mon, 18 Jul 2005 17:35:11 +0100
>
> > 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?
>
>CommonToken does implement IToken afaik. What version are you using?. It
>should be 2.7.5 and you should ensure that you've generated all the
>lexer/parser/treeparser code for your project using it *and* you are using
>it's own runtime files.
>
>Cheers,
>
>Micheal
>
_________________________________________________________________
Profitez des puissants filtres de courriels indésirables articulés sur la
technologie brevetée MicrosoftMD SmartScreen.
http://join.msn.com/?pgmarket=fr-ca&page=features/junkmail 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