Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Syntax Error in lambda implementing Xtext quickfixes
Syntax Error in lambda implementing Xtext quickfixes [message #1790980] Wed, 20 June 2018 18:40 Go to next message
Eclipse UserFriend
I am new to `Xtend/Xtext and am attempting to learn using the book Implementing Domain Specific Languages with Xtext and Xtend .The code shown below comes from Chapter 4, section Quickfixes for default validators.

I am using Xtext 2.14 on Eclipse Oxygen 3A running on up to date Windows 10 Insider Preview.

The attached image shows the problem. Xtend is complaining about the closing parenthesis in line 67, however it is needed to balance the opening parenthesis on the same line. Furthermore when I attempt to display matching parentheses, the closing parenthesis on Line 68 is shown as matching the opening parenthesis on line 57 instead of the opening parenthesis on line 65 which is the correct match.

If I remove the closing parenthesis on line 67 the code compiles successfully and I can run it successfully.

I tried, and failed, to produce a simpler test case but all my attempts worked successfully. Is this a problem I am unable to see or is this a bug?

[Updated on: Wed, 20 June 2018 20:29] by Moderator

Re: Syntax Error in lambda implementing Xtext quickfixes [message #1790984 is a reply to message #1790980] Thu, 21 June 2018 00:15 Go to previous message
Eclipse UserFriend
Hi can you please post the code here.
Counting parens in a screenshot is pita
here is a working greeting example

	@Fix(MyDslValidator.INVALID_NAME)
	def capitalizeName(Issue issue, IssueResolutionAcceptor acceptor) {
		acceptor.accept(issue, 'Capitalize name', 'Capitalize the name.', 'upcase.png', [
			element, context |
			val currentGreeting = element as Greeting
			val model = element.eContainer as Model
			model.greetings.add(model.greetings.indexOf(currentGreeting)+1,MyDslFactory.eINSTANCE.createGreeting=>[
				name = currentGreeting.name.toFirstUpper
			])
		])
	}


did you try to open and close the editor?

[Updated on: Thu, 21 June 2018 00:29] by Moderator

Previous Topic:OneOf
Next Topic:XtextLinkingDiagnostic Error while loading xtext model
Goto Forum:
  


Current Time: Fri Jun 20 19:03:32 EDT 2025

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

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

Back to the top