Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Howto integrate OCL in a grammar?
Howto integrate OCL in a grammar? [message #557576] Wed, 08 September 2010 07:19 Go to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi,

I want to "integrate" OCL expressions in my grammar. Thus it should be possible to write a valid OCL statement in my language. First of all I'm not sure which ecore model I should import. For instance I've choosen the following

import "http://www.eclipse.org/ocl/3.0.0/CompleteOCLCST" as OCL


I've searched for the package and it seems to point to a Xtext grammar which sounds promising. I've added a entry to my canHandle() function in my <Lang>ResourceProvider class. I've also added a extension point to my plugin.xml and set two dependencies (org.eclipse.ocl.examples.xtext.completeocl and
org.eclipse.ocl.examples.xtext.completeocl.source). If I try to generate Xtext artifacts I get the following error:

0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri '/home/michael/Desktop/Projekte'
2678 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems instantiating module de.hs_rm.cs.vs.dsm.Flow: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: Problems instantiating module de.hs_rm.cs.vs.dsm.Flow: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.common.util.WrappedException: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:127)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:126)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:126)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:71)
	... 3 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:54)
	... 36 more
Caused by: java.lang.IllegalStateException: Problem parsing 'classpath:/de/hs_rm/cs/vs/dsm/Flow.xtext':[XtextLinkingDiagnostic: null:6 Couldn't resolve reference to EPackage 'http://www.eclipse.org/ocl/3.0.0/CompleteOCLCST'.]
	at org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageConfig.java:112)


After all I'm not sure if that's the right way to do and the right OCL package at all. Maybe somebody has an idea or can point me into the right direction?

Thanks in advance!
Regards,
Michael

