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

Bug 365045

Summary: sub-structuring terminals results in EOF error
Product: [Modeling] TMF Reporter: Robin <robin.niesters>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Robin CLA 2011-11-29 07:10:10 EST
Build Identifier: I20110613-1736

I use the grammar:

grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "hxxp://www.xtext.org/example/mydsl/MyDsl" 

Model:
	(entries+=Entry)*;
	
Entry :
	INFO_TOKEN_START
	info=Info 
	TOKEN_END;
	
Info:
	name=ID;

terminal TOKEN_START:
	'<TOKEN';
	
terminal TOKEN_START_CLOSE:
	'>';
	
terminal INFO_TOKEN_START:
	TOKEN_START MARKER Y_COORDINATE NON_ITALIC TOKEN_START_CLOSE;

terminal TOKEN_END:
	'</TOKEN>';
	
terminal MARKER:
	('startX=114.24' | 'startX=311.24');

terminal Y_COORDINATE:
	'startY=' INT '.' INT;
	
terminal NON_ITALIC:
	'italicAngle=0.0';

I get an "missing EOF at '<TOKEN'" error, when I run this grammar in a new Eclipse instance with the language instance:

<TOKEN startX=311.24 startY=431.84 italicAngle=0.0>asd</TOKEN>


Reproducible: Always

Steps to Reproduce:
1. make a new xtext project and use the above grammar
2. generate the code with MWE2 workflow
3. run as new Eclipse instance
4. make a new project containing a .mydsl-file which contains the line "<TOKEN startX=311.24 startY=431.84 italicAngle=0.0>asd</TOKEN>" and add the xtext nature to the project
5. the error is shown
Comment 1 Sebastian Zarnekow CLA 2011-11-29 07:13:09 EST
Please note that terminal rules are order dependent (see the docs). I bet that INFO_TOKEN_START is never matched - it does not even state that a space (' ') is allowed. You should consider to use data type rules instead and refer to the docs for details.