Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » completion proposal not work for nested XExpression
completion proposal not work for nested XExpression [message #1408280] Thu, 14 August 2014 16:58
tiange zhang is currently offline tiange zhangFriend
Messages: 16
Registered: February 2011
Location: Shanghai, China
Junior Member
I want to extend the entity definition language from Xtext documentation(Five simple steps to your JVM language) as:

entity e{
	firstName : String
	op setFirstName(String firstName) : void{
		checker:{name!=null} ⇐
		this.firstName = firstName.toFirstLower
	}
}


where "checker" is a customized expression and "{name!=null}" is a nested XExpression.
To do this, I append following to grammar:
XPrimaryExpression returns xbase::XExpression:
	XConstructorCall |
	XBlockExpression |
	XSwitchExpression |
	XSynchronizedExpression |
	XFeatureCall |
	XLiteral |
	XIfExpression |
	XForLoopExpression |
	XBasicForLoopExpression |
	XWhileExpression |
	XDoWhileExpression |
	XThrowExpression |
	XReturnExpression |
	XTryCatchFinallyExpression |
	XParenthesizedExpression |
	MyChecker 
;
MyChecker:
	'checker' ':' expression = XBlockExpression



I also implement the TypeComputer for MyChecker to avoid 'Missing type computation' exception.

But it seems that the completion proposal not work in 'checker:{ | }', expression contained in MyChecker rule can't reference it's outer scope.

Thanks very much.
Previous Topic:XTend integration within maven
Next Topic:How to call a model from another model
Goto Forum:
  


Current Time: Fri Apr 19 00:43:15 GMT 2024

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

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

Back to the top