Hi,

On Fri, May 20, 2011 at 10:55 AM, Bart Kiers <[email protected]> wrote:
> targetsExpr
>   :  category ('CAND' targetsExpr)* -> ^('CAND' category targetsExpr*)
>   ;
>
> is incorrect. You're always using `CAND` in your rewrite rule but that rule
> could just match `category` only.
> You'll probably want to do:
>
> targetsExpr
>   :  category ('CAND'^ targetsExpr)*
>   ;
>

Thank you for your answer! It works now! But I've another question now.
When I traverse the tree using this function (is there an example to
have a visitor
created by antlr?)

 public void visitTree(CommonTree t) throws Exception {
        if ( t != null ) {
            for ( int i = 0; i < t.getChildCount(); i++ ) {

                
//              System.out.println(t.getChild(i).toString() + " type " +
t.getType() + " child type " + t.getChild(i).getType());
                visitNode(t);

                visitTree((CommonTree)t.getChild(i));

            }
        }
    }

in the visitNode() I have the same token type as for the children. I
explain better:
If I have something like:

FAC->child(1),child(2), child(3)

the visitNode(t) is called 3 times with the same token type!

You can see the grammar here: http://www.mascanc.net/~max/xacml3.g

Thank you and best regards,

        Massimiliano
-- 
Massimiliano Masi

http://www.mascanc.net/~max

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

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

Reply via email to