Skip to main content



      Home
Home » Modeling » TMF (Xtext) » SerializationFragment generating bad code when grammar mixin
SerializationFragment generating bad code when grammar mixin [message #878273] Mon, 28 May 2012 20:50 Go to next message
Eclipse UserFriend
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: Mon, 28 May 2012 20:52] by Moderator

Re: SerializationFragment generating bad code when grammar mixin [message #878333 is a reply to message #878273] Tue, 29 May 2012 01:13 Go to previous messageGo to next message
Eclipse UserFriend
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 05:27 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

you have to set generatestubs to true in the base languages serializerfragment
Re: SerializationFragment generating bad code when grammar mixin [message #878438 is a reply to message #878425] Tue, 29 May 2012 05:53 Go to previous messageGo to next message
Eclipse UserFriend
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 06:20 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: SerializationFragment generating bad code when grammar mixin [message #878714 is a reply to message #878447] Tue, 29 May 2012 15:41 Go to previous messageGo to next message
Eclipse UserFriend
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] Tue, 29 May 2012 23:07 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 16:42:58 EDT 2025

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

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

Back to the top