Bug 487638 - Invalid tokenType with the content assist parser
Summary: Invalid tokenType with the content assist parser
Status: NEW
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.8.4   Edit
Hardware: PC Linux
: P3 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-11 03:17 EST by Stephane Galland CLA
Modified: 2016-12-14 23:05 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stephane Galland CLA 2016-02-11 03:17:16 EST
I have created my DSL as an extension of Xtend.
Everything is working except the content assist feature.
In some particular cases, the exception below is thrown.

The typical use case is (where "agent" is a keyword of my DSL):


   agent XXX {
      def myFunction : float {
         Math.
      }
   }


If I ask the content assistant to give proposals after "Math.", it fails with:

...
Caused by: java.lang.IllegalArgumentException: tokenType 44 seems to be invalid.
at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser.createLookAheadTerminal(AbstractInternalContentAssistParser.java:533)
at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser$DefaultFollowElementFactory.createFollowElement(AbstractInternalContentAssistParser.java:76)
at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser.createFollowElement(AbstractInternalContentAssistParser.java:509)
at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser$5.announceEof(AbstractInternalContentAssistParser.java:445)
at org.eclipse.xtext.ui.editor.contentassist.antlr.internal.AbstractInternalContentAssistParser.announceEof(AbstractInternalContentAssistParser.java:570)
at org.eclipse.xtext.ui.editor.contentassist.antlr.ObservableXtextTokenStream.LA(ObservableXtextTokenStream.java:48)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.rule__XMemberFeatureCall__Group__1__Impl(InternalSARLParser.java:8355)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.rule__XMemberFeatureCall__Group__1(InternalSARLParser.java:8310)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.rule__XMemberFeatureCall__Group__0(InternalSARLParser.java:8232)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.ruleXMemberFeatureCall(InternalSARLParser.java:7763)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.rule__XPostfixOperation__Group__0__Impl(InternalSARLParser.java:7835)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.rule__XPostfixOperation__Group__0(InternalSARLParser.java:7791)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.ruleXPostfixOperation(InternalSARLParser.java:7593)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.rule__XCastedExpression__Group__0__Impl(InternalSARLParser.java:7234)
at io.sarl.lang.ui.contentassist.antlr.internal.InternalSARLParser.rule__XCastedExpression__Group__0(InternalSARLParser.java:7190)




The mwe script is located at: https://github.com/sarl/sarl/blob/master/plugins/io.sarl.lang.mwe2/src/io/sarl/lang/GenerateSARL.mwe2


The DSL grammar is: https://github.com/sarl/sarl/blob/master/plugins/io.sarl.lang/src/io/sarl/lang/SARL.xtext


Forum discussion: https://www.eclipse.org/forums/index.php/t/1074655/





The function createLookAheadTerminal and related stuffs do not seem to handle keywords right.