[antlr-interest] Can a ANTLR 3 rule have both a rule and global scope?

Sam Harwell sharwell at pixelminegames.com
Mon Feb 28 16:31:10 PST 2011


A rule can have zero or one rule scopes, and zero or more global scopes.

You need to place the rule scope before any global scopes:

rule
scope { /*rule scope*/ }
scope GlobalScope1;
scope ClobalScope2;
	: ...
	;

Sam

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of The Researcher
Sent: Monday, February 28, 2011 6:16 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Can a ANTLR 3 rule have both a rule and global
scope?

When trying to use both a rule and global scope for a rule, ANTLR generated
errors. To get past the error all of the attributes were pused into the
global scope.

Just want to confirm that ANTLR 3 only allows a rule to have either a rule
or global scope but not both.



Thanks, Eric

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list