3

I am trying to create a DSL in the following syntax :

alias date java.util.Date;

so what I have in my grammar is something like this :

import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes

Model:
    (types+= Type)*;

Type:
    Alias | Class;

PackageName:
  ID ('.' ID)*;

Alias:
    'alias' name = ID javaType=[jvmTypes::JvmType|PackageName] ';' ;

This doesn't seem to be working.

I am looking at the article : http://www.eclipse.org/Xtext/documentation/2_0_0/199a-jvmtypes.php which does something very similar. Not sure what I am missing here.

Ajay George
  • 11,759
  • 1
  • 40
  • 48
  • Can you clarify, what is and what isn't working? Doesn't generate the code, the editor does not support what you wanted, or something completely else? – Zoltán Ujhelyi Sep 12 '11 at 14:49
  • Editor doesn't support the Java referencing. – Ajay George Sep 12 '11 at 14:57
  • I suggest looking at either the Domain model example, or the Xtend code how they are doing it, because they are already using jvmTypes. I don't have to more specific answer, but this might be a good starting point. – Zoltán Ujhelyi Sep 13 '11 at 09:05

1 Answers1

1

Finally got it.

Adding this worked

registerGenModelFile = "platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"

Note :

The official tutorial mentioned that this should be added.

registerGenModelFile = 
     "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"

The MWE2 workflow never ran to success with that, complaining that this model could not be located.

Ajay George
  • 11,759
  • 1
  • 40
  • 48
  • 1
    Sorry for the late reply.. Its in the .mwe2 file. Refer to http://www.eclipse.org/Xtext/documentation/2_0_0/199-xtext-and-java.php for more details – Ajay George Mar 18 '12 at 14:54