Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem with serializer comment insertion
Problem with serializer comment insertion [message #1705808] Wed, 19 August 2015 10:34
Chris Bryan is currently offline Chris BryanFriend
Messages: 12
Registered: June 2015
Junior Member
I'm having problems with the serializer inserting comments. I'm using the standard "SL_COMMENT" and "ML_COMMENT" rules. As an example, my SL_COMMENT rule is:
terminal SL_COMMENT:
	'--' !('\n' | '\r')* ('\r'? '\n')?;


A single comment in this place is missing in the serialized output:
Input:
suite "mysuite" is
	-- single-line-comment
	subprogram x() is end subprogram;
end suite;

Output:
suite "mysuite" is
	subprogram x ( ) is
	end subprogram;
end suite;


But placing is here causes a duplication:
Input:
suite "mysuite" is
	subprogram x() is end subprogram;
	-- single-line-comment
end suite;

Output:
suite "mysuite" is -- single-line-comment
	subprogram x ( ) is
	end subprogram; -- single-line-comment
end suite;


Finally, placing the comment inside the 'subprogram' element works as expected:
suite "mysuite" is
	subprogram x ( ) is -- single-line-comment
	end subprogram;
end suite;


The "Suite" rule is pretty straightforward:
Suite:
	'suite' name=STRING 'is'
		subprograms+=Subprogram*
		'end' 'suite' ';'
;


Any thoughts? I don't think that I've overriden any of the relevant classes.
Previous Topic:how to parse a xtext grammar
Next Topic:How to get storable resources to work?
Goto Forum:
  


Current Time: Fri Apr 19 01:33:12 GMT 2024

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

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

Back to the top