[antlr-interest] Test dynamic scope presence

Joël Marty joelmarty2 at gmail.com
Sat Aug 13 12:47:27 PDT 2011


Basically the intent of my project is to modelise Java code in a RDF 
graph so I need much more than spying method calls.
I defined class members that registers declared types, methods or 
fields and my main problem is to keep track of the context in which an 
element has been declared.
Basically I pass a 'container' information along my rules: a type 
container is its declaring file, a method's container is its declaring 
type, a method call container is the method from which it is called etc 
etc.
My question was relative to the way dynamic scopes are implemented and 
how I can test for the existence of the parent container information 
but I have my answer now. The fact that they are implemented using 
inner static classes helps me in that way.

I can't really modify the generated class at that point, I'm still 
developing the grammar and when I regenerate my modifications are 
erased.

Le sam. 13 août 2011 21:29:26 CEST, The Researcher a écrit :
> Hi Joel,
> 
> If I understand your basic problem you are just trying to spy on the method
> calls.
> 
> While it is probably possible to use dynamic scopes have you considered a
> global scope.
> 
> Personally, when I debug a few rules for a special case, I just modify the
> source code directly after ANTLR generates it. I also stick the spying
> support methods in a separate package and make calls to it.
> 
> Hope that helps,
> 
> 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