Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Registering references to elements in a generated file(The code written in my DSL can't utilize references to generated code)
Registering references to elements in a generated file [message #1765944] Wed, 14 June 2017 14:29 Go to next message
Dustin Altermann is currently offline Dustin AltermannFriend
Messages: 1
Registered: June 2017
Junior Member
Hi,

I got a bit of an awkward problem with references to a generated file A.

Grammar:
SpecMap: 
	'specmap' name = QualifiedName (mappings += Mapping)*
;

Mapping:
	name=ID '=' stuffAfterThatWhichDoesntMatterHere
;

The generated code A will obey to this grammer and therefore be "written" in the same DSL as the code B it's being generated from.

Now i have other code C (same DSL tho) that is supposed to reference this above generated file A and its elements ("mappings") using:
Import:
    'import' importedNamespace = ID ('/'ID)* ('.' ID)* '.*'?
;

import SpecMap.*

However after generation none of those references get resolved and i need to manually go into this file A and (re-)save it, so that all the names get registered.

Question: How do i trigger this registration process manually in this scenario, so that Eclipse can resolve all the references right away?

I tried many things already like e.g. parsing the entire generated file A as suggested in https://www.eclipse.org/forums/index.php/t/1086824/ but i only get this crazy error: https://www.eclipse.org/forums/index.php/t/545784/ so now i'm kind of clueless.

Thank you
Re: Registering references to elements in a generated file [message #1766167 is a reply to message #1765944] Fri, 16 June 2017 18:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
This is not possible. An eclipse builder does not get notified by changes it does itself

Thus you would need a custom eclipse builder that runs after the xtext builder and touches the files the xtext builder created soo that eclipse will call the xtext builder for these files again


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Registering references to elements in a generated file [message #1766168 is a reply to message #1766167] Fri, 16 June 2017 18:04 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
See https://www.eclipse.org/forums/index.php/m/1753519/?srch=incrementalprojectbuilder+touch#msg_1753519

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext DSL templates
Next Topic:Bundle can not be resolved
Goto Forum:
  


Current Time: Wed Apr 24 22:04:24 GMT 2024

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

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

Back to the top