[antlr-interest] accessing the current node

Greg Smolyn smolyn at cs.ubc.ca
Sat Feb 16 01:42:25 PST 2002


Hi,

I'm making a tree grammar right now, and I'm coming upon a simple
problem.

The names have been changed, but the problems are real. :)

What I'm trying to do is take a set of nodes in a tree  and (a) save a
reference to the node and (b) glean some info to put into that same
structure.

ie.

declaration
    { MyNode aNode = new MyNode(); }
    :
     #( DeclarationNode
            declaration[aNode]
            statementBlock
       )
    { aNode.addASTNode(***this_node***);
      someDataStructure.add(aNode);
    }

basically I'm just converting this node into some other node type (with a
slightly easier to understand data structure).  How can I add the node at
the current rule?  buildAST=false, so ## isn't really an option.

Any suggestions?
Thanks!

---
Greg Smolyn (smolyn at cs.ubc.ca)
Staff Researcher
Software Practices Lab, UBC







 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list