Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with imports inside textmodels
Problems with imports inside textmodels [message #50800] Fri, 12 June 2009 18:00 Go to next message
Steffen A. Mork is currently offline Steffen A. MorkFriend
Messages: 1
Registered: July 2009
Junior Member
Hi there,

we want to use simple text imports inside text models. Our xtext
definition for that is:

Import : 'import' importedURI=STRING ';';

Umfortunately this doesn't work. If we copy the elements from the imported
file into the base file it works. Here an example:

The grammar:
grammar org.xtext.example.ProblemDSL with
org.eclipse.xtext.common.Terminals

generate problemDSL "http://www.xtext.org/example/ProblemDSL"


Model :
(imports+=Import)*
(exdeus+=Exdeus)*
(refs+=Reference)*;

Import :
'import' importedURI=STRING ';';

Exdeus :
'exdeus' name=ID ';';

Reference :
'ref' name=[Exdeus] ';';


The base model file:
import "MyModel2.psdl";

ref foo;

The imported model file "MyModel2.psdl":
exdeus foo;

The template file is as follows:
«IMPORT problemDSL»;

«DEFINE main FOR Model-»
«FILE "output.txt"»
«EXPAND exdeus FOREACH exdeus»
«EXPAND reference FOREACH refs»
«ENDFILE»
«ENDDEFINE»

«DEFINE exdeus FOR Exdeus»
Exdeus «name»
«ENDDEFINE»

«DEFINE reference FOR Reference»
Reference «name»
«ENDDEFINE»

This in combination throws the following error message:
2101 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
classpath:/model/MyModel.pdsl(3): Couldn't resolve reference to Exdeus
foo(Element: -UNKNOWN-; Reported by: MweReader: loading file from
classpath:/model/MyModel.pdsl)
Re: Problems with imports inside textmodels [message #50860 is a reply to message #50800] Fri, 12 June 2009 18:29 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Steffen,

please try something like

Import :
'import' importURI=STRING;

Regards,
Sebastian

Am 12.06.2009 20:00 Uhr, schrieb Steffen A. Mork:
> Hi there,
>
> we want to use simple text imports inside text models. Our xtext
> definition for that is:
>
> Import : 'import' importedURI=STRING ';';
>
> Umfortunately this doesn't work. If we copy the elements from the
> imported file into the base file it works. Here an example:
>
> The grammar:
> grammar org.xtext.example.ProblemDSL with
> org.eclipse.xtext.common.Terminals
>
> generate problemDSL "http://www.xtext.org/example/ProblemDSL"
>
>
> Model :
> (imports+=Import)*
> (exdeus+=Exdeus)*
> (refs+=Reference)*;
>
> Import :
> 'import' importedURI=STRING ';';
>
> Exdeus :
> 'exdeus' name=ID ';';
>
> Reference :
> 'ref' name=[Exdeus] ';';
>
>
> The base model file:
> import "MyModel2.psdl";
>
> ref foo;
>
> The imported model file "MyModel2.psdl":
> exdeus foo;
>
> The template file is as follows:
> «IMPORT problemDSL»;
>
> «DEFINE main FOR Model-»
> «FILE "output.txt"»
> «EXPAND exdeus FOREACH exdeus»
> «EXPAND reference FOREACH refs»
> «ENDFILE»
> «ENDDEFINE»
>
> «DEFINE exdeus FOR Exdeus»
> Exdeus «name»
> «ENDDEFINE»
>
> «DEFINE reference FOR Reference»
> Reference «name»
> «ENDDEFINE»
>
> This in combination throws the following error message:
> 2101 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> classpath:/model/MyModel.pdsl(3): Couldn't resolve reference to Exdeus
> foo(Element: -UNKNOWN-; Reported by: MweReader: loading file from
> classpath:/model/MyModel.pdsl)
>
>
Re: Problems with imports inside textmodels [message #50916 is a reply to message #50800] Sat, 13 June 2009 15:08 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Steffen,

as Sebastian said it's importURI not importedURI.
I've found the missleading occurence in the documentation and have fixed
it. Thanks for the feedback.

Sven

Steffen A. Mork schrieb:
> Hi there,
>
> we want to use simple text imports inside text models. Our xtext
> definition for that is:
>
> Import : 'import' importedURI=STRING ';';
>
> Umfortunately this doesn't work. If we copy the elements from the
> imported file into the base file it works. Here an example:
>
> The grammar:
> grammar org.xtext.example.ProblemDSL with
> org.eclipse.xtext.common.Terminals
>
> generate problemDSL "http://www.xtext.org/example/ProblemDSL"
>
>
> Model :
> (imports+=Import)*
> (exdeus+=Exdeus)*
> (refs+=Reference)*;
>
> Import :
> 'import' importedURI=STRING ';';
>
> Exdeus :
> 'exdeus' name=ID ';';
>
> Reference :
> 'ref' name=[Exdeus] ';';
>
>
> The base model file:
> import "MyModel2.psdl";
>
> ref foo;
>
> The imported model file "MyModel2.psdl":
> exdeus foo;
>
> The template file is as follows:
> «IMPORT problemDSL»;
>
> «DEFINE main FOR Model-»
> «FILE "output.txt"»
> «EXPAND exdeus FOREACH exdeus»
> «EXPAND reference FOREACH refs»
> «ENDFILE»
> «ENDDEFINE»
>
> «DEFINE exdeus FOR Exdeus»
> Exdeus «name»
> «ENDDEFINE»
>
> «DEFINE reference FOR Reference»
> Reference «name»
> «ENDDEFINE»
>
> This in combination throws the following error message:
> 2101 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - [ERROR]:
> classpath:/model/MyModel.pdsl(3): Couldn't resolve reference to Exdeus
> foo(Element: -UNKNOWN-; Reported by: MweReader: loading file from
> classpath:/model/MyModel.pdsl)
>
>
Previous Topic:[XText] An internal error occurred during: "XtextReconcilerJob".
Next Topic:TMF Xtext Getting Started Example
Goto Forum:
  


Current Time: Sat Aug 10 08:01:45 GMT 2024

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

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

Back to the top