|
|
|
|
|
|
Re: 2 DSLs and 1 Ecore-Model [message #1759123 is a reply to message #1759112] |
Thu, 06 April 2017 15:42 |
Marc Schlegel Messages: 69 Registered: July 2009 |
Member |
|
|
Unfortunately I cannot put anything on Github so I will put something here
grammar de.xxx.tooling.DataDsl with org.eclipse.xtext.common.Terminals
import "http://www.xxx.de/tooling/model/DslEcore"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
DataRule returns Data:
("Fields" "{"
(fields+=FieldRule)+
"}")*
(groups+=GroupRule)+
;
GroupRule returns Group:
...skipped
;
FieldRule returns Field:
...skipped...
;
grammar de.xxx.tooling.UiDsl with org.eclipse.xtext.common.Terminals
import "http://www.xxx.de/tooling/model/DslEcore"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
UIRegel returns UI:
felder+=(FeldRefRegel)*
;
FieldRefRegel returns FieldRef:
HorizontalFieldRule | VerticalFieldRule
;
HorizontalFieldRule returns HorizontalFieldRef:
"horizontal" "(" horizontaleFields+=[Field] ")"
;
VerticalFieldRule returns VerticalFieldRef:
"field" field=[Field]
;
And the Xcore...maybe the reference is not modelled correct
@Ecore(nsURI="http://www.xxx.de/tooling/model/DslEcore")
@GenModel(
modelDirectory="/de.xxx.tooling/emf-gen",
modelName="DslEcore",
forceOverwrite="true",
updateClasspath="false",
complianceLevel="8.0"
)
package de.sdvrz.tooling.model
//
// Data
//
class Data {
derived String name get {
//Paths.get(this.eResource.URI.toFileString).parent.fileName.toString
this.eResource().getURI().segment(3)
}
contains Field [] fields
contains Group [] groups
}
class Group {
...skipped
}
class Feld {
...skipped
}
//
// UI
//
class UI {
derived String name get {
//Paths.get(this.eResource.URI.toFileString).parent.fileName.toString
this.eResource().getURI().segment(3)
}
contains FieldRef [] fields
}
interface FieldRef {
}
class VerticalFieldRef extends FieldRef{
refers Field field
}
class HorizontalFieldRef extends FieldRef {
refers Field[] horizontalFields
}
[Updated on: Thu, 06 April 2017 19:15] Report message to a moderator
|
|
|
|
Re: 2 DSLs and 1 Ecore-Model [message #1759132 is a reply to message #1759126] |
Thu, 06 April 2017 18:11 |
Marc Schlegel Messages: 69 Registered: July 2009 |
Member |
|
|
Sorry, I missed that. In the Xcore file it´s the Field reference which conntects Restdaten with Datenversorgung
In the second DSL it´s about the following Rules
HorizontalFieldRule returns HorizontalFieldRef:
"horizontal" "(" horizontalFields+=[Field] ")"
;
VerticaleFieldRule returns VerticalFieldRef:
"field" field=[Field]
;
So it should be able to write the following
field <fieldref_1>
horizontal (<fieldref_2> <fieldref_3>)
field <fieldref_4>
...
[Updated on: Thu, 06 April 2017 19:15] Report message to a moderator
|
|
|
Re: 2 DSLs and 1 Ecore-Model [message #1759134 is a reply to message #1759132] |
Thu, 06 April 2017 18:36 |
|
Hi,
this is a Naming Conventions vs. Grammar vs magic getName functions in Xcore Thing
either in Grammar:
FQN: ID ("." ID)*;
...
"feld" feld=[Feld|FQN]
...
the |FQN means parse a FQN (the default is |ID which does not allow a .)
our you change in the runtime module of the first dsl:
class MyDslRuntimeModule extends AbstractMyDslRuntimeModule {
override bindIQualifiedNameProvider() {
SimpleNameProvider
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04623 seconds