如何在Xtext DSL中包含Java代码块? [英] How to include Java Code Block in Xtext DSL?

查看:65
本文介绍了如何在Xtext DSL中包含Java代码块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在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 = 2972​​217 ),并且可以通过扩展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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