Search code examples
javaeclipseparsingxtextscoping

xtext importURI external file


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.


Solution

  • 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 {}