Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext2] Xtend RichStrings: Where is «REM»«ENDREM»?
[Xtext2] Xtend RichStrings: Where is «REM»«ENDREM»? [message #685762] Sun, 19 June 2011 15:14 Go to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi all,

I'm trying to migrate some templates from Xtext 1.0.1 and I cannot find a good way to outcomment some code in RichStrings.

What is the best way to exclude the 3 "result = ..." lines?

	def hashcode (CommonEquals equals, ImportManager importManager) '''
		/**
		 * @see java.lang.Object#hashCode()
		 */
		@Override
		public int hashCode() {
			final int prime = 31;
			int result = 1;
//			result = prime * result + ((date == null) ? 0 : date.hashCode());
//			result = prime * result + ((text == null) ? 0 : text.hashCode());
//			result = prime * result + ((value == null) ? 0 : value.hashCode());
			return result;
		}
	'''
Re: [Xtext2] Xtend RichStrings: Where is «REM»«ENDREM»? [message #685764 is a reply to message #685762] Sun, 19 June 2011 15:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

from the domain model example

def compile(Entity e) ''' 
		«val importManager = new ImportManager(true)»
		«/* first evaluate the body in order to collect the used types for the import section */
		val body = body(e, importManager)»
		«IF !(e.packageName.isNullOrEmpty)»
			package «e.packageName»;
			
		«ENDIF»
		«FOR i:importManager.imports»
			import «i»;
		«ENDFOR»
		
		«body»
	'''


so a «/* */» should do the trick

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 19 June 2011 15:42]

Report message to a moderator

Re: [Xtext2] Xtend RichStrings: Where is «REM»«ENDREM»? [message #685766 is a reply to message #685764] Sun, 19 June 2011 16:07 Go to previous messageGo to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Thanks Christian,

as I'm currently playing with the domain model example I should have seen that. Wink

Anyway a little bit strange that it only works with some "real" code in the brackets...
«/* first evaluate the body in order to collect the used types for the import section */
		val body = body(e, importManager)»

will work, but
«/* first evaluate the body in order to collect the used types for the import section */»

will not.
If you just want to comment out something this is the only chance so far, is it?
«/* outcommented code */''»
Re: [Xtext2] Xtend RichStrings: Where is «REM»«ENDREM»? [message #685767 is a reply to message #685766] Sun, 19 June 2011 16:17 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

seems so. maybe a candidate for a enhancement request into bugzilla.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:[Xtext] Xtext conflits with Eclipse ANTLR IDE plugin
Next Topic:Data type rules - Can someone explain this concept to me?
Goto Forum:
  


Current Time: Fri Mar 29 11:10:40 GMT 2024

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

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

Back to the top