Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343940 - ANTLR warning: Multiple token rules can match input such as ...
Summary: ANTLR warning: Multiple token rules can match input such as ...
Status: CLOSED WORKSFORME
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.1   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-27 06:18 EDT by Olaf Bigalk CLA
Modified: 2017-09-19 17:05 EDT (History)
1 user (show)

See Also:


Attachments
project folder for the attached grammar (5.88 KB, application/octet-stream)
2011-04-27 06:21 EDT, Olaf Bigalk CLA
no flags Details
Logfile with the ANTLR warnings (11.80 KB, text/plain)
2011-04-27 06:21 EDT, Olaf Bigalk CLA
no flags Details
Plain grammar file (5.04 KB, text/plain)
2011-05-02 10:48 EDT, Olaf Bigalk CLA
no flags Details
Logfile documenting the remaining ANTLR warnings (16.69 KB, text/plain)
2011-05-03 08:39 EDT, Olaf Bigalk CLA
no flags Details
The involved workflowfile (2.91 KB, text/plain)
2011-05-03 08:42 EDT, Olaf Bigalk CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olaf Bigalk CLA 2011-04-27 06:18:52 EDT
Build Identifier: 20100917-0705

The attached grammar produces ANTLR warnings. But when you comment out an arbitrary line from the grammar(leaving a valid grammar) the warnings disappear.



Reproducible: Always

Steps to Reproduce:
1. Run the GenerateMyDsl003.mwe2 workflow
2. ANTLR warnings appear as in the attached logfile.
Comment 1 Olaf Bigalk CLA 2011-04-27 06:21:14 EDT
Created attachment 194138 [details]
project folder for the attached grammar

This attachment is the project folder of the attached grammar.
Comment 2 Olaf Bigalk CLA 2011-04-27 06:21:58 EDT
Created attachment 194139 [details]
Logfile with the ANTLR warnings
Comment 3 Sebastian Zarnekow CLA 2011-05-02 09:19:13 EDT
I did not find the time to look at the attached archive but could this one be related to http://20000frames.blogspot.com/2010/09/dealing-with-could-not-even-do-k1-for.html
Comment 4 Olaf Bigalk CLA 2011-05-02 10:21:40 EDT
I tried the mentioned antlParameter but they did not fix the problem.
I guess the problem is different. The warnings talk about "Multiple token rules can match input such as..." which seems to be a problem of ambiguous token path in the grammar rules.

Is it possible to tell ANTLR to take a given lookahead token count for an Xtext grammar?

Irritating is also that every conflict contains the token rule RULE_ANY_OTHER which matches any character. But this rule seems to be added by Xtext or ANTLR.
I did not use this rule explicitly.
Comment 5 Sebastian Zarnekow CLA 2011-05-02 10:44:33 EDT
The archive does not contain your grammar. Please attach it as plain text. Thanks.
Comment 6 Olaf Bigalk CLA 2011-05-02 10:47:06 EDT
The archive contains two complet eclipse projects where one contains the grammar.
I added the complete project folders enableing you to start from scratch.
But I can attach the plain grammar too.
Comment 7 Olaf Bigalk CLA 2011-05-02 10:48:07 EDT
Created attachment 194497 [details]
Plain grammar file
Comment 8 Sebastian Zarnekow CLA 2011-05-02 10:58:03 EDT
I created a new Xtext 1.0.1 project and pasted the grammar into the Xtext editor. The generation went flawlessly (see log output below).

Did you customize the mwe2 workflow?


Log:

0    [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Registering platform uri '/development/java/eclipse/eclipse-3.6-ocl/ws'
796  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning /development/java/eclipse/eclipse-3.6-ocl/ws/org.xtext.example.mydsl/../org.xtext.example.mydsl/src-gen
797  [main] INFO  ipse.emf.mwe.utils.DirectoryCleaner  - Cleaning /development/java/eclipse/eclipse-3.6-ocl/ws/org.xtext.example.mydsl/../org.xtext.example.mydsl.ui/src-gen
946  [main] INFO  ipse.xtext.generator.LanguageConfig  - generating infrastructure for org.xtext.example.mydsl.MyDsl with fragments : ImplicitRuntimeFragment, ImplicitUiFragment, GrammarAccessFragment, EcoreGeneratorFragment, ParseTreeConstructorFragment, ResourceFactoryFragment, XtextAntlrGeneratorFragment, JavaValidatorFragment, ImportNamespacesScopingFragment, QualifiedNamesFragment, BuilderIntegrationFragment, FormatterFragment, LabelProviderFragment, TransformerFragment, OutlineNodeAdapterFactoryFragment, QuickOutlineFragment, QuickfixProviderFragment, JavaBasedContentAssistFragment, XtextAntlrUiGeneratorFragment
17022 [main] INFO  or.validation.JavaValidatorFragment  - executing generate for org.eclipse.xtext.generator.validation.JavaValidatorFragment
25174 [main] INFO  .emf.mwe2.runtime.workflow.Workflow  - Done.
Comment 9 Olaf Bigalk CLA 2011-05-03 08:37:38 EDT
I updated my Xtext plugins to version 1.0.1 via the eclipse update feature.
I created a new Xtext project and pasted the grammar to the xtext file.
But the problem remains and got even worse(see logfile2).
What did I wrong?
Comment 10 Olaf Bigalk CLA 2011-05-03 08:39:43 EDT
Created attachment 194567 [details]
Logfile documenting the remaining ANTLR warnings
Comment 11 Olaf Bigalk CLA 2011-05-03 08:42:00 EDT
Created attachment 194569 [details]
The involved workflowfile
Comment 12 Sebastian Zarnekow CLA 2011-05-03 09:26:20 EDT
You have to increase the heap size for the generator process. See the log:

...
Caused by: java.lang.OutOfMemoryError: Java heap space
...
Comment 13 Olaf Bigalk CLA 2011-05-03 10:52:44 EDT
Where can I configure the heap size for the generator process?
I guess it's not a heap size problem but an endless recursion.
Comment 14 Sebastian Zarnekow CLA 2011-05-03 15:51:21 EDT
(In reply to comment #13)
> Where can I configure the heap size for the generator process?
> I guess it's not a heap size problem but an endless recursion.

Same as for any other Eclipse launch configuration. Go to your Run Configurations and add vm option -Xmx512m.
Comment 15 Olaf Bigalk CLA 2011-05-03 19:17:35 EDT
Thank you that option did help. You can close the issue.
Comment 16 Karsten Thoms CLA 2017-09-19 16:55:02 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 17 Karsten Thoms CLA 2017-09-19 17:05:53 EDT
Closing all bugs that were set to RESOLVED before Neon.0