Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Reference Ecore model in Xtext grammar
Reference Ecore model in Xtext grammar [message #1848017] Wed, 17 November 2021 13:18 Go to next message
Jan Crkvic is currently offline Jan CrkvicFriend
Messages: 18
Registered: November 2021
Junior Member
Hello, I am trying to import the Ecore meta model in the xtext grammar so that I can use EPackage.

This is a simple grammar:

grammar org.xtext.Mapping with org.eclipse.xtext.common.Terminals
import "h.ttp://www.eclipse.org/emf/2002/Ecore" as ecore
generate mapping "h.ttp://www.xtext.org/Mapping"

Model:
	greetings+=Greeting*;
	
Greeting:
	type = EPackage
;



However on the second line I get this warning:

Quote:

The imported package is not on the classpath of this project
which may lead to follow-up errors.


And on the second to last line I get this error:

Quote:

EPackage cannot be resolved to a rule.


Help on being able to reference an EPackage, would be appreciated.
Thank you.
Re: Reference Ecore model in Xtext grammar [message #1848019 is a reply to message #1848017] Wed, 17 November 2021 13:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14720
Registered: July 2009
Senior Member
the grammar makes no sense

maybe

you intend

Greeting:
type = [EPackage|STRING]
;

which means reference epackage by string lexer rule



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Re: Reference Ecore model in Xtext grammar [message #1848020 is a reply to message #1848017] Wed, 17 November 2021 13:40 Go to previous messageGo to next message
Tamas Miklossy is currently offline Tamas MiklossyFriend
Messages: 162
Registered: February 2016
Senior Member
See also https://github.com/eclipse/xtext-eclipse/issues/830#issuecomment-765344671

[Updated on: Wed, 17 November 2021 13:41]

Report message to a moderator

Re: Reference Ecore model in Xtext grammar [message #1848022 is a reply to message #1848019] Wed, 17 November 2021 14:53 Go to previous messageGo to next message
Jan Crkvic is currently offline Jan CrkvicFriend
Messages: 18
Registered: November 2021
Junior Member
Hi,

Yes I am trying to reference it so that should be the correct way to write. Thank you! However, now I get "Cannot resolve type null".
Re: Reference Ecore model in Xtext grammar [message #1848029 is a reply to message #1848022] Wed, 17 November 2021 16:33 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14720
Registered: July 2009
Senior Member
can you please give more steps what exactly you are doing and what is not working

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
Previous Topic:Reference Ecore model in Xtext grammar
Next Topic:Extending Xtend type system with own kinds of type?
Goto Forum:
  


Current Time: Sat Oct 05 09:51:38 GMT 2024

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

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

Back to the top