I would like to add some stuff to the CommonTree node and hook it up using an 
adaptor,

I am not a java programmer and actually i am pretty new to ANTLR and C# as well 
...

It just amounts to translating the following java snippet (thanks Terrence) 
into C#

 

java:

// An adaptor that tells ANTLR to build custom AST node (myAST)

public static TreeAdaptor anAdaptor = new CommonTreeAdaptor() {

    public Object create(Token token) {

        return new myAST(token);

    }

    public Object dupNode(Object obj) {

        if ( obj == null ) return null;

        return create(((myAST)obj).token);

    }

    public Object errorNode(TokenStream input,Token start,Token 
stop,RecognitionException ex) {

    return new myErrorNode(input,start,stop,ex);

    }

};

 

c#:

?

i am sure i will get this eventually but this must be a pretty common thing to 
do...

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to