|Correct usage of 'import'/'include' of files [message #1761051]
||Fri, 05 May 2017 17:13
| Serge Lamikhov
Registered: May 2016
I am trying to implement a grammar used for some configuration files in generic Eclipse projects. It means that the search mechanisms like classpath and/or package dependency are not relevant. It is desirable to avoid using of Xtext project nature as well.
The configuration files may use other files located inside the same generic project or be provided as a "library" which is supplied together with Xtext support plugin. Files that exist, but, are not mentioned in the main script, should not be considered.
The following grammar implements 'use' keyword. (I intentionally trying to avoid 'import' or 'include' words for the purpose of explaining its desired behavior later).
(greetings+=Greeting | users+=User | uses+=Use)*;
'Hello' name=[User] '!';
'user' name=ID ('age' '=' age=INT)?;
When the 'use' keyword is used, the corresponding file name (ID) is supposed to be decorated with appropriate file extension and looked in: 1. The same project location where the main script is located; 2. Library location within Xtext plugin resource.
I have two questions:
- As 'importUri' is discouraged or even deprecated, is it possible to implement the desired behavior by using 'importedNamespace'? If so, is there an example around?
- Should I use double parsing of the main script? the first pass will figure out the used 'use' keywords, add corresponding files to the global index and will build the correct EMF model at the second parse
Powered by FUDForum
. Page generated in 0.02146 seconds