I'm replacing the AST type with MyAST (based on the treewalk example in
antlr2.7.6) in order to get line numbers. I've gotten everything to work,
but have run into a couple problems that I used to a casts to overcome.  I'm
wondering if there is a simpler answer.

In my application, the Parser produces an AST using  type MyAST.  This is
walked by a TreeParser (MyTreeParser)  that also produces an AST using type
MyAST.  Everything seems fine with the parser.

But in MyTreeParser is had to add:

public:
  virtual void program(ANTLR_USE_NAMESPACE(
antlr)RefAST _t)
  {
    program((RefMyAST)_t);
  }

Note the cast from RefAST to RefMyAST.  If I don't do this, I get a
compilation error.
        void antlr::TreeParser::program(antlr::RefAST)' : is abstract

Is what I did to get around this reasonable?  Or is there a better way.

After this, I also hit another problem requiring me to add the following to
MyAST.hpp:

   virtual void initialize( ANTLR_USE_NAMESPACE(antlr)RefAST ast )
   {
      initialize((RefMyAST) ast);
   }

Note the cast.  Anyone have similar problems?

Allan

--~--~---------~--~----~------------~-------~--~----~
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