Frage

i am very lost with how importing global scope is working. I am writing a parser with xtext for a well structure language and I cannot depend on workspace or project concepts. In my language I have include statements which can have relative or absoloute paths of another file. I need to be able to reference objects defined in this other file. I tried using importURI but it doesn't work. All I tried was to add this rule:

Include:
    'INCLUDE' '='  importURI=STRING ';'
;

and changed the MWE2 file in these parts:

   // scoping and exporting API
                 fragment = scoping.ImportURIScopingFragment {}
                // fragment = exporting.SimpleNamesFragment {}

                // scoping and exporting API
                fragment = scoping.ImportNamespacesScopingFragment {}
                fragment = exporting.QualifiedNamesFragment {}

But this doesn't make any effect in my editor. I still can refer to objects defined in every file with the same extension without having the include statements, and I still cannot include files outside of the project.

War es hilfreich?

Lösung 2

the solution was to remove these two from workflow.

 // provides the necessary bindings for java types integration
 // fragment = types.TypesGeneratorFragment {}

 // generates the required bindings only if the grammar inherits from Xbase
 //fragment = xbase.XbaseGeneratorFragment {}

Andere Tipps

You have to remove the ImportNamespacesScopingFragment. It configures your language to use name based scopes rather than file-based.

You may also want to dig into the IContainer.Manager which is configured with an implementation based on the Eclipse workspace and project concept, by default.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top