jsinglet
jsinglet

Reputation: 1151

XText and JVMTypes

I'm trying to get a really simple example going with the latest version of xtext (2.12). Per the documentation: https://eclipse.org/Xtext/documentation/305_xbase.html#xbase-language-ref-introduction

My .xtext file looks like this:

grammar org.mylang.MyLang with org.eclipse.xtext.common.Terminals
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes

generate evidently "http://www.mylang.org/MyLang"

DataType:
  'datatype' name=ID 
  'mapped-to' javaType=[jvmTypes::JvmType|QualifiedName];

QualifiedName: ID ('.' ID)* ;

However, after I generate the artifacts and fire up the eclipse editor, although syntax highlighting works, I get an error any time I try to reference a JVM type. For example:

datatype xxxx mapped-to java.util.Date

I get an error line under java.util.Date. What am I missing here?

Upvotes: 1

Views: 175

Answers (1)

Alex
Alex

Reputation: 186

Try with org.eclipse.xtext.xbase.Xtype instead of with org.eclipse.xtext.common.Terminals. Also observe the changes in generated infrastructure in src-gen folder.

Upvotes: 2

Related Questions