I am using a tree matcher to operate on specific subtrees.  However,
sometimes when I make changes to the tree-generation phase, I fail to
make the required matching changes in my tree matcher.  The result is
that the subtree doesn't match, which does not bother the tree matcher
in the least.  Instead, I'd like to flag this situation, so that I
realize I have a programming error.

In particular, my Trans.g looks like:

tree grammar Trans;

options {
        tokenVocab=SsipAST;
        output=AST;
        ASTLabelType=CTree;
        filter = true;
}

topdown: transition;

transition:    ^(TRANSITION s1=stateName s2=stateName arcBody[$s1.text]
               {  // Do some management here
               };

Every subtree that starts with TRANSITION should match this rule, but
in the development process, sometimes they don't.  Any suggestions how
to catch these situations?

I tried something like:

transition:    ^(TRANSITION ( s1=stateName s2=stateName
arcBody[$s1.text] { ... } | .* { FLAG_ERROR_HERE() } );

... but this of course leads to ambiguity warnings:

Decision can match input such as "PREDICATE DOWN Identifier DOWN..UP"
using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input

Ideas?

Thanks,
Tom Smith.

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