Hello,

I'm using semantic predicates in tree grammar:

//deviceID is a rule
deviceFuncID
:     ^(NODE1 ^(NODE2 ^(NODE3 deviceID)))
        (
        {
                   //IsID function has signature:  bool IsID(string id)
                    IsID(
                   $deviceID.text,
                          )
                  }?
        -> oneTemplate(...)
                |-> otherTemplate(...)
         );

deviceID        :       'this'->{%{"this"}}

But when I try to compile generated C# code (antlr 3.1.1)I have many
errors like that:

---- The name 'deviceID25' does not exist in the current context

In antlr 3.0.1 such grammar produce compilable code.
If I rewrite that code as (remove brackets)

deviceFuncID
:     ^(CCALL ^(CSYNCCALL ^(OBJECTNAME deviceID)))

        {
                    IsID(
                   $deviceID.text,
                          )
                  }?
        -> oneTemplate(...)
               // |-> otherTemplate(...)

Then all right, but I want to have alternative clause for semantic predicate.
If I uncomment alternative clause, then I have:

---- error(201):  The following alternatives can never be matched: 2

What should I do ? What is the cause of such errors ?

Thank you

List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/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