Note that there are some explanatory texts on larger screens.

plurals
  1. POstring constants causing unexpected type collisions in xtext
    text
    copied!<p>I've boiled down the problem to a very simple grammar.</p> <pre><code>Model: (greetings+=Greeting* | greetings+=FrGreeting*); Greeting: 'Hello' person=ID '!'; FrGreeting: 'Bonjour' person=('jacques' | 'philippe') '!'; </code></pre> <p>In a file you can greet people in english or in french but not both. We only know the names of 2 french people.</p> <p>The problem is you cannot greet jacques in English.</p> <pre><code>Hello jacques! </code></pre> <p>results in <code>mismatched input 'jacques' expecting RULE_ID</code>. I am very confused at why this would be. How would I fix it?</p> <p><strong>edit:</strong> Doing something like this:</p> <pre><code>Greeting: 'Hello' person= AllNames '!'; FrGreeting: 'Bonjour' person=(FrenchNames) '!'; AllNames: ID | FrenchNames ; FrenchNames: 'jacques' | 'philippe'; </code></pre> <p>Fixes the compile error issue. However it prevents auto-complete from working, and <code>jacques</code> and <code>philippe</code> are still highlighted like keywords (even when written as <code>Hello jacques!</code>). </p> <p><strong>edit 2:</strong> This seems to fix the auto complete bug:</p> <pre><code>Greeting: 'Hello' person= AllNames '!'; FrGreeting: 'Bonjour' person=('jacques' | 'philippe') '!'; AllNames: 'jacques' | 'philippe' | ID; </code></pre> <p><strong>My questions:</strong> Why would a a string constant in 1 branch change the way the ID terminal is ingested along a different code path? Is it implemented with terminals (This would seem to contradict the documentation)? Is it a bug?</p> <p>Is my edited solution the best way to accomplish this?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload