language elements must have 'name' attribute? [message #720971] |
Wed, 31 August 2011 15:31 |
steven reinisch Messages: 33 Registered: July 2009 |
Member |
|
|
hi,
consider this simple grammar:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Model:
(types += Type)*
(operations += Operation)*
;
Type:
'type' clazz = [jvmTypes::JvmType | FQN]
;
Operation:
'op' op = [jvmTypes::JvmOperation | FQN]
;
FQN:
ID ("." ID)*
;
If a try to read all declared types from a model with this workflow:
Workflow {
component = org.eclipse.xtext.mwe.Reader{
path = "src/model"
register = org.xtext.example.mydsl.MyDslStandaloneSetup{}
load = {
slot = "model"
type = 'Type'
}
}
I get this output:
0 WARN SlotEntry - Could not find any exported element of type 'Type' -> Slot 'model' is empty.
3 INFO Workflow - Done.
No instances of 'Type' can be found although declared in the model.
If a change the grammar and add a 'name' attribute to 'Type':
Type:
'type' name=ID clazz = [jvmTypes::JvmType | FQN]
;
'Type' instances can be read.
The additional 'name' attribute adds noise to the language. In general, what do I need to do, to omit a 'name' attribute but still be able to read language elements from a model?
regards,
steven
[Updated on: Wed, 31 August 2011 15:32] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04806 seconds