Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cannot find meta model when reusing parts of XBase
Cannot find meta model when reusing parts of XBase [message #694441] Fri, 08 July 2011 15:43 Go to next message
Jeppe Cramon is currently offline Jeppe CramonFriend
Messages: 37
Registered: July 2009
Member
Hi

Disclaimer: Total newbie with XText Smile

Since my DSL needs to support assignments, block expressions, etc. I've chosen to reuse parts of XBase...
But even with the tiniest of reuse (copy from XBase grammar) in a freshly create XText project (XText 2 enabled), it states that it can't find the Type And Meta model for ValidId.

Any pointers to what I'm doing wrong? Smile

grammar dk.example.Dsl with org.eclipse.xtext.common.Terminals

import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.ecore"
import "platform:/resource/org.eclipse.xtext.xbase/model/Xtype.ecore"

generate Dsl "http://www.example.dk/Dsl"

XExpression returns XExpression:
	XAssignment;

XAssignment returns XExpression:
	{XAssignment} feature=[ValidID]
	OpSingleAssign value=XAssignment;

OpSingleAssign:
	'=';

QualifiedName:
  ValidID ('.' ValidID)*;

ValidID:
	ID;


Thanks in advance Smile

/Jeppe
Re: Cannot find meta model when reusing parts of XBase [message #694455 is a reply to message #694441] Fri, 08 July 2011 15:55 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Have you set a plug-in dependency to org.eclipse.xbase in the
MANIFEST.MF of your language project?

Am 08.07.11 17:43, schrieb Jeppe Cramon:
> Hi
>
> Disclaimer: Total newbie with XText :)
>
> Since my DSL needs to support assignments, block expressions, etc. I've
> chosen to reuse parts of XBase... But even with the tiniest of reuse
> (copy from XBase grammar) in a freshly create XText project (XText 2
> enabled), it states that it can't find the Type And Meta model for ValidId.
>
> Any pointers to what I'm doing wrong? :)
>
>
> grammar dk.example.Dsl with org.eclipse.xtext.common.Terminals
>
> import "http://www.eclipse.org/emf/2002/Ecore" as ecore
> import "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.ecore"
> import "platform:/resource/org.eclipse.xtext.xbase/model/Xtype.ecore"
>
> generate Dsl "http://www.example.dk/Dsl"
>
> XExpression returns XExpression:
> XAssignment;
>
> XAssignment returns XExpression:
> {XAssignment} feature=[ValidID]
> OpSingleAssign value=XAssignment;
>
> OpSingleAssign:
> '=';
>
> QualifiedName:
> ValidID ('.' ValidID)*;
>
> ValidID:
> ID;
>
>
> Thanks in advance :)
>
> /Jeppe


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: Cannot find meta model when reusing parts of XBase [message #694582 is a reply to message #694455] Fri, 08 July 2011 22:14 Go to previous messageGo to next message
Jeppe Cramon is currently offline Jeppe CramonFriend
Messages: 37
Registered: July 2009
Member
Hi Jan

Thanks for the quick reply. I hadn't set the dependency on xbase, but unfortunately it still complains that it can't find the Meta model or type for ValidId, eventhough ValidId is defined within the same grammar.

/Jeppe

Re: Cannot find meta model when reusing parts of XBase [message #694665 is a reply to message #694582] Sat, 09 July 2011 06:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13612
Registered: July 2009
Senior Member
Hi,

ValidId is a Datatype Rule and not a Parser Rule => There will be not EClass ValidId => You cannot have a crossref to a ValidId.

since you have

import "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.ecore"
import "platform:/resource/org.eclipse.xtext.xbase/model/Xtype.ecore"


the xbase project has to be within your workspace.

http://www.eclipse.org/Xtext/documentation/2_0_0/199-xtext-and-java.php
may give you an idea what to do

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sat, 09 July 2011 06:23]

Report message to a moderator

Re: Cannot find meta model when reusing parts of XBase [message #694721 is a reply to message #694665] Sat, 09 July 2011 13:06 Go to previous messageGo to next message
Jeppe Cramon is currently offline Jeppe CramonFriend
Messages: 37
Registered: July 2009
Member
Hi

I added the suggested plugins (though I couldn't find org.eclipse.xtext.common.types but only org.eclipse.xtext.common.types.shared), but that didn't help.

You mentioned that I was cross referencing ValidId, which shouldn't be possible since it's a DataType Rule, which makes sense. How ever I'm unsure how else to do it?

Short explanation for my simple grammar: I've reproduced a simplification (without references to any java types, as I don't need that, and with some things like the XOrExpression removed just to make the example extra simple) of XBase's XAssignment rule (reproduced below), just to get started:

XAssignment returns XExpression :
{XAssignment} feature=[types::JvmIdentifiableElement|ValidID] OpSingleAssign value=XAssignment |
XOrExpression (
=>({XBinaryOperation.leftOperand=current} feature=[types::JvmIdentifiableElement|OpMultiAssign]) rightOperand=XAssignment
)?;


/Jeppe
Re: Cannot find meta model when reusing parts of XBase [message #694728 is a reply to message #694721] Sat, 09 July 2011 13:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13612
Registered: July 2009
Senior Member
Hi,

still don't get it what you want to do. if you want to use xbase you actually have to use xbase Wink
(as described in the docs by inheritance)

so what you actually want to do is maybe "reuse" xbase in sense of "do something similar"
but then you don't need this stuff at all. so in your case if you do not want to reference
nothing from an (X)Assignment then you do not need to do a reference but rather an simple EAttribute
feature=ValidId

but this only works if you don't use the xbase metamodel (your XAssignment may not be the one from xbase)

without knowing what you actually want to do its hard to give further advice

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cannot find meta model when reusing parts of XBase [message #694741 is a reply to message #694728] Sat, 09 July 2011 14:15 Go to previous messageGo to next message
Jeppe Cramon is currently offline Jeppe CramonFriend
Messages: 37
Registered: July 2009
Member
Hi Christian

I want to reuse XBase due to many of its features, but I don't want the ability to reference Java and there are some language elements that I don't want supported.
So to get started fast I chose to reference the existing meta models (the ecore parts) and then copy, the parts of the the XBase grammar that I needed, directly to my own grammar (I plan on copying the ecore models as well so they're trimmed down, but I'm trying to take one step at a time, so I can keep up with it, not doing a good job at it so far Wink ). The copying of the Xbase grammar seemed to work really well, except that XText complains that it can't find the meta model (and type) for ValidId, OpAdd, OpAnd, OpCompare, etc.

After this failed attempt, I tried to cut down the grammar even more to make the simplest example possible (based on XBase) and it still kept complaining about ValidId... It might be due to how I've shaved the XBase grammer (like removing all references to Java types) so it's no longer valid?

Did this explain my endeavor better? Smile

Also if there's a better way of obtaining this I'm all ears Smile


/Jeppe

[Updated on: Sat, 09 July 2011 14:17]

Report message to a moderator

Re: Cannot find meta model when reusing parts of XBase [message #694746 is a reply to message #694741] Sat, 09 July 2011 14:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13612
Registered: July 2009
Senior Member
Hi,

Right but i doubt this one step after another will work the way you try it.
Once more: the ValidId Problem is that the xbase ecore says that there is a reference to a types::JvmIdentifiableElement.
and that in the model file therefore a validid will be parsed. so you can't easly change that there is a Reference to a Type ValidId
that is nowhere defined nor parsed somewhere in your grammar/metamodels.

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Cannot find meta model when reusing parts of XBase [message #694771 is a reply to message #694746] Sat, 09 July 2011 16:40 Go to previous message
Jeppe Cramon is currently offline Jeppe CramonFriend
Messages: 37
Registered: July 2009
Member
Hi

Ah okay, I interpreted it as either a JVM type or a valid...
Think I will roll my own instead. Thanks for your help Smile

/Jeppe
Previous Topic:error detector
Next Topic:Auto edit for multi line comments
Goto Forum:
  


Current Time: Sat Sep 26 23:03:21 GMT 2020

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

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

Back to the top