Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » SerializationFragment generating bad code when grammar mixin
SerializationFragment generating bad code when grammar mixin [message #878273] Tue, 29 May 2012 00:50 Go to next message
James Leskovar is currently offline James LeskovarFriend
Messages: 2
Registered: May 2011
Junior Member
Hi there,

Not sure if this was a bug, or if I was just doing something wrong, but I noticed when I'm using a super grammar A from grammar B, and I run the MWE workflow for grammar B, I get a compilation error in AbstractGrammarBSemanticSequencer.java. The failure is with the superSequencerProvider and superSequencer member variables, which are declared with a type that doesn't exist. The type that the serialization fragment generates is "GrammarASemanticSequencer", whereas the class that gets generated by GrammarA's workflow is "AbstractGrammarASemanticSequencer".

I've worked around this temporarily by creating a GrammarASemanticSequencer that extends AbstractGrammarASemanticSequencer.

[Updated on: Tue, 29 May 2012 00:52]

Report message to a moderator

Re: SerializationFragment generating bad code when grammar mixin [message #878333 is a reply to message #878273] Tue, 29 May 2012 05:13 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6934
Registered: July 2009
Senior Member
Hi

Some issues with derived grammars have been fixed recently, but with a
temporary hiccough for those following N-builds. Make sure you are using
at least Juno RC1.

Regards

Ed Willink


On 29/05/2012 01:50, Missing name Mising name wrote:
> Hi there,
>
> Not sure if this was a bug, or if I was just doing something wrong,
> but I noticed when I'm using a super grammar A from grammar B, and I
> run the MWE workflow for grammar B, I get a compilation error
> AbstractGrammarBSemanticSequencer.java. The failure is with the
> superSequencerProvider and superSequencer member variables, which are
> declared with a type that doesn't exist. The type that the
> serialization fragment generates is "GrammarASemanticSequencer",
> whereas the class that gets generated by GrammarA's workflow is
> "AbstractGrammarASemanticSequencer".
>
> I've worked around this temporarily by creating a
> GrammarASemanticSequencer that extends AbstractGrammarASemanticSequencer.
Re: SerializationFragment generating bad code when grammar mixin [message #878425 is a reply to message #878333] Tue, 29 May 2012 09:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13662
Registered: July 2009
Senior Member
Hi,

you have to set generatestubs to true in the base languages serializerfragment


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: SerializationFragment generating bad code when grammar mixin [message #878438 is a reply to message #878425] Tue, 29 May 2012 09:53 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6934
Registered: July 2009
Senior Member
Hi Christian

I don't do that. Do I get away with it because my base language is a
language in its own right?

Regards

Ed Willink

On 29/05/2012 10:27, Christian Dietrich wrote:
> Hi,
>
> you have to set generatestubs to true in the base languages
> serializerfragment
Re: SerializationFragment generating bad code when grammar mixin [message #878447 is a reply to message #878438] Tue, 29 May 2012 10:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13662
Registered: July 2009
Senior Member
hi,

xtext 2.2 does not create the non abstract class. you have to set the flag to get it generated and thus the sublanguage working.
in xtext 2.3 there seems to be a AbstractDelegatingSemanticSequencer that solves the problem.

~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: SerializationFragment generating bad code when grammar mixin [message #878714 is a reply to message #878447] Tue, 29 May 2012 19:41 Go to previous messageGo to next message
Moritz Eysholdt is currently offline Moritz EysholdtFriend
Messages: 161
Registered: July 2009
Location: Kiel, Germany
Senior Member
hi,

The expected behavior (with RC1) is as follows:

- The flags of the SerializerFragment "generateSub" and "srcGenOnly" do the same. generateStub == !srcGenOnly
- with generateSub enabled, there is a MyLangSemanticSequencer generated in the src folder and an AbstractMyLangSemanticSequencer in the src-gen folder. MyLangSemanticSequencer extends AbstractMyLangSemanticSequencer.
- with generateSub disabled, there is a MyLangSemanticSequencer generated in the src-gen folder. Nothing is generated for the src folder. No AbstractMyLangSemanticSequencer is generated.
- In any case, the MyLangSemanticSequencer is bound in the MyLanguageRuntimeModule.
- If MyLang has sublanguages, the sublanguages' semantic sequencer are expected to subclass MyLangSemanticSequencer.

The SyntacticSequencer behaves analog to this.

If you observer behavior that differs from my description please let me know because it's likely to be a bug.

regards,
Moritz
Re: SerializationFragment generating bad code when grammar mixin [message #878833 is a reply to message #878714] Wed, 30 May 2012 03:07 Go to previous message
James Leskovar is currently offline James LeskovarFriend
Messages: 2
Registered: May 2011
Junior Member
Hi there,

Setting the generateStub option in the super grammar's workflow ended up working for me. Perhaps I should RTFM next time, haha Smile
Thanks for the help
Previous Topic:Special signs in parser pules
Next Topic:Generate Diagramm of EMF out of Xtext??
Goto Forum:
  


Current Time: Mon Nov 30 09:03:29 GMT 2020

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

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

Back to the top