Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317840 - Unexpected behavior of hidden()
Summary: Unexpected behavior of hidden()
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-24 11:09 EDT by Moritz Eysholdt CLA
Modified: 2017-09-19 16:36 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: helios+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Eysholdt CLA 2010-06-24 11:09:51 EDT
With the following grammar:

--------
Model:
  greetings+=Greeting*;

Greeting:
  "Hello" name=NAME single=NAME? (double+=NAME double+=NAME)*;

NAME hidden():
  ID ('.' ID)*;
--------

The document "Hello foo bar" raises the error "mismatched input ' ' expecting RULE_ID". The the whitespace it complains about it the one between foo and bar.

Same for "Hello foo bar zzz" and the whitespace between bar and zzz.
Same for "Hello foo bar zzz yyy" and the whitespaces between (foo and bar) + (zzz and yyy).


The grammar works as intended if "hidden()" is omitted. 

The cause for this error could be that the range of suppressed hidden tokens is larger than just within NAME. However, this explanation seems to be contradictory to "Greeting: 'Hello' name=NAME single=NAME?;" being perfectly able to parse "Hello foo bar".
Comment 1 Sebastian Zarnekow CLA 2010-06-24 11:16:04 EDT
Hidden tokens are implemented by means of Antlr actions. If the parser is in the lookahead mode, it will not invoke these actions and thereby use the tokens from the wrong channel and refuse to choose one or another alternative.

I don't think that there is a general workaround.
Comment 2 Sebastian Zarnekow CLA 2010-06-25 12:00:50 EDT
Scheduled for SR1 to ensure that we have a look at this problem.
Comment 3 Sebastian Zarnekow CLA 2010-07-22 08:46:24 EDT
Fixed the described issue in HEAD. However, other things remain annoying with the handling of hidden tokens which will be filed as a new ticket.
Comment 4 Karsten Thoms CLA 2017-09-19 16:36:35 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.