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

Bug 347896

Summary: FileNotFound exception during generation
Product: [Modeling] TMF Reporter: Cedric Moonen <cedric_moonen>
Component: Xtext BacklogAssignee: Project Inbox <tmf.xtext-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: christian.dietrich.opensource, moritz.eysholdt, sebastian.zarnekow, sven.efftinge
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Errors and exception call stack
none
Complete grammar none

Description Cedric Moonen CLA 2011-06-01 05:32:47 EDT
Build Identifier: I20110512-2000

I am currently trying Xtext 2 (nightly builds:   2.0.0.v201105310915).

I have the following grammar element (not complete):

Module_Impl returns Module:
	'package' package=EString
	'Module' name=ID
	'{'
		(commands+=Command)*
	'}'
	((exposedInterfaces+=EventInterface)* &
	(errors+=Error)* &
	(dataTypes+=DataType)*);

When I run the workflow to generate the code for this grammar, the following error occurs in the console (see attachment 1 [details])

If I remove the parentheses in my grammar:
Module_Impl returns Module:
	'package' package=EString
	'Module' name=ID
	'{'
		(commands+=Command)*
	'}'
	(exposedInterfaces+=EventInterface)* &
	(errors+=Error)* &
	(dataTypes+=DataType)*;

Then no exception occurs but I still have those errors:
warning(200): ../be.picanol.moduleDSL.xtext.pm.ui/src-gen/be/picanol/moduleDSL/xtext/pm/ui/contentassist/antlr/internal/InternalModule.g:2893:45: Decision can match input such as "'error' RULE_ID" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.
warning(200): ../be.picanol.moduleDSL.xtext.pm.ui/src-gen/be/picanol/moduleDSL/xtext/pm/ui/contentassist/antlr/internal/InternalModule.g:2915:48: Decision can match input such as "'dataType' RULE_ID" using multiple alternatives: 1, 2
As a result, alternative(s) 2 were disabled for that input
Semantic predicates were present but were hidden by actions.

Removing the '&' characters solves all errors. This grammar was producing no errors with Xtext 1.0.1


Reproducible: Always
Comment 1 Cedric Moonen CLA 2011-06-01 05:34:08 EDT
Created attachment 197073 [details]
Errors and exception call stack
Comment 2 Moritz Eysholdt CLA 2011-06-01 05:37:55 EDT
sounds like your grammar is ambiguous. Could you attach the complete grammar?
Comment 3 Cedric Moonen CLA 2011-06-01 06:14:36 EDT
Created attachment 197078 [details]
Complete grammar
Comment 4 Cedric Moonen CLA 2011-06-01 06:16:15 EDT
(In reply to comment #2)
> sounds like your grammar is ambiguous. Could you attach the complete grammar?

This grammar was working fine with Xtext 1.0 (it's still work in progress but no errors were generated and I had an editor for it).
Comment 5 Sebastian Zarnekow CLA 2011-06-01 08:56:08 EDT
I cannot reproduce the problem with your grammar (modified it to use a generated metamodel instead of an imported metamodel).
Comment 6 Sebastian Zarnekow CLA 2011-06-01 08:57:47 EDT
I did not recognize that the attached grammar does not use unordered groups. Will try again ...
Comment 7 Sebastian Zarnekow CLA 2011-06-01 09:16:57 EDT
I can reproduce the issue with a simplified version of the grammar:

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

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

Model:
	(
		(a+=A)* &
		(b+=B)* &
		(c+=C)*
	);

A:
  'a' name=ID;

B:
  'b' name=ID;
  
C:
  'c' name=ID;
Comment 8 Sebastian Zarnekow CLA 2011-06-01 09:23:56 EDT
Note that the simplified example leads to warnings instead of errors thus the FileNotFoundException does not occur. However, it should not lead to warnings in the generated parsers.
Comment 9 Sven Efftinge CLA 2011-09-26 09:14:23 EDT
not 2.1
Comment 10 Christian Dietrich CLA 2016-08-17 06:59:13 EDT
can no be reproduced with xtext 2.8.4 (old workflow) and xtext 2.10 (new workflow)