Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Xtext/FAQ"

(New page: =Generator= == Why do I get warnings like "warning(200): InternalFoo.g:42:3: Decision can match input such as "..." using multiple alternatives: 1, 2 As a result, alternative(s) 2 were di...)
 
m
Line 1: Line 1:
=Generator=
+
= Generator =
  
 
== Why do I get warnings like "warning(200): InternalFoo.g:42:3: Decision can match input such as "..." using multiple alternatives: 1, 2 As a result, alternative(s) 2 were disabled for that input" when running the generator? ==
 
== Why do I get warnings like "warning(200): InternalFoo.g:42:3: Decision can match input such as "..." using multiple alternatives: 1, 2 As a result, alternative(s) 2 were disabled for that input" when running the generator? ==

Revision as of 09:34, 16 July 2009

Generator

Why do I get warnings like "warning(200): InternalFoo.g:42:3: Decision can match input such as "..." using multiple alternatives: 1, 2 As a result, alternative(s) 2 were disabled for that input" when running the generator?

These warnings are generated by the ANTLR code generator. Based on the rules in your grammar the ANTLR generated parser cannot disambiguate what rules to apply for a given input. You should try to refactor your grammar (see example) or you can enable backtracking for your parser (see next question).

OK, but I didn't get these warnings in oAW Xtext

Unlike in oAW Xtext the ANTLR grammar generated by TMF Xtext doesn't have backtracking enabled by default. To enable backtracking you have to add a nested element <options backtrack="true"/> to the ANTLR generator fragments in your Xtext project's MWE workflow. For example:

  <!-- Antlr Generator fragment -->
  <fragment class="org.eclipse.xtext.generator.AntlrDelegatingFragment">
      <options backtrack="true"/>
   </fragment>

Copyright © Eclipse Foundation, Inc. All Rights Reserved.