Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Handling terminals without assigned feature, for code generation
Handling terminals without assigned feature, for code generation [message #1791796] Thu, 05 July 2018 08:31 Go to next message
Eclipse UserFriend
In my DSL expression, I can use brackets (), like 2*( 3 + (1+2)), which I don't have a defined feature in my grammar, but I want to make use of it in my code generator to convert it, for instance, to squared brackets or so. Would there be a possibility to handle this brackets without assigning them to a feature?
Re: Handling terminals without assigned feature, for code generation [message #1792126 is a reply to message #1791796] Thu, 12 July 2018 00:33 Go to previous message
Eclipse UserFriend
Hi,

you can do two things:

- in the generator you can test if the binary expression has a lower precedence than the one that it is enclosed by and the generate it with parentesis.
- you can use org.eclipse.xtext.nodemodel.util.NodeModelUtils.findActualNodeFor(EObject) to find the node model and traverse it to see if there where ( )

[Updated on: Thu, 12 July 2018 00:52] by Moderator

Previous Topic:RPGLE - String Literal Parsing
Next Topic:(xtext) Grammar's problem
Goto Forum:
  


Current Time: Tue Jun 17 03:49:32 EDT 2025

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

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

Back to the top