Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Literals class is not created(TMF Xtext)
Literals class is not created [message #485096] Thu, 10 September 2009 14:19 Go to next message
Dana Wong is currently offline Dana WongFriend
Messages: 12
Registered: September 2009
Junior Member
Hello Xtext Team

Our grammar is now quite large and I have hit an unusual problem with the generation.

When I generate the grammar, the Literals variable in the MyDslPackage is not created.

This error occurred while adding in another grammar element. For instance, adding a new enum type.

e.g. If I try and add one more grammar element:
enum ColourEnum:
red | blue;

The literals variable is not generated, however removing one enum option:

enum ColourEnum;
red;

works.

1. Is there a limit in the number of grammar elements allowed?
2. Would you have any ideas what could be the reason?

Thank you

Kind regards,
Dana
Re: Literals class is not created [message #485102 is a reply to message #485096] Thu, 10 September 2009 14:27 Go to previous messageGo to next message
Michael Burkhardt is currently offline Michael BurkhardtFriend
Messages: 64
Registered: July 2009
Member
Hi Dana,

I dont know something about the reasons, but may there is another non-terminal
begining with "blue" or Blue or another terminal matches with "blue".

My second try would be

enum ColourEnum:
Red = "red" | Blue = "blue";

for going sure about a problems with the number of non-terminals.


Ciao, Micha



--- Original-Nachricht ---
Absender: Dana Wong
Datum: 10.09.2009 16:19
> Hello Xtext Team
>
> Our grammar is now quite large and I have hit an unusual problem with
> the generation.
>
> When I generate the grammar, the Literals variable in the MyDslPackage
> is not created.
>
> This error occurred while adding in another grammar element. For
> instance, adding a new enum type.
> e.g. If I try and add one more grammar element:
> enum ColourEnum:
> red | blue;
>
> The literals variable is not generated, however removing one enum option:
>
> enum ColourEnum;
> red;
>
> works.
>
> 1. Is there a limit in the number of grammar elements allowed? 2.
> Would you have any ideas what could be the reason?
>
> Thank you
>
> Kind regards,
> Dana
Re: Literals class is not created [message #485117 is a reply to message #485102] Thu, 10 September 2009 14:48 Go to previous messageGo to next message
Dana Wong is currently offline Dana WongFriend
Messages: 12
Registered: September 2009
Junior Member
Thanks Micha for your suggestion, however there is definitely no terminal rule or other keyword that begins with blue and red in my grammar.

Re: Literals class is not created [message #485122 is a reply to message #485096] Thu, 10 September 2009 14:56 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3098
Registered: July 2009
Senior Member
Hi Dana,

assuming you are talking about the inner class Literals of a generated
EPackage:
I expect your metamodel to be quite large and I can imagine some fancy
optimizations in the genmodel generator that will produce other code
than usual.
Can you try to generate the model code manually for your metamodel and
confirm, that generation works even if you add another literal value or
something similar?

If you refer to EnumLiterals .. well I've no idea what might cause this
behaviour. If it would be possible for you to send me your metamodel or
a sample grammar, I'll have a look at it.

Regarding your first question:
There is no limit for the number of grammar elements, that I'm aware of.

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

Dana Wong schrieb:
> Hello Xtext Team
>
> Our grammar is now quite large and I have hit an unusual problem with
> the generation.
>
> When I generate the grammar, the Literals variable in the MyDslPackage
> is not created.
>
> This error occurred while adding in another grammar element. For
> instance, adding a new enum type.
> e.g. If I try and add one more grammar element:
> enum ColourEnum:
> red | blue;
>
> The literals variable is not generated, however removing one enum option:
>
> enum ColourEnum;
> red;
>
> works.
>
> 1. Is there a limit in the number of grammar elements allowed? 2.
> Would you have any ideas what could be the reason?
>
> Thank you
>
> Kind regards,
> Dana
Re: Literals class is not created [message #485135 is a reply to message #485122] Thu, 10 September 2009 15:25 Go to previous messageGo to next message
Dana Wong is currently offline Dana WongFriend
Messages: 12
Registered: September 2009
Junior Member
Hi Sebastian,

Yes, the model generation works, the extra grammar elements I added have EClasses created. Just the inner interface Literals that is missing from my grammar's Package class.

However this problem isnt a stopper, and I can go on, I was just curious as to why it is missing.

Also the problem arises no matter what grammar element I add.

Many thanks,
Dana
Re: Literals class is not created [message #485140 is a reply to message #485122] Thu, 10 September 2009 15:26 Go to previous messageGo to next message
Ed Merks is currently online Ed MerksFriend
Messages: 29593
Registered: July 2009
Senior Member
GenPackage has a "Literals Interface" property that's set to false by
default for very large models (to avoid exceeding byte code limits).
Initialize by Loading it similarly set to true for large models, again,
to avoid exceeding byte code limits.


Sebastian Zarnekow wrote:
> Hi Dana,
>
> assuming you are talking about the inner class Literals of a generated
> EPackage:
> I expect your metamodel to be quite large and I can imagine some fancy
> optimizations in the genmodel generator that will produce other code
> than usual.
> Can you try to generate the model code manually for your metamodel and
> confirm, that generation works even if you add another literal value
> or something similar?
>
> If you refer to EnumLiterals .. well I've no idea what might cause
> this behaviour. If it would be possible for you to send me your
> metamodel or a sample grammar, I'll have a look at it.
>
> Regarding your first question:
> There is no limit for the number of grammar elements, that I'm aware of.
>
> Regards,
> Sebastian
Re: Literals class is not created [message #485144 is a reply to message #485140] Thu, 10 September 2009 15:34 Go to previous messageGo to next message
Dana Wong is currently offline Dana WongFriend
Messages: 12
Registered: September 2009
Junior Member
Many thanks!
Re: Literals class is not created [message #485157 is a reply to message #485144] Thu, 10 September 2009 16:29 Go to previous messageGo to next message
Dana Wong is currently offline Dana WongFriend
Messages: 12
Registered: September 2009
Junior Member
Hello again

Without the generated literals class, is there a flag in the genmodel file so that my Generated Edit code does not reference the literals class?

Thanks again
Dana
Re: Literals class is not created [message #485170 is a reply to message #485157] Thu, 10 September 2009 17:05 Go to previous messageGo to next message
Ed Merks is currently online Ed MerksFriend
Messages: 29593
Registered: July 2009
Senior Member
Dana,

The generated edit code should reference it if it's not in the model.
I.e., both the generation of the interface and uses of it are keyed by
the same setting. Perhaps you need to regenerate the *.edit code?


Dana Wong wrote:
> Hello again
>
> Without the generated literals class, is there a flag in the genmodel
> file so that my Generated Edit code does not reference the literals
> class?
> Thanks again
> Dana
Re: Literals class is not created [message #485680 is a reply to message #485170] Mon, 14 September 2009 13:08 Go to previous messageGo to next message
Dana Wong is currently offline Dana WongFriend
Messages: 12
Registered: September 2009
Junior Member
Great, yes, thank you !
Re: Literals class is not created [message #1775585 is a reply to message #485680] Wed, 01 November 2017 18:49 Go to previous messageGo to next message
Thomas Trocha is currently offline Thomas TrochaFriend
Messages: 14
Registered: October 2011
Junior Member
Sry to reactivate this very old topic, but I am at the same point as Dana was. I have a quite big grammar and with adding one new element to some random enum the Literals-Class in the DSLPackage is not created anymore.

Ed Marks seemed to have the solution, but I can't follow:
Quote:
GenPackage has a "Literals Interface" property that's set to false by
default for very large models (to avoid exceeding byte code limits).
Initialize by Loading it similarly set to true for large models, again,
to avoid exceeding byte code limits.


I'm a bit lost here. When and where would I have to set this property(whereever I mayfind it) to true? I would guess somewhere in the mwe-file?

Help would be very appreciated.
Thx
Re: Literals class is not created [message #1775586 is a reply to message #1775585] Wed, 01 November 2017 19:02 Go to previous messageGo to next message
Thomas Trocha is currently offline Thomas TrochaFriend
Messages: 14
Registered: October 2011
Junior Member
Ok,...
I replace all the literal codeparts like this:

Before:
CampaignPackage.Literals.CONDITION_EMPLOYEE__FULL_NAME

After:
CampaignPackage.eINSTANCE.getConditionEmployee_FullName()


Is that correct?
Re: Literals class is not created [message #1775588 is a reply to message #1775586] Wed, 01 November 2017 19:22 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6073
Registered: July 2009
Senior Member
Hi

If you use a separate manually maintained *.ecore model then you set the option in the *.genmodel.

If you use auto-generated *.ecore models then you are at the mercy of the auto-generator.

I never use auto-generated models since I like to be in control rather than rely on idiomatic grammar cuteness to approximate the models I want.

Regards

Ed Willink
Re: Literals class is not created [message #1775590 is a reply to message #1775588] Wed, 01 November 2017 19:58 Go to previous messageGo to next message
Thomas Trocha is currently offline Thomas TrochaFriend
Messages: 14
Registered: October 2011
Junior Member
Yes, I do autogenerate everything. To be honest. Most of what's going on behind the surface is really magic for me. ;) And I pray everytime when I use "mvn package" that it will go through without problems. Otherwise I would be lost ;) Great project.
Re: Literals class is not created [message #1775622 is a reply to message #1775590] Thu, 02 November 2017 09:22 Go to previous message
Ed Merks is currently online Ed MerksFriend
Messages: 29593
Registered: July 2009
Senior Member
Yes, that will always be generated and is the correct (slightly less efficient) equivalent.
Previous Topic:Xbase doesn't bind overriden TypeConvertingCompiler
Next Topic:EmbeddedEditor in pure e4 application
Goto Forum:
  


Current Time: Thu Oct 18 01:02:30 GMT 2018

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

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

Back to the top