Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to build a symbol table to be used within ScopeProvider and Validator?
How to build a symbol table to be used within ScopeProvider and Validator? [message #1021490] Wed, 20 March 2013 08:03 Go to next message
Shavarsh Odajavan is currently offline Shavarsh OdajavanFriend
Messages: 7
Registered: March 2013
Junior Member
Hi, i would like to build a symbol table (in the parsing phase i suppose) which contains names and types of every VarDeclaration (a non terminal rule in my grammar) parsed. Is there a simple way to do it? My final goal is to use these informations within ScopeProvider while resolving cross references and to make things easier in the Validator (type checking in expressions, for example).
Thanks in advance,

Shavarsh
Re: How to build a symbol table to be used within ScopeProvider and Validator? [message #1021502 is a reply to message #1021490] Wed, 20 March 2013 08:34 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

I guess what you call symbol table is Xtext's index. It stores information about all model elements exported by a resource (ynd you can influence the creation of the index.

Have a look at the documentation, http://blogs.itemis.de/stundzig/archives/809 may provide a first impression (somewhat outdated, as influencing the index creation has been simplified).

Alex



Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: How to build a symbol table to be used within ScopeProvider and Validator? [message #1021584 is a reply to message #1021490] Wed, 20 March 2013 10:53 Go to previous message
Shavarsh Odajavan is currently offline Shavarsh OdajavanFriend
Messages: 7
Registered: March 2013
Junior Member
Thanks for the answer Alexander.
I read the documentation but i would like to ask if you can make some examples, for better understanding. Maybe i wasn't much clear, but what i would like to build is a table with varName, type and some additional infos. The problem is i can't build it up while getting the scope because the ScopeProvider is called only when a reference is encountered. I would like to build it in the parse phase because it has to be done once and it will be available to use in ScopeProvider and Validator.
Previous Topic:Parameterised Terminals?
Next Topic:Xtext 2.4.0M6
Goto Forum:
  


Current Time: Fri Apr 19 15:45:47 GMT 2024

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

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

Back to the top