Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [SOLVED] forbit brackets in xbase expression
[SOLVED] forbit brackets in xbase expression [message #1728744] Wed, 06 April 2016 18:21 Go to next message
Eclipse UserFriend
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 03:16] by Moderator

Re: forbit brackets in xbase expression [message #1728831 is a reply to message #1728744] Thu, 07 April 2016 13:14 Go to previous messageGo to next message
Eclipse UserFriend
you may use nodemodelutils and traverse the expression.
you should not find nodes for the ( and ) keyword
Re: forbit brackets in xbase expression [message #1728872 is a reply to message #1728831] Fri, 08 April 2016 03:15 Go to previous message
Eclipse UserFriend
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: Tue Jul 08 15:45:41 EDT 2025

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

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

Back to the top