Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » generated EPackage's Literals not generated; why?
generated EPackage's Literals not generated; why? [message #705803] Sat, 30 July 2011 11:38 Go to next message
John J. Franey is currently offline John J. FraneyFriend
Messages: 55
Registered: July 2009
Member
The EPackage interface generated by xtext on my dsl ('MyDslPackage extends EPackage' does not contain the 'Literals' public static field and so the whole project fails to compile.

There are no error messages or standard output that helps me understand why.

I commented out some of my dsl until it was generated again. In this way, I hoped to find some error on a line of my grammar. No, I didn't. Instead, I have the opinion that the problem is related to the number of grammar rules; I don't have the option to reduce the number of rules.

What can I look for to debug this issue?

(no subject) [message #705810 is a reply to message #705803] Sat, 30 July 2011 11:52 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7107
Registered: July 2009
Senior Member
Hi

Are you sure that the "Literals Interface" property in your genmodel is
"true".

Xtext's ability to auto-generate an Ecore model is very convenient when
starting, but once your grammar grows or you want more stability for
evolution it can be better to define the model manually and import it
into Xtext.

Regards

Ed Willink

On 30/07/2011 12:38, John J. Franey wrote:
> The EPackage interface generated by xtext on my dsl ('MyDslPackage
> extends EPackage' does not contain the 'Literals' public static field
> and so the whole project fails to compile.
>
> There are no error messages or standard output that helps me
> understand why.
>
> I commented out some of my dsl until it was generated again. In this
> way, I hoped to find some error on a line of my grammar. No, I
> didn't. Instead, I have the opinion that the problem is related to
> the number of grammar rules; I don't have the option to reduce the
> number of rules.
>
> What can I look for to debug this issue?
>
>
(no subject) [message #705934 is a reply to message #705803] Sat, 30 July 2011 15:46 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3109
Registered: July 2009
Senior Member
Hi John,

if your EPackage becomes too large, the Literals may be skipped by the
genmodel generator because it may exceed the maximum size for class
files. You may want to use
MyDslPackage.eInstance.getClassName_FeatureName instead.

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

On 30.07.11 13:38, John J. Franey wrote:
> The EPackage interface generated by xtext on my dsl ('MyDslPackage
> extends EPackage' does not contain the 'Literals' public static field
> and so the whole project fails to compile.
>
> There are no error messages or standard output that helps me understand
> why.
>
> I commented out some of my dsl until it was generated again. In this
> way, I hoped to find some error on a line of my grammar. No, I didn't.
> Instead, I have the opinion that the problem is related to the number of
> grammar rules; I don't have the option to reduce the number of rules.
>
> What can I look for to debug this issue?
>
>
Re: (no subject) [message #706042 is a reply to message #705934] Sat, 30 July 2011 19:30 Go to previous messageGo to next message
John J. Franey is currently offline John J. FraneyFriend
Messages: 55
Registered: July 2009
Member
Excellent. Thanks for your time for responding.

Ed: Just for the sake of completing my question, I should say that I took the default setting for 'use Literal Interface'. In early stages of developing the grammar, things worked fine. I have looked in my genmodel for 'use Literals Interface' and don't see it. So, I think the default is active and I guess that default is 'true'.

Quote:
"Xtext's ability to auto-generate an Ecore model is very convenient when starting, but once your grammar grows or you want more stability for evolution it can be better to define the model manually and import it into Xtext"


This comment is more than I can handle right now. Count me as still starting. I've invested time to learn the xtext grammar -- now I don't need it? I say: Huh? I didn't see that coming.


Sebastion: Ok. This explanation makes sense. How can I tell the generator to use MyDslPackage.eInstance.getClassName_FeatureName when it generates: AbstractMyDslSemanticSequencer? There are multitude of references to Literals in this file. Do you suggest I edit manually?
Re: (no subject) [message #706050 is a reply to message #706042] Sat, 30 July 2011 19:48 Go to previous messageGo to next message
John J. Franey is currently offline John J. FraneyFriend
Messages: 55
Registered: July 2009
Member
Oh, also: What number (or range) of Rules do you think is 'too big' for either: 1) this effect of not generating Literals occurs, and 2) things are more supportable by editing ecore directly. I have about 130.
Re: (no subject) [message #706090 is a reply to message #706050] Sat, 30 July 2011 20:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31847
Registered: July 2009
Senior Member
John,

As a point of reference, when a GenModel (and hence a GenPackage) are
first created, GenPackageImpl.isBigModel calculates how many things are
in the model:

return (classes + supers + features + operations + parameters +
exceptions + enums + literals + datatypes) > 500;

This gives it a rough idea of how many things in the Literals interface
and when it's likely to be too many (along with whether it's likely the
package initialization logic will be too large).

boolean isBigModel = isBigModel();
setLoadInitialization(isBigModel);
setLiteralsInterface(!isBigModel);



On 30/07/2011 12:48 PM, John J. Franey wrote:
> Oh, also: What number (or range) of Rules do you think is 'too big'
> for either: 1) this effect of not generating Literals occurs, and 2)
> things are more supportable by editing ecore directly. I have about 130.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: (no subject) [message #706144 is a reply to message #706042] Sat, 30 July 2011 22:33 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3109
Registered: July 2009
Senior Member
Hi John,

the invalid Literals access is already fixed in the latest nightly
builds. Please expect 2.0.1 to be out in a couple of days. Meanwhile,
you could disable the SerializerFragment in the workflow and use the
ParsetreeConstructorFragment instead.

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

On 30.07.11 21:30, John J. Franey wrote:
> Excellent. Thanks for your time for responding.
>
> Ed: Just for the sake of completing my question, I should say that I
> took the default setting for 'use Literal Interface'. In early stages of
> developing the grammar, things worked fine. I have looked in my genmodel
> for 'use Literals Interface' and don't see it. So, I think the default
> is active and I guess that default is 'true'.
>
> Quote:
>> "Xtext's ability to auto-generate an Ecore model is very convenient
>> when starting, but once your grammar grows or you want more stability
>> for evolution it can be better to define the model manually and import
>> it into Xtext"
>
>
> This comment is more than I can handle right now. Count me as still
> starting. I've invested time to learn the xtext grammar -- now I don't
> need it? I say: Huh? I didn't see that coming.
>
>
> Sebastion: Ok. This explanation makes sense. How can I tell the
> generator to use MyDslPackage.eInstance.getClassName_FeatureName when it
> generates: AbstractMyDslSemanticSequencer? There are multitude of
> references to Literals in this file. Do you suggest I edit manually?
>
Re: (no subject) [message #706199 is a reply to message #706144] Sun, 31 July 2011 01:00 Go to previous message
John J. Franey is currently offline John J. FraneyFriend
Messages: 55
Registered: July 2009
Member
Thank you.
Previous Topic:[Xtext2.0] Validation
Next Topic:[Xtend] Increase a postfix in a for loop
Goto Forum:
  


Current Time: Thu Apr 22 10:30:17 GMT 2021

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

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

Back to the top