Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Dynamic Languages Toolkit (DLTK) » Validating references to variables, etc...(How should I validate variable, type, and method references between modules?)
Validating references to variables, etc... [message #648053] Tue, 11 January 2011 01:36
Carl Knight is currently offline Carl KnightFriend
Messages: 13
Registered: December 2010
Junior Member
Having had no replies to my previous post http:// rt=0&S=5e41a4fe0e65ee76174aba7acb2f0c8f I've soldiered on.

Given the outline of what I have done (below), my questions are these:

Given the DLTK, is this what I should have done?
Does the DLTK provide something well hidden to do it better? I can't find anything in the examples.

I've created a class called UIncludeStatement. It is created when the ANTLR generated parser finds an include/include_once statement. UIncludeStatement works in conjunction with a MRU cache called UModuleCache. When modules are parsed, the parser passes the result to UModuleCache. Additionally, if the cache is asked for a module and does not have it, it kicks off a parse of the requested module. By extension, when UIncludeStatement is asked for it's associated module, it asks the cache for it. Worst case, this kicks off a JIT parse of the include file.

The vast majority of time, this is plenty quick enough.

In the absence of being able to figure out how any DLTK examples verify variable/method references, etc. between modules, I've done the following:

A class called USymbolSearcher is called when a reference to a variable, type or method is found. It searches the most local scope first, outward to the module, and finally performs a breadth first search of any include/include_once files (obtained from UIncludeStatement nodes in the AST) until the symbol is either found or all available scopes are exhausted. ModuleDeclaration methods to get fields, methods, etc. are used. As are appropriate methods on the MethodDeclaration and FieldDeclaration, etc.

This is all done in the ANTLR generated parser. Errors are reported by RecognitionException.


- Carl.

[Updated on: Tue, 11 January 2011 01:39]

Report message to a moderator

Previous Topic:DLTK Ruby versions; development news?
Next Topic:Ruby Dev: Two Ruby Perspectives?!!
Goto Forum:

Current Time: Thu Oct 22 19:01:23 GMT 2020

Powered by FUDForum. Page generated in 0.01735 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top