P.S.: I've searched the forum for OCL problems and I haven't found one which comes close to my issue. If there is already a post and I've missed it, I would be glad if somebody could point me to it.
P.P.S.: I've added a another external ecore model to my grammar which seems to work fine so far.
Re: Howto integrate OCL in a grammar? [message #557607 is a reply to message #557576] Wed, 08 September 2010 09:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Michael

The MDT/OCL grammars are part of the additional MDT/OCL Examples
installation available via the Modeling Discovery UI.

You probably want the Essential OCL grammar, which does the basic OCL
expressions.

The Complete OCL grammar extends the Essential OCL grammar to provide
context, so it may provide an interesting example of how to extend
Essential OCL.

The MDT/OCL 3.0.x release Xtext grammar supports editing and parsing of
the OCL but does not provide an executable AST. (The MDT/OCL 3.1.x in
November might and the MDT/OCL 3.2.x releade for Indigo definitely will
have AST execution.)

For now you would need to emulate the OCLinEcore grammar that parses the
OCL expression but persists it in String form so that it is reparsed
when requireed as an AST by the LPG parser.

The error is just telling you that the Complete OCL grammar is either
not in your workspace at all, or perhaps just not on your class path.

Regards

Ed Willink

On 08/09/2010 08:19, Michael Frey wrote:
> Hi,
>
> I want to "integrate" OCL expressions in my grammar. Thus it should be
> possible to write a valid OCL statement in my language. First of all I'm
> not sure which ecore model I should import. For instance I've choosen
> the following
>
>
> import "http://www.eclipse.org/ocl/3.0.0/CompleteOCLCST" as OCL
>
>
> I've searched for the package and it seems to point to a Xtext grammar
> which sounds promising. I've added a entry to my canHandle() function in
> my <Lang>ResourceProvider class. I've also added a extension point to my
> plugin.xml and set two dependencies
> (org.eclipse.ocl.examples.xtext.completeocl and
> org.eclipse.ocl.examples.xtext.completeocl.source). If I try to generate
> Xtext artifacts I get the following error:
>
>
> 0 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering platform
> uri '/home/michael/Desktop/Projekte'
> 2678 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems
> instantiating module de.hs_rm.cs.vs.dsm.Flow:
> java.lang.reflect.InvocationTargetException
> java.lang.RuntimeException: Problems instantiating module
> de.hs_rm.cs.vs.dsm.Flow: java.lang.reflect.InvocationTargetException
> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:73)
> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:52)
> at
> org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Lau ncher.java:74)
> at
> org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2La uncher.java:35)
> Caused by: org.eclipse.emf.common.util.WrappedException:
> java.lang.reflect.InvocationTargetException
> at
> org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$ 1.setValue(SettingProviderImpl.java:56)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalApplyAssignments(Mwe2ExecutionEngine.java:127)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in Case(Mwe2ExecutionEngine.java:102)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.xtext.util.PolymorphicDispatcher.invoke(Polymorp hicDispatcher.java:259)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalSwitch(Mwe2ExecutionEngine.java:56)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalApplyAssignments(Mwe2ExecutionEngine.java:126)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in Case(Mwe2ExecutionEngine.java:102)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.xtext.util.PolymorphicDispatcher.invoke(Polymorp hicDispatcher.java:259)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalSwitch(Mwe2ExecutionEngine.java:56)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalApplyAssignments(Mwe2ExecutionEngine.java:126)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in Case(Mwe2ExecutionEngine.java:102)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.xtext.util.PolymorphicDispatcher.invoke(Polymorp hicDispatcher.java:259)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalSwitch(Mwe2ExecutionEngine.java:56)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in Case(Mwe2ExecutionEngine.java:69)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.xtext.util.PolymorphicDispatcher.invoke(Polymorp hicDispatcher.java:259)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.in ternalSwitch(Mwe2ExecutionEngine.java:56)
>
> at
> org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.cr eate(Mwe2ExecutionEngine.java:52)
>
> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:71)
> ... 3 more
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
>
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
>
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$ 1.setValue(SettingProviderImpl.java:54)
>
> ... 36 more
> Caused by: java.lang.IllegalStateException: Problem parsing
> 'classpath:/de/hs_rm/cs/vs/dsm/Flow.xtext':[XtextLinkingDiag nostic:
> null:6 Couldn't resolve reference to EPackage
> 'http://www.eclipse.org/ocl/3.0.0/CompleteOCLCST'.]
> at
> org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageCo nfig.java:112)
>
>
> After all I'm not sure if that's the right way to do and the right OCL
> package at all. Maybe somebody has an idea or can point me into the
> right direction?
>
> Thanks in advance!
> Regards,
> Michael
>
> P.S.: I've searched the forum for OCL problems and I haven't found one
> which comes close to my issue. If there is already a post and I've
> missed it, I would be glad if somebody could point me to it.
> P.P.S.: I've added a another external ecore model to my grammar which
> seems to work fine so far.
Re: Howto integrate OCL in a grammar? [message #557629 is a reply to message #557607] Wed, 08 September 2010 11:55 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi Ed,

thank you for your quick reply. I'm not sure if I've understand your answer. OCLinEcore [1] seems to describe how to integrate OCL expressions in an ecore model while I want to embedd OCL in my language itself on a grammar level e.g.

import "http://www.eclipse.org/ocl/3.0.0/EssentialOCLCST" as OCL

ExampleRule:
  'ocloperation' '('expression=[OCL::Constraint]')' ';'; 


I'm sorry but I don't know what you mean if you write AST execution. If AST stands for abstract syntax tree I imagine that it's parsing related (but since you can parse an expression you have a AST). *confused*

Quote:

The error is just telling you that the Complete OCL grammar is either not in your workspace at all, or perhaps just not on your class path.



I've thought adding the packages mentioned in my first posting would fix that problem. You've mentioned the essential ocl grammar. Probably that's the following one?

import "http://www.eclipse.org/ocl/3.0.0/EssentialOCLCST" as OCL


Thanks in advance!
Regards,
Michael


[1] http://wiki.eclipse.org/MDT/OCLinEcore
Re: Howto integrate OCL in a grammar? [message #557638 is a reply to message #557607] Wed, 08 September 2010 12:08 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi

Quote:

The error is just telling you that the Complete OCL grammar is either not in your workspace at all, or perhaps just not on your class path.


I've replaced the complete ocl grammar with the essential ocl grammar and added the package org.eclipse.ocl.examples.xtext.essentialocl to the dependency section of my plugin.xml - I'm wondering what I'm missing. I've installed the OCL Extender SDK as well as the OCL Examples and Editors. Probably I'm missing a certain package. Any ideas?

Regards,
Michael
Re: Howto integrate OCL in a grammar? [message #557642 is a reply to message #557629] Wed, 08 September 2010 12:09 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

> ... OCLinEcore [1] seems to describe how to integrate OCL
> expressions in an ecore model while I want to embedd OCL in my language
> itself on a grammar level e.g.

"import" is used for meta model import, i.e. for referencing or
returning types that are not generated from the grammar but are defined
in an already existing meta model. If you want to reuse "syntax",
grammar mixin is the way to go (as you usually do by "... *with*
bla.terminals").

Also, in the grammar element "SomeRule: refernce=[x::y]" you do not
refer to a grammar rule but to a *type* (often they look the same, as
the type inferred from a grammar rule gets the same name as the rule).

Alex

P.S.: Sorry, if I did not correctly interpreted what you are trying to do.


Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@itemis.de
Re: Howto integrate OCL in a grammar? [message #557701 is a reply to message #557642] Wed, 08 September 2010 14:52 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi Alex,

thank you for your reply. I've thought that [Element] would refer to an alread initialized element in my grammar, e.g.

VariableDeclaration:
  type=DataType name=ID ';';

SomeStament:
  reference=[VariableDeclaration] ':=' value=INT ';';


The above statement "SomeStament" refers to an initialized element "VariableDeclaration". Thus it is possible to write something like this

  int a;
  a := 42;


You correctely intepreted what I'm trying to do. I want to import a OCL grammar and use ocl expression in my grammer. For instance I would like to assign in a rule in my grammar a already defined constraint to an attribute. So the right way is to import a OCL model an to use elements of the model by refering to a type e.g. [OCL::OCLExpression]? I'm a bit confused.

Regards,
Michael

P.S.: Sorry, if that's another dumb question Sad
Re: Howto integrate OCL in a grammar? [message #557721 is a reply to message #557701] Wed, 08 September 2010 15:23 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte BoersmaFriend
Messages: 434
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
A cross-reference like [Element] means that the attribute being defined (elt=[Element]) is an EReference (in the generated or re-used Ecore model) to something of type Element. The Xtext framework provides a default linking mechanism for initialized Element objects which happen to "be around" like your VariableDeclaration for 'a'. So, it might look like the [Element] cross-reference and the Element type rule belong together, but that's only through the generated/re-used Element type. As far as the generated parser is concerned, it is happy as long as it can consume some token (ID, by default; override with [Element|someOtherTokenDef]) at the position of the cross-reference. So, the actual linking is something which lives outside of the syntax. In fact, the word 'grammar' is a bit misleading as an Xtext grammar (partially) addresses a few other aspects as well, like defining the types for the AST nodes.

Let's say you want to re-use an OCL grammar. Then you'd need the grammar and extend from it using the with construct Alexander is hinting at. What you're trying to do now, is to re-use an OCL model, through the import construct. This means that you've only got the types but not the syntax and you'll have to create a grammar for the OCL sub-language yourself. So, it's not enough to say =[OCL::OCLExpression] to be able to write down an OCL expression: you'll actually need parser rules for that using the "returns OCL::OCLExpression" construct to define both the syntax as well as the way how that syntax corresponds to the re-used OCLExpression type.


Re: Howto integrate OCL in a grammar? [message #557734 is a reply to message #557701] Wed, 08 September 2010 15:47 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Michael

Study either of the OCLinEcore or CompleteOCL grammars for examples of
how to re-use/extend the EssentialOCL grammar and the EssentialOCL CST
model.

The CST model is Xtext-friendly. A transformation is required to convert
it the OMG-defined AST, which is what the OCL evaluator requires to
execute an OCL expression. This transformation is currently missing, I'm
working on it right now. For the time being the parallel parsers provide
a workaround. The new Xtext parser for interactive editing. The old LPG
parser for AST creation prioor to execution.

Regards

Ed Willink

On 08/09/2010 15:52, Michael Frey wrote:
> Hi Alex,
>
> thank you for your reply. I've thought that [Element] would refer to an
> alread initialized element in my grammar, e.g.
>
>
> VariableDeclaration:
> type=DataType name=ID ';';
>
> SomeStament:
> reference=[VariableDeclaration] ':=' value=INT ';';
>
>
> The above statement "SomeStament" refers to an initialized element
> "VariableDeclaration". Thus it is possible to write something like this
>
>
> int a;
> a := 42;
>
>
> You correctely intepreted what I'm trying to do. I want to import a OCL
> grammar and use ocl expression in my grammer. For instance I would like
> to assign in a rule in my grammar a already defined constraint to an
> attribute. So the right way is to import a OCL model an to use elements
> of the model by refering to a type e.g. [OCL::OCLExpression]? I'm a bit
> confused.
>
> Regards,
> Michael
>
> P.S.: Sorry, if that's another dumb question :(
Re: Howto integrate OCL in a grammar? [message #558751 is a reply to message #557576] Tue, 14 September 2010 10:11 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi,

I've still got the problem that the package couldn't be resolved. Since I want to extend the EssentialOCL grammar like the CompleteOCL grammar I've made the following changes to my grammar:

grammar de.hs_rm.cs.vs.flow with org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL 

import "http://www.eclipse.org/emf/2002/Ecore" as ecore
import "http://www.eclipse.org/ocl/3.0.0/EssentialOCLCST" as OCL
import "platform:/resource/de.hs_rm.cs.vs.dsm.flow/ressources/owl.ecore" as OWL

generate flow "http://www.hs_rm.de/cs/vs/dsm/Flow"


While refering to the types defined in EssentialOCL in my grammar works, generating the Xtext artifacts doesn't work. I've added several plugins to my plugin dependencies list but that doesn't change anything at all. I assume that I have to add several lines to the MWE2 file which generates the artifacts. I've found a posting over here where somebody added a registerGeneratedEPackage to his bean section in the workflow file. Unfortunately there is no MWE2 file in the CompleteOCL plugin which would might give me a clue about the necessary options.

Probably I'm still missing dependencies so I've had a look on the Manfiest.MF file of the CompleteOCL plugin and there is no plugin dependency to the EssentialOCL plugin at all which confuses me a bit.

Regards,
Michael
Re: Howto integrate OCL in a grammar? [message #559314 is a reply to message #557576] Thu, 16 September 2010 11:15 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hm,

I've figured out [1] that in order to use the BaseCST OCL model I have to add the following:

fragment = ecore.EcoreGeneratorFragment {
  referencedGenModels= "platform:/plugin/org.eclipse.ocl.examples.xtext.base/model/BaseCST.genmodel"
}


But still generating the artifacts fail with a "Couldn't resolve reference to EPackage". Any ideas?

Regards,
Michael

[1] http://www.eclipse.org/Xtext/documentation/latest/xtext.html #getting-started-xpand
Re: Howto integrate OCL in a grammar? [message #559321 is a reply to message #559314] Thu, 16 September 2010 11:38 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Michael,

platform:/plugin uris are a concept that only works inside Eclipse.
Please use a complete archive uri that points the the genmodel.

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

Am 16.09.10 13:15, schrieb Michael Frey:
> Hm,
> I've figured out [1] that in order to use the BaseCST OCL model I have
> to add the following:
>
> fragment = ecore.EcoreGeneratorFragment {
> referencedGenModels=
> " platform:/plugin/org.eclipse.ocl.examples.xtext.base/model/B aseCST.genmodel "
>
> }
>
>
> But still generating the artifacts fail with a "Couldn't resolve
> reference to EPackage". Any ideas?
>
> Regards,
> Michael
>
> [1]
> http://www.eclipse.org/Xtext/documentation/latest/xtext.html #getting-started-xpand
>
Re: Howto integrate OCL in a grammar? [message #559322 is a reply to message #559314] Thu, 16 September 2010 11:39 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Michael,

alternatively you may try to use "classpath:/model/BaseCST.genmodel" if
the plugin is on your plugin's classpath.

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

Am 16.09.10 13:15, schrieb Michael Frey:
> Hm,
> I've figured out [1] that in order to use the BaseCST OCL model I have
> to add the following:
>
> fragment = ecore.EcoreGeneratorFragment {
> referencedGenModels=
> " platform:/plugin/org.eclipse.ocl.examples.xtext.base/model/B aseCST.genmodel "
>
> }
>
>
> But still generating the artifacts fail with a "Couldn't resolve
> reference to EPackage". Any ideas?
>
> Regards,
> Michael
>
> [1]
> http://www.eclipse.org/Xtext/documentation/latest/xtext.html #getting-started-xpand
>
Re: Howto integrate OCL in a grammar? [message #559331 is a reply to message #559322] Thu, 16 September 2010 12:07 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi Sebastian,

I've tried to use the classpath URI which fails and I'm wondering if a complete archive uri would be the something like this (and that doesn't make sense at all):

file:///path/to/my/jar


Since I've added the plugin to the plugin dependencies of my language plugin I've assumed that it must be on the classpath. I've also used PDE Tools -> Update Classpath .. but that doesn't change anything at all. Probably it's totally obvious and I'm just to stupid Sad

Regards,
Michael

[Updated on: Thu, 16 September 2010 12:09]

Report message to a moderator

Re: Howto integrate OCL in a grammar? [message #559622 is a reply to message #559321] Fri, 17 September 2010 12:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Sebastian

From a user's perspective, Michael is within Eclipse; it is a
limitation of MWE2 that a script run 'within' Eclipse is not within Eclipse.

I feel that platform:/plugin should work since it is at least a standard
Eclipse way and since EcorePlugin.computePlatformURIMap() is provided
specifuically to provide platform:/plugin / platform:/resource equivalence.

Regards

Ed Willink


On 16/09/2010 12:38, Sebastian Zarnekow wrote:
> Hi Michael,
>
> platform:/plugin uris are a concept that only works inside Eclipse.
> Please use a complete archive uri that points the the genmodel.
>
> Regards,
> Sebastian
Re: Howto integrate OCL in a grammar? [message #559623 is a reply to message #559331] Fri, 17 September 2010 12:36 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Michael

The OCL grammars build scripts in org.eclipse.ocl.examples.build use
platform:/resource, so I suggest you do the same. You will of course
need to import the MDT/OCL examples plugins into your workspace.

Regards

Ed Willink

On 16/09/2010 13:07, Michael Frey wrote:
> Hi Sebastian,
>
> I've tried to use the classpath URI which fails and I'm wondering if a
> complete archive uri would be the something like this:
>
> file:///path/to/my/jar
>
> Since I've added the plugin to the plugin dependencies of my language
> plugin I've assumed that it must be on the classpath. I've also used PDE
> Tools -> Update Classpath .. but that doesn't change anything at all.
> Probably it's totally obvious and I'm just to stupid :(
> Regards,
> Michael
Re: Howto integrate OCL in a grammar? [message #559668 is a reply to message #559623] Fri, 17 September 2010 14:35 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi,

I'v imported the org.eclipse.ocl.examples.xtext.base plugin into my workspace and pointed the import statement in my grammar to the ecore file in the plugin.

import "platform:/resource/org.eclipse.ocl.examples.xtext.base/model/BaseCST.ecore" as base


and I've set in my mwe2 file the referencedGenModel attribute.

            // Added
fragment = org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment {
                referencedGenModels = "platform:/resource/de.hs_rm.cs.vs.dsm.flow/model/owl.genmodel"
                referencedGenModels = "platform:/resource/org.eclipse.ocl.examples.xtext.base/model/BaseCST.genmodel"
}


and I'm still getting this error while I try to generate the xtext artifacts.

0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri '/home/michael/Desktop/Projekte'
947  [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher  - Problems instantiating module de.hs_rm.cs.vs.dsm.Flow: java.lang.reflect.InvocationTargetException
java.lang.RuntimeException: Problems instantiating module de.hs_rm.cs.vs.dsm.Flow: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:73)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: org.eclipse.emf.common.util.WrappedException: java.lang.reflect.InvocationTargetException
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:127)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:126)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:126)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:69)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:259)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:56)
	at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:71)
	... 3 more
Caused by: java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.emf.mwe2.language.factory.SettingProviderImpl$1$1.setValue(SettingProviderImpl.java:54)
	... 36 more
Caused by: java.lang.IllegalStateException: Problem parsing 'classpath:/de/hs_rm/cs/vs/dsm/Flow.xtext':[XtextLinkingDiagnostic: null:7 Couldn't resolve reference to EPackage 'platform:/resource/org.eclipse.ocl.examples.xtext.base/model/BaseCST.ecore'.]
	at org.eclipse.xtext.generator.LanguageConfig.setUri(LanguageConfig.java:112)
	... 41 more


Is there any way to debug this? I'm running out of options Sad

Regards,
Michael
Re: Howto integrate OCL in a grammar? [message #559725 is a reply to message #557576] Fri, 17 September 2010 17:16 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi,

I've tested it on a another eclipse installation (3.5.1 instead of 3.6) on a colleagues machine without a mdt installation and it's working over there. I've copied the org.eclipse.ocl.example.base project in the workspace and added two jars as external libraries (org.eclipse.ocl and org.eclipse.ocl.examples.common). Furthermore I've created an xtext example project and added a few rules and the necessary important statement as well as the referenceGenModels entry in the MWE2 file.

I will try to install an older version of eclipse on my maschine. Anyway I'm still grateful for any hints what the exact problem might be.

Regards,
Michael
Re: Howto integrate OCL in a grammar? [message #559777 is a reply to message #557576] Sat, 18 September 2010 09:30 Go to previous messageGo to next message
Michael Frey is currently offline Michael FreyFriend
Messages: 48
Registered: August 2010
Member
Hi,

so it's still not working. I've installed Eclipse 3.5.2 and all necessary plugins and I get the same missing reference error. I've already tried it on another workstation with a fresh eclipse installation and I'm running in the same error Sad So, is there a way to debug this?

Regards,
Michael
Re: Howto integrate OCL in a grammar? [message #658322 is a reply to message #557734] Mon, 07 March 2011 21:11 Go to previous messageGo to next message
Federico Wiecko is currently offline Federico WieckoFriend
Messages: 1
Registered: March 2011
Junior Member
Hi,

I want to do exactly the same as Michael: to reuse OCL grammar into my DSL.
However I am getting a different error, so I will describe what I did.

1) I installed all the OCL support that are included under MDT/OCL 3.0.2
2) I imported into my workspace the following plugins:

org.eclipse.ocl.examples.xtext.base
org.eclipse.ocl.examples.xtext.essentialocl

3) I created my XText project in which I define the following trivial grammar as a prof of concept:

grammar org.xtext.example.mydsl9.MyDsl with org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL

generate myDsl "http://www.xtext.org/example/mydsl9/MyDsl"

VarDef:
	'var' name=ID type=TypeExpCS;


The XText editor recognizes that TypeExpCS is defined in EssentialOCL, so no error here.

4) I added a reference to the genmodel in the workflow file:
fragment = ecore.EcoreGeneratorFragment {
   genModels = "platform:/resource/org.eclipse.ocl.examples.xtext.essentialocl/model/EssentialOCLCST.genmodel" 	
}


When I compile I get the following error:

...
949  [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for org.xtext.example.mydsl9.MyDsl with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, FormatterFragment, LabelProviderFragment, TransformerFragment, OutlineNodeAdapterFactoryFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment
warning(200): ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDsl.g:1753:2: Decision can match input such as "'implies'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDsl.g:1870:2: Decision can match input such as "'xor'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDsl.g:1987:2: Decision can match input such as "'or'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
warning(200): ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDsl.g:2104:2: Decision can match input such as "'and'" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
...
more similar errors here
......
error(211): ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDsl.g:3209:1: [fatal] rule ruleSubNavigatingExpCS has non-LL(*) decision due to recursive rule invocations reachable from alts 1,2,3,4.  Resolve by left-factoring or using syntactic predicates or using backtrack=true option.
warning(200): ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDsl.g:3209:1: Decision can match input such as "RULE_ID '::'" using multiple alternatives: 1, 2, 3, 4
As a result, alternative(s) 3,2,4 were disabled for that input
8776 [main] ERROR enerator.CompositeGeneratorFragment  - java.io.FileNotFoundException: ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDslParser.java (No such file or directory)
org.eclipse.emf.common.util.WrappedException: java.io.FileNotFoundException: ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDslParser.java (No such file or directory)
	at org.eclipse.xtext.util.Files.readFileIntoString(Files.java:134)
	at org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment.suppressWarningsImpl(AbstractAntlrGeneratorFragment.java:126)
	at org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment.suppressWarnings(AbstractAntlrGeneratorFragment.java:137)
	at org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGeneratorFragment.suppressWarnings(AbstractAntlrGeneratorFragment.java:132)
	at org.eclipse.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment.generate(XtextAntlrGeneratorFragment.java:47)
	at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:81)
	at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:69)
	at org.eclipse.xtext.generator.Generator.generate(Generator.java:296)
	at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:106)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:31)
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:80)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)
Caused by: java.io.FileNotFoundException: ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9/parser/antlr/internal/InternalMyDslParser.java (No such file or directory)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at java.io.FileInputStream.<init>(FileInputStream.java:66)
	at org.eclipse.xtext.util.Files.readFileIntoString(Files.java:119)
	... 17 more



It seems to me that the XText grammar definition of the EssentialOCL project has some ambiguities and that seems the reason why the parser file is not being created in my project. If this is the case, where I can get a working version of EssentialOCL ?

I know that CompleteOCL and OCLInEcore make grammar reusse of EssentialOCL, however I cannot test them since the workflow file is missing.

As a final test, I comment out from the EssentialOCL grammar rule definition the rules that produces conflicts and just left the definition of TypeExpCS as the main rule + other required grammar rules. Doing this my project is compiling fine.

I would appreciate if somebody can point me in the right direction.

Thanks in advance !
Federico Wiecko
Re: Howto integrate OCL in a grammar? [message #658386 is a reply to message #658322] Tue, 08 March 2011 09:13 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
Just a guess: Maybe you have to enable backtracking?

Am 07.03.11 22:11, schrieb Federico Wiecko:
> Hi,
>
> I want to do exactly the same as Michael: to reuse OCL grammar into my DSL.
> However I am getting a different error, so I will describe what I did.
>
> 1) I installed all the OCL support that are included under MDT/OCL 3.0.2
> 2) I imported into my workspace the following plugins:
> org.eclipse.ocl.examples.xtext.base
> org.eclipse.ocl.examples.xtext.essentialocl
>
> 3) I created my XText project in which I define the following trivial
> grammar as a prof of concept:
>
>
> grammar org.xtext.example.mydsl9.MyDsl with
> org.eclipse.ocl.examples.xtext.essentialocl.EssentialOCL
>
> generate myDsl "http://www.xtext.org/example/mydsl9/MyDsl"
>
> VarDef:
> 'var' name=ID type=TypeExpCS;
>
>
> The XText editor recognizes that TypeExpCS is defined in EssentialOCL,
> so no error here.
>
> 4) I added a reference to the genmodel in the workflow file:
>
> fragment = ecore.EcoreGeneratorFragment {
> genModels =
> " platform:/resource/org.eclipse.ocl.examples.xtext.essentialo cl/model/EssentialOCLCST.genmodel "
>
> }
>
>
> When I compile I get the following error:
>
>
> ..
> 949 [main] INFO ipse.xtext.generator.LanguageConfig - generating
> infrastructure for org.xtext.example.mydsl9.MyDsl with fragments :
> ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment,
> EcoreGeneratorFragment, ParseTreeConstructorFragment,
> ResourceFactoryFragment, XtextAntlrGeneratorFragment,
> JavaValidatorFragment, ImportNamespacesScopingFragment,
> QualifiedNamesFragment, BuilderIntegrationFragment, FormatterFragment,
> LabelProviderFragment, TransformerFragment,
> OutlineNodeAdapterFactoryFragment, QuickOutlineFragment,
> QuickfixProviderFragment, JavaBasedContentAssistFragment,
> XtextAntlrUiGeneratorFragment
> warning(200):
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDsl.g:1753:2:
> Decision can match input such as "'implies'" using multiple
> alternatives: 1, 2
> As a result, alternative(s) 2 were disabled for that input
> warning(200):
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDsl.g:1870:2:
> Decision can match input such as "'xor'" using multiple alternatives: 1, 2
> As a result, alternative(s) 2 were disabled for that input
> warning(200):
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDsl.g:1987:2:
> Decision can match input such as "'or'" using multiple alternatives: 1, 2
> As a result, alternative(s) 2 were disabled for that input
> warning(200):
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDsl.g:2104:2:
> Decision can match input such as "'and'" using multiple alternatives: 1, 2
> As a result, alternative(s) 2 were disabled for that input
> ..
> more similar errors here
> .....
> error(211):
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDsl.g:3209:1:
> [fatal] rule ruleSubNavigatingExpCS has non-LL(*) decision due to
> recursive rule invocations reachable from alts 1,2,3,4. Resolve by
> left-factoring or using syntactic predicates or using backtrack=true
> option.
> warning(200):
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDsl.g:3209:1:
> Decision can match input such as "RULE_ID '::'" using multiple
> alternatives: 1, 2, 3, 4
> As a result, alternative(s) 3,2,4 were disabled for that input
> 8776 [main] ERROR enerator.CompositeGeneratorFragment -
> java.io.FileNotFoundException:
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDslParser.java
> (No such file or directory)
> org.eclipse.emf.common.util.WrappedException:
> java.io.FileNotFoundException:
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDslParser.java
> (No such file or directory)
> at org.eclipse.xtext.util.Files.readFileIntoString(Files.java:1 34)
> at
> org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGenera torFragment.suppressWarningsImpl(AbstractAntlrGeneratorFragm ent.java:126)
>
> at
> org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGenera torFragment.suppressWarnings(AbstractAntlrGeneratorFragment. java:137)
>
> at
> org.eclipse.xtext.generator.parser.antlr.AbstractAntlrGenera torFragment.suppressWarnings(AbstractAntlrGeneratorFragment. java:132)
>
> at
> org.eclipse.xtext.generator.parser.antlr.XtextAntlrGenerator Fragment.generate(XtextAntlrGeneratorFragment.java:47)
>
> at
> org.eclipse.xtext.generator.CompositeGeneratorFragment.gener ate(CompositeGeneratorFragment.java:81)
>
> at
> org.eclipse.xtext.generator.LanguageConfig.generate(Language Config.java:69)
> at org.eclipse.xtext.generator.Generator.generate(Generator.jav a:296)
> at org.eclipse.xtext.generator.Generator.invokeInternal(Generat or.java:106)
> at
> org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invok e(AbstractWorkflowComponent.java:126)
>
> at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.ja va:34)
> at
> org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invok e(AbstractWorkflowComponent.java:201)
>
> at
> org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkf lowComponent.invoke(AbstractCompositeWorkflowComponent.java: 31)
>
> at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow. java:19)
> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:80)
> at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runne r.java:52)
> at
> org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Lau ncher.java:74)
> at
> org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2La uncher.java:35)
> Caused by: java.io.FileNotFoundException:
> ../org.xtext.example.mydsl9/src-gen/org/xtext/example/mydsl9 /parser/antlr/internal/InternalMyDslParser.java
> (No such file or directory)
> at java.io.FileInputStream.open(Native Method)
> at java.io.FileInputStream.<init>(FileInputStream.java:106)
> at java.io.FileInputStream.<init>(FileInputStream.java:66)
> at org.eclipse.xtext.util.Files.readFileIntoString(Files.java:1 19)
> ... 17 more
>
>
>
> It seems to me that the XText grammar definition of the EssentialOCL
> project has some ambiguities and that seems the reason why the parser
> file is not being created in my project. If this is the case, where I
> can get a working version of EssentialOCL ?
>
> I know that CompleteOCL and OCLInEcore make grammar reusse of
> EssentialOCL, however I cannot test them since the workflow file is
> missing.
> As a final test, I comment out from the EssentialOCL grammar rule
> definition the rules that produces conflicts and just left the
> definition of TypeExpCS as the main rule + other required grammar rules.
> Doing this my project is compiling fine.
> I would appreciate if somebody can point me in the right direction.
>
> Thanks in advance !
> Federico Wiecko


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


