Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Generation oddity with imported grammar
Generation oddity with imported grammar [message #59618] Thu, 16 July 2009 15:40 Go to next message
Eclipse UserFriend
Hi,

I get a strange generation error with already generated packages from
imported grammar duplicated in dependent grammar project src-gen.

context :

-----------------------------------
grammar A with Terminals

TopA :
(xyzs+=XYZ)+
;

XYZ :
'xyz' name=ID ';'
;
-----------------------------------

-----------------------------------
grammar B with A
import "http://www.sf.net/ABC"
// ABC package URI as declared in A/plugin.xml resolve XYZ right !

TopB :
(imports+=IMPORT)+
(links+=LINK)+
;

IMPORT:
'import' uri=STRING ';'
;

LINK :
' link' name=ID 'to' refXYZ=[XYZ] ';' // from A
;
-----------------------------------


question :

*) http:// protocol URI for imported package pb ?

strange behavior : already generated packages from imported grammar A are
duplicated in dependent grammar B project src-gen directory.

When looking at B.genmodel something say 'http://sourceforge.net/ABC' not
found.

Pb is : I declared "http://www.sf.net/ABC" and tried to import accordingly
... !

Should generated_package extension IDs like 'http://...' should be avoided
?

Is it a bug ?

Is it working as it should ?

regards,
Re: Generation oddity with imported grammar [message #59647 is a reply to message #59618] Thu, 16 July 2009 16:20 Go to previous messageGo to next message
Eclipse UserFriend
Hi Lucas,

did set the reference to the existing genModels in your
EcoreGeneratorFragment?
Please have a look at the docs for details about it (or search this
newsgroup for "genModels".

http://www.eclipse.org/Xtext/documentation/0_7_0/xtext.html (search for
genModels

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

Am 16.07.2009 21:40 Uhr, schrieb lucas bigeardel:
> Hi,
>
> I get a strange generation error with already generated packages from
> imported grammar duplicated in dependent grammar project src-gen.
>
> context :
>
> -----------------------------------
> grammar A with Terminals
>
> TopA :
> (xyzs+=XYZ)+
> ;
>
> XYZ :
> 'xyz' name=ID ';'
> ;
> -----------------------------------
>
> -----------------------------------
> grammar B with A
> import "http://www.sf.net/ABC" // ABC package URI as declared in
> A/plugin.xml resolve XYZ right !
> TopB :
> (imports+=IMPORT)+
> (links+=LINK)+
> ;
>
> IMPORT:
> 'import' uri=STRING ';'
> ;
>
> LINK :
> ' link' name=ID 'to' refXYZ=[XYZ] ';' // from A
> ;
> -----------------------------------
>
>
> question :
>
> *) http:// protocol URI for imported package pb ?
>
> strange behavior : already generated packages from imported grammar A
> are duplicated in dependent grammar B project src-gen directory.
>
> When looking at B.genmodel something say 'http://sourceforge.net/ABC'
> not found.
>
> Pb is : I declared "http://www.sf.net/ABC" and tried to import
> accordingly ... !
>
> Should generated_package extension IDs like 'http://...' should be
> avoided ?
>
> Is it a bug ?
>
> Is it working as it should ?
>
> regards,
>
>
Re: Generation oddity with imported grammar [message #59765 is a reply to message #59647] Thu, 16 July 2009 18:20 Go to previous messageGo to next message
Eclipse UserFriend
Sebastian Zarnekow wrote:

> Hi Lucas,

> did set the reference to the existing genModels in your
> EcoreGeneratorFragment?
> Please have a look at the docs for details about it (or search this
> newsgroup for "genModels".
> http://www.eclipse.org/Xtext/documentation/0_7_0/xtext.html (search for
> genModels


in this doc 'platform:' should be read 'platform:/resource'

just realized after reading the excellent article from M. Paternostro :
http://lmap.blogspot.com/2008/03/platform-scheme-uri.html


> Regards,
> Sebastian
Re: Generation oddity with imported grammar [message #59813 is a reply to message #59765] Thu, 16 July 2009 19:45 Go to previous messageGo to next message
Eclipse UserFriend
lucas bigeardel wrote:

> Sebastian Zarnekow wrote:

>> Hi Lucas,

>> did set the reference to the existing genModels in your
>> EcoreGeneratorFragment?
>> Please have a look at the docs for details about it (or search this
>> newsgroup for "genModels".
>> http://www.eclipse.org/Xtext/documentation/0_7_0/xtext.html (search for
>> genModels

Solution working for me :

------------------------------------------
Adding a package import in B.xtext

import "http://www.sf.net/A/XYZ"
-------------------------------------------------------

Adding a new bean in GenerateDSL.mwe :

<bean class="org.eclipse.emf.mwe.utils.StandaloneSetup"
platformUri="${runtimeProject}/../project/src-gen">
<registerGeneratedEPackage value="net.sf.A.XYZPackage"/>
</bean>


And modifying EcoreGeneratorFragment fragment :

<fragment
class="org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment "

genModels=" platform:/resource/project/src-gen/net/sf/xqz/engine/script/ Orchestror.genmodel "
/>

Et voila !

> in this doc 'platform:' should be read 'platform:/resource'

> just realized after reading the excellent article from M. Paternostro :
> http://lmap.blogspot.com/2008/03/platform-scheme-uri.html


>> Regards,
>> Sebastian
Re: Generation oddity with imported grammar [message #59909 is a reply to message #59765] Fri, 17 July 2009 04:54 Go to previous message
Eclipse UserFriend
Hi Lucas,

I've searched the docs for platform: but could not spot the mistake. Can
you give me a hint as I'ld like to fix it.

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


Am 17.07.2009 0:20 Uhr, schrieb lucas bigeardel:
> Sebastian Zarnekow wrote:
>
>> Hi Lucas,
>
>> did set the reference to the existing genModels in your
>> EcoreGeneratorFragment?
>> Please have a look at the docs for details about it (or search this
>> newsgroup for "genModels".
>> http://www.eclipse.org/Xtext/documentation/0_7_0/xtext.html (search
>> for genModels
>
>
> in this doc 'platform:' should be read 'platform:/resource'
>
> just realized after reading the excellent article from M. Paternostro :
> http://lmap.blogspot.com/2008/03/platform-scheme-uri.html
>
>
>> Regards,
>> Sebastian
>
>
Previous Topic:Crossreference & lazy loading pb ?
Next Topic:[Xtext] Update highlighting after document change
Goto Forum:
  


Current Time: Thu May 08 19:05:24 EDT 2025

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

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

Back to the top