Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344706 - [xbase] make sure semantically mandatory parenthesis are preserved during serialization
Summary: [xbase] make sure semantically mandatory parenthesis are preserved during ser...
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-04 09:53 EDT by Moritz Eysholdt CLA
Modified: 2017-10-31 11:26 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Eysholdt CLA 2011-05-04 09:53:07 EDT
Example:

---
(if (false) new Double('-10') else new Integer('1')).compareTo(1)
---

here, the parenthesis surrounding the if-statement are not mandatory according to the grammar's precedence hierarchy. Therefore, they don't get serialized by default. However, they must be preserved since leaving them out would change the semantics.
Comment 1 Moritz Eysholdt CLA 2011-05-12 20:36:49 EDT
tests are green now.

please review 
org.eclipse.xtext.xbase.tests.serializer.SerializerTest.testSerialize_02()
and
org.eclipse.xtext.xbase.serializer.XbaseSyntacticSequencer.emit_XParenthesizedExpression_LeftParenthesisKeyword_0_a(EObject, ISynTransition, INode, INode)
Comment 2 Moritz Eysholdt CLA 2011-05-16 04:36:29 EDT
reviewing this on Friday unveiled that the hooks for syntactic ambiguities in the generated code should not include scenarios that are ambiguous that can be solved via the RuleCallStack when traversing a PDA.

Futhermore, xbase still has more scenarios where a "(" need to be mandatory than the code handles yet. Sebastian also pointed out, that there are scenarios where a ";" is mandatory.
Comment 3 Moritz Eysholdt CLA 2011-07-29 09:11:53 EDT
(In reply to comment #2)
> reviewing this on Friday unveiled that the hooks for syntactic ambiguities in
> the generated code should not include scenarios that are ambiguous that can be
> solved via the RuleCallStack when traversing a PDA.

This is fixed now. The callbacks generated in the AbstractXbaseSyntacticSequencer are now exactly the way they are supposed to be.

> Futhermore, xbase still has more scenarios where a "(" need to be mandatory
> than the code handles yet. Sebastian also pointed out, that there are scenarios
> where a ";" is mandatory.

Let's come up with a complete list of scenarios in which
- "(" is mandatory but not enforced by the precedence hierarchy in the grammar.
- ";" is mandatory but not enforced by the grammar.
Comment 4 Sebastian Zarnekow CLA 2011-11-09 14:42:37 EST
Are there still remaining issues, Moritz?
Comment 5 Sebastian Zarnekow CLA 2011-11-22 05:27:09 EST
(In reply to comment #4)
> Are there still remaining issues, Moritz?

Ping.
Comment 6 Moritz Eysholdt CLA 2011-11-23 03:44:01 EST
(In reply to comment #4)
> Are there still remaining issues, Moritz?

(In reply to comment #3)
> Let's come up with a complete list of scenarios in which
> - "(" is mandatory but not enforced by the precedence hierarchy in the grammar.
> - ";" is mandatory but not enforced by the grammar.

we still don't have this list. All these scenarios need to be handeld in 
o.e.x.xbase.serializer.XbaseSyntacticSequencer.emit_XParenthesizedExpression_LeftParenthesisKeyword_0_a(...)
Comment 7 Moritz Eysholdt CLA 2011-11-23 03:45:13 EST
and by overriding 
o.e.x.xbase.serializer.AbstractXbaseSyntacticSequencer.emit_XBlockExpression_SemicolonKeyword_2_1_q()
Comment 8 Sven Efftinge CLA 2012-11-21 04:47:30 EST
We should open individual bugs instead of waiting for a list.
Comment 9 Eclipse Webmaster CLA 2017-10-31 11:26:26 EDT
Requested via bug 522520.

-M.