Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Strip comments during serialization?
Strip comments during serialization? [message #1137216] Mon, 14 October 2013 10:37 Go to next message
Ian Warwick is currently offline Ian WarwickFriend
Messages: 44
Registered: April 2012
Member
In my DSL I code gen some part of the AST verbatim, however I do not want to serialize single line or multiline comments.

What is the easiest way to tell the serializer to ignore serializing certain tokens such as comments? I tried looking into ICommentAssociator but do not see a place where this is bootstrapped in the generated DI module.

Any heads up on this would be greatly appreciated!

Regards,

Ian
Re: Strip comments during serialization? [message #1137340 is a reply to message #1137216] Mon, 14 October 2013 12:22 Go to previous messageGo to next message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
Hi Ian,

At least in my DSL, these lines are ignored.
I think comments (single line and multy line) are ignored because they are "hidden".

My Grammar starts:
grammar de.ulrichmerkel.umecif1.UmeCif1 with org.eclipse.xtext.common.Terminals
generate umeCif1 "http://www.ulrichmerkel.de/umecif1/UmeCif1"

And the referenced Terminals hold the hidden:
grammar org.eclipse.xtext.common.Terminals hidden(WS, ML_COMMENT, SL_COMMENT)

Re: Strip comments during serialization? [message #1137362 is a reply to message #1137340] Mon, 14 October 2013 12:41 Go to previous messageGo to next message
Ian Warwick is currently offline Ian WarwickFriend
Messages: 44
Registered: April 2012
Member
Hi Uli,

Same as that I also use Terminals as my base grammar but still comments are associated to some grammar elements when the model is serialized using the xtext Serializer, are you explicitly using the Serializer in your project?

Regards,

Ian

Re: Strip comments during serialization? [message #1137632 is a reply to message #1137362] Mon, 14 October 2013 16:27 Go to previous message
Uli Merkel is currently offline Uli MerkelFriend
Messages: 248
Registered: June 2013
Senior Member
Ian Warwick wrote on Mon, 14 October 2013 08:41
are you explicitly using the Serializer in your project?


Hi Ian,
no I don't use it explicitly

As a xtext novice, I often do not see the importance of hints specified in the posts, just like the Serialiser in your one.

But I'm improving ...
Uli

[Updated on: Mon, 14 October 2013 17:21]

Report message to a moderator

Previous Topic:multiple line string terminal in xtext
Next Topic:Appending notifiyObservers call to a XBlockExpression using jvmInferrer
Goto Forum:
  


Current Time: Sun Jul 12 14:19:52 GMT 2020

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

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

Back to the top