Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [SOLVED] forbit brackets in xbase expression
[SOLVED] forbit brackets in xbase expression [message #1728744] Wed, 06 April 2016 22:21 Go to next message
Michael BudnickFriend
Messages: 2
Registered: April 2016
Junior Member
Hello,

in my DSL I use the xbase XExpressions.
Under some conditions this expression should not allow brackets to change the order of operations.
So I will implement a @Check in my Validator-class.

How can I find out if a expression contains brackets?
I see the leftOperand and rightOperand but not if this operand is surrounded with brackets.

Thanks for any help,
Michael

[Updated on: Fri, 08 April 2016 07:16]

Report message to a moderator

Re: forbit brackets in xbase expression [message #1728831 is a reply to message #1728744] Thu, 07 April 2016 17:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14077
Registered: July 2009
Senior Member
you may use nodemodelutils and traverse the expression.
you should not find nodes for the ( and ) keyword


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: forbit brackets in xbase expression [message #1728872 is a reply to message #1728831] Fri, 08 April 2016 07:15 Go to previous message
Michael BudnickFriend
Messages: 2
Registered: April 2016
Junior Member
Thanks

	for (leaf: NodeModelUtils.findActualNodeFor(expression).leafNodes) {
		if ('('.equals(NodeModelUtils.getTokenText(leaf))) {
			errorBrackedNotAllowed()
		}
	}


solved it.
Previous Topic:Mixing grammars
Next Topic:Using EmbeddedEditor or XtextStyledTextCellEditor in table view
Goto Forum:
  


Current Time: Sun Oct 24 14:03:07 GMT 2021

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

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

Back to the top