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: 14661
Registered: July 2009
Senior Member
you may use nodemodelutils and traverse the expression.
you should not find nodes for the ( and ) keyword


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: Fri Mar 29 08:45:59 GMT 2024

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

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

Back to the top