I have the following Xtext grammar:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Model:
defines+=Define*
usages+=Usage*
;
Define:
'define' name=ID
;
Usage:
'usage' name=[Define]
;
And user's my.mydsl works well:
define first
usage first
Now, I would like to separate definitions from usage. Specifically, the requirement is to put one set of definitions into file called 'defs1.mydsl' and another set of (different) definitions into file called 'defs2.mydsl'. The intention is to provide them as read only definitions and make them be a part of Eclipse Xtext plugin.
A user editable file would contain 'use' and 'usage' directives only:
use "defs2.mydsl"
usage second
Would you please describe the steps I should follow to implement this?
Additional question – may I limit user to use 'use' and 'usage' directives only?
Thank you!
克里斯蒂安在Eclipse社区论坛上回答了这个问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.