William B. Clodius wrote:
> First, what kind of parameters are expected for a rule in ANTLR and  
> how do I define them?
This may or may not answer your question, but the following example 
should give a similar error.
________________________________________
parser grammar temp;
tokens{
   MYTOK;
}

foo [Tshirt x]
   :    msg=bar[x]
   {
       System.out.println(msg);
   }
   ;

bar returns [String message]
   :    MYTOK      {
       message = "I went and parsed stuff and all I got was this lousy 
T-shirt that says "+x.getFrontText();
   }
   ;
________________________________________


What this flawed grammar is intended to do is pass an object of type 
Thingy in when executing the rule "foo". And then every time the rule 
"foo" goes and calls rule "bar", "bar" will also have access to that 
object. To fix it, I need to add an input parameter (really, a 
positional function argument) to the final rule:
________________________________________
bar [Tshirt x] returns [String message]
________________________________________

At least for me, the error message numbers mean the line/column where I 
tried to put bar[x] while bar was unable to accept any arguments.

--Darien

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