1

I have a section in my grammar like the following

Type:
    '(' parameter=Param ':' dataType=DataType ')'
;

DataType :
    javaType = JvmTypeReference | ModelResource
;

ModelResource :
    name=ID
;

In the corresponding xtend, I had to determine if javaType is one of the primitive java types or a user defined class.

I tried the following check

if (type.dataType instanceof ModelResource) {
  ...
}

I provide in the execution as follows

(user : UserResource)
(id : Long)

But according to the condition, the dataType user is an instance of JvmTypeReference and not of ModelResource type.

How can I change the grammar/condition in order to identify user is not of Java Type and id is of Java Type?

Philip John
  • 5,275
  • 10
  • 43
  • 68

0 Answers0