[antlr-interest] Antlr v3.0ea8 : Rule return types?

PATERSON, Robert r.paterson at ioof.com.au
Wed May 3 15:33:30 PDT 2006


I've been playing with Antlr/Antlrworks 3.0ea8 - a fantastic
combination, but....

I'm having trouble getting my rules to return values. Have they been
replaced with some feature of the @scope mechanism?

If I try something like:

aRule returns [MyClass anInstance] : SOME TOKEN STUFF ;

I get code that looks like:

public MyClass aRule {
 
  MyClass anInstance;
.
.
.

  return anInstance;

}

Which refuses to compile with a 'anInstance may not have been
initialised' error.


If I try:

aRule returns [MyClass anInstance = null] : SOME TOKEN STUFF ;


I get something like:

public void MyClass = aRule() {
.
.
.
}


(Something like that, I don't have the code here at work).


I'm sure it's something I'm doing wrong, any ideas what it might be?


****************************************************************************
IMPORTANT - PLEASE READ
This communication is intended only for the use of the addressee and 
may contain personal information, confidential information or legally 
privileged information. If personal information is contained in this e-mail, 
then it is governed by the Privacy Act 1988 and must be treated in 
accordance with the Privacy Act 1988 by the recipient. The legal 
privilege and confidentiality attached to this e-mail is not waivered, 
lost or destroyed by reason of mistaken delivery to you. If you are not 
the intended recipient, we would appreciate immediate notification by 
return e-mail or telephoning +61-3-8614-4444 and ask that the message 
be permanently deleted from your system. If you are the intended 
recipient of this communication you should not copy, disclose or distribute this communication without the authority of IOOF or its related entities (the IOOF Group).
Any views expressed in this message are those of the individual sender, 
except where they are specifically stated to be the views of the IOOF 
Group.
This e-mail and any attachments have been scanned for computer viruses 
using anti-viral software, but you should also perform your own scan. We 
do not accept liability for any loss or damage, whether caused by our own negligence or not, that results from a computer virus or a defect in the transmission of the e-mail or any attached file.
****************************************************************************



More information about the antlr-interest mailing list