Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Serializer overzealously inserts parentheses
Serializer overzealously inserts parentheses [message #1840774] Fri, 23 April 2021 14:04
Dimo Petroff is currently offline Dimo PetroffFriend
Messages: 15
Registered: November 2018
Junior Member
I have a left-factored expressions grammar with optional empty parameter lists and parenthesised expressions, but the serializer tends to parenthesise by default even when the parser does not need it.

The parser is perfectly happy with things like 1 * 1 + 1, however serialising a manually constructed AST representing the same parse result gives me (1 * 1) + 1. This is not incorrect, because the operator precedence is such, but the parentheses are not necessary, so it's not clear to me why the Serializer produces them.

I also have cases where the unnecessary and completely optional (in the grammar) empty parenthesis for an empty argument list of a feature call are serialised, although this is a corner case I'm struggling to reproduce in a minimal example even using my full grammar.

Unfortunately, I've not managed to produce a smaller grammar that expresses the problem yet, but I'm hoping someone has dealt with similar problems and can give some hits about where to look while I'm slowly whittling my actual grammar down to a minimal reproducible example that I can post.

[Updated on: Fri, 23 April 2021 14:07]

Report message to a moderator

Previous Topic:Missing folders when create xtext projects from existing ecore
Next Topic:Couldn't resolve reference to EClassifier 'XXX' in Xtext
Goto Forum:
  


Current Time: Sat Jul 31 13:37:25 GMT 2021

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

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

Back to the top