---
Get professional support from the Xtext committers at www.typefox.io
Re: Howto integrate OCL in a grammar? [message #658496 is a reply to message #658386] Tue, 08 March 2011 17:19 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Frederico

On 08/03/2011 09:13, Jan Koehnlein wrote:
> Just a guess: Maybe you have to enable backtracking?
>
Absolutely. You will find the mwe2 scripts in
org.eclipse.ocl.examples.build. I recommend emulating them.

A word of caution. OCL is a complex language so Xtext will provide the
CST support. You are on your
own in reusing the conversion to the OMG-like AST for which evaluation
is supported. Providing an easy
API for this is something I'm thinking about; very unlikely to be in Indigo.

Regards

Ed Willink
Re: Howto integrate OCL in a grammar? [message #658497 is a reply to message #658496] Tue, 08 March 2011 17:26 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi
> A word of caution. OCL is a complex language so Xtext will provide the
> CST support. You are on your
> own in reusing the conversion to the OMG-like AST for which evaluation
> is supported. Providing an easy
> API for this is something I'm thinking about; very unlikely to be in
> Indigo.
>
https://bugs.eclipse.org/bugs/show_bug.cgi?id=339257

Regards

Ed Willink
Previous Topic:problem with cross references to other model files in LazyLinkingResource
Next Topic:How to navigate in the workspace
Goto Forum:
  


Current Time: Thu Apr 25 23:09:02 GMT 2024

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

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

Back to the top