如何在Xtext DSL中包含Java代码块? [英] How to include Java Code Block in Xtext DSL?
问题描述
在Xtext语法中,我可以使用 XExpression
/ XBlockExpression
类型包含Xbase代码块。我将如何使用Java代码块执行相同的操作?包含的Java稍后应包含在由DSL构造生成的Java中。
In an Xtext grammar I can include an Xbase code block using the XExpression
/XBlockExpression
types. How would I go to do the same with a Java code block? The included java should later be included in the Java generated from the DSL constructs.
推荐答案
您现在可以使用JBase(< a href = https://github.com/LorenzoBettini/jbase rel = nofollow noreferrer> https://github.com/LorenzoBettini/jbase )。 JBase是专门为您描述的用例创建的(请参见 https://dl.acm。 org / citation.cfm?id = 2972217 ),并且可以通过扩展JBase而不是XBase进行较小的更改。
You can do this now with JBase (https://github.com/LorenzoBettini/jbase). JBase was created specifically for the use case you described (see https://dl.acm.org/citation.cfm?id=2972217) and can be incorporated with minor changes by extending JBase instead of XBase.
这篇关于如何在Xtext DSL中包含Java代码块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!