In my grammar i have an include rule as follow :
Script:
includes+=(Include)* assignments+=(Assignment)* clock=Clock? tests+=Test*
;
Include:
'INCLUDE' importURI=STRING
;
what I want to do is to include files same as the "main" file.
I'm working with an interpreter
that handels the .mydsl file.
/* Main exec methode */
def dispatch void exec(Script s) {
s.includes.forEach[ i | i.exec]
s.assignments.forEach[a | a.exec]
s.clock.exec
s.tests.forEach[t|t.exec]
}
/* include methode */
def dispatch void exec(Include i) {
System.out.println( i.importURI + " included")
}
Xtext imports are not includes. Xtext does not support includes at all. All that Xtext supports are Cross References. You can use namespace based or import uri based global scoping to determine how elements from other files can be found. assume you really want to follow the includes files in your interpreter
And Name Provider
then you can follow the reference in your interpreter