Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Import File
Import File [message #1747010] Tue, 08 November 2016 14:56 Go to next message
Pascal Lacabanne is currently offline Pascal LacabanneFriend
Messages: 17
Registered: November 2016
Junior Member
Hello,

I have an issue with the import file.
I create this grammar :

Domainmodel:
	(elements+=Type)*
;

Type:
	Env_Type | Fa_Type
;

Env_Type:
	'Env_Type' name=ID '{'
	('description:' desc=STRING';')
;

Fa_Type:
	'Fa_Type' name=ID '{'
	('environment:' env=[Env_Type])
	'}'
;


Next I create two files : one for Env_Type and an other for Fa_Type.
In the file containing the Fa_Type, I want to import the Env_Type file in order to retrieve the elements.
I tried this (Xtext tutorial) but it did not work:

Domainmodel:
7.    (elements+=AbstractElement)*;
8. 
9.PackageDeclaration:
10.    'package' name=QualifiedName '{'
11.        (elements+=AbstractElement)*
12.    '}';
13. 
14.AbstractElement:
15.    PackageDeclaration | Type | Import;
16. 
17.QualifiedName:
18.    ID ('.' ID)*;
19. 
20.Import:
21.    'import' importedNamespace=QualifiedNameWithWildcard;
22.  
23.QualifiedNameWithWildcard:
24.    QualifiedName '.*'?;
25.  
26.Type:
27.    Env_Type | Fa_Type;



I do not know how do that ? Can you explain me please ?

Regards,

Pascal

Sorry for my english

Re: Import File [message #1747044 is a reply to message #1747010] Tue, 08 November 2016 19:50 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 11203
Registered: July 2009
Senior Member
you dont need imports.
xtext imports are (by default) not file imports.
they are namespace imports.
and since you have no namespaces, it will work out of the box with your original grammar.

so make sure

- the project you use has xtext nature
- xtext builder is enabled
- autobuild is enabled
- if the project is a java project the model files reside in a source folder


Need professional support for Xtext, Xpand, EMF?
Go to: http://xtext.itemis.com
Twitter : @chrdietrich
Blog : christiandietrich.wordpress.com
Re: Import File [message #1747090 is a reply to message #1747044] Wed, 09 November 2016 10:25 Go to previous message
Pascal Lacabanne is currently offline Pascal LacabanneFriend
Messages: 17
Registered: November 2016
Junior Member
Thanks.
In fact, my project is not a Xtext project. It works.
Previous Topic:problem string concat operation OclUndefined ?
Next Topic:Hide technical UID in XText editor
Goto Forum:
  


Current Time: Thu Sep 21 01:44:45 GMT 2017

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

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