[antlr-interest] Extending TreeRuleReturnScope

Kay Roepke kroepke at classdump.org
Wed Aug 8 22:19:02 PDT 2007


On Aug 9, 2007, at 7:00 AM, Kay Roepke wrote:

>
> On Aug 9, 2007, at 12:42 AM, Diehl, Matthew J wrote:
>
>> Nevermind, I decided to just make a perl script to add it, lol.
>
> Normally, you'd have to implement your own Tree class and  
> TreeAdaptor to
> go along with it. That's the supported way.

Doh!

That, of course, was complete and utter bull. Sorry for that.
I didn't realize that you wanted to add to return scopes, not trees.

The normal way for that should be something like (similar to how  
adding members
to recognizers work):

grammar RuleReturnMembers;

options {
	output=AST;
}

@parser::ruleReturnMembers {
	public String getName() {
		return name;
	}
}

rule returns [String name]
	:	'A'
	;


but it turns out that it isn't implemented. Shouldn't be hard to do,  
but isn't there yet.
Seems like your Perl solution is the only that works right now.

I'll add a bug for this.

Thanks for reporting,
-k
-- 
Kay Röpke
http://classdump.org/






More information about the antlr-interest mailing list