hi. Gerald (and I) liked the inContext method in treeparser:

tokenAlias
        :       {inContext("TOKENS")}? ^(ASSIGN TOKEN_REF STRING_LITERAL)
                {BasicSemanticChecks.checkTokenAlias($TOKEN_REF.token);}
        ;

I got rid of it awhile back since it wasn't quite powerful enough so I thought 
I'd start again later. now is later and I need it.  ANybody have a wish list or 
thoughts on it?

the javadoc:

    /** Check if current node in input has a context.  Context means sequence
     *  of nodes towards root of tree.  For example, you might say context
     *  is "MULT" which means my parent must be MULT.  "CLASS VARDEF" says
     *  current node must be child of a VARDEF and whose parent is a CLASS node.
     *  You can use "..." to mean zero-or-more nodes.  "METHOD ... VARDEF"
     *  means my parent is VARDEF and somewhere above that is a METHOD node.
     *  The first node in the context is not necessarily the root.  The context
     *  matcher stops matching and returns true when it runs out of context.
     *  There is no way to force the first node to be the root.
     */

ter
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to