Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 341647

Summary: [Formatter] The ElementMatcher's state machine is not initialized properly
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 Flags: moritz.eysholdt: indigo+
Version: unspecified   
Target Milestone: M7   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Moritz Eysholdt CLA 2011-04-01 12:41:38 EDT
The ElementMatcher traverses the grammar while consuming the tokens from a document one by one. To stay on the correct path, the ElementMatcher maintains a stack of RuleCalls. 

However, the start-parserrule is unknown to ElementMatcher. Consequently, if RuleCalls occur *before* the first token, then they are not put on the stack.

Solution:
ParseTreeConstructor and DefaultNodeModelFormatter should propagate the Root-ParserRule to the formatter/ElementMatcher via the TokenStream. That way, the ElementMatcher can be initialized properly.