Integration with Xbase - Domain model example [message #1784961] |
Fri, 06 April 2018 06:37  |
Eclipse User |
|
|
|
Hi,
I'm trying to play with the DomainModel example shipped with Xtext 2.12 and investigating how the inferrer works. However, the sample model given https://www.eclipse.org/Xtext/documentation/104_jvmdomainmodel.html does not work. Here are the error messages I'm getting:
Quote:Couldn't resolve reference to JvmIdentifiableElement '+'. test.dmodel
Couldn't resolve reference to JvmIdentifiableElement 'sortBy'.
Just to be complete, here is the sample (copied from Xtext documentation)
import java.util.List
entity Person {
name: String
firstName: String
friends: List<Person>
address : Address
op getFullName() : String {
return firstName + " " + name;
}
op getFriendsSortedByFullName() : List<Person> {
return friends.sortBy[ f | f.fullName ]
}
}
entity Address {
street: String
zip: String
city: String
}
and the grammar (also cross-checked with the template project and the Xtext web dec)
grammar org.eclipse.xtext.example.domainmodel.Domainmodel with
org.eclipse.xtext.xbase.Xbase
generate domainmodel "http://www.xtext.org/example/Domainmodel"
Domainmodel:
importSection=XImportSection?
elements+=AbstractElement*;
AbstractElement:
PackageDeclaration | Entity;
PackageDeclaration:
'package' name=QualifiedName '{'
elements+=AbstractElement*
'}';
Entity:
'entity' name=ValidID ('extends' superType=JvmTypeReference)? '{'
features+=Feature*
'}';
Feature:
Property | Operation;
Property:
name=ValidID ':' type=JvmTypeReference;
Operation:
'op' name=ValidID
'('(params+=FullJvmFormalParameter
(',' params+=FullJvmFormalParameter)*)?')'
':' type=JvmTypeReference
body=XBlockExpression;
Any idea?
Thanks,
Cheers,
Fabian
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07628 seconds