Writing unit tests for a DSL that is referencing a DSL [message #1785601] |
Tue, 17 April 2018 11:59 |
Lukas Schaus Messages: 37 Registered: October 2016 |
Member |
|
|
Hello Everyone,
i followed Christian's Blogpost in order to cross-reference elements from one DSL in another DSL.
I need that since I have two DSL's that use the same definitions. So I figured it would be neat to have a DSL which handles the definitions and the both other DSLs can reference the Definitions DSL.
Let me provide a minimal example: I have two Grammars: Defs and Usages:
The Defs grammar looks like this:
grammar com.mydsl.defines.MDefines with org.eclipse.xtext.common.Terminals
generate mDefines "http://www.mydsl.com/defines/MDefines"
Model:
defines+=Def*;
Def:
'def' name=ID
;
The Usage grammar looks like this:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
import "http://www.mydsl.com/defines/MDefines" as def
Model:
usages+=Usage*
;
Usage:
'use' elem=[def::Def]
;
Now I would like to write a simple parsing unit test for the usage grammar in the usage project. How could I do that?
[Updated on: Tue, 17 April 2018 12:07] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02315 seconds