题
我使用xtext插件进行日用eClipse来定义我的语言并从中生成一些文件。 该项目很大,我想使用多个生成器来生成我的文件,除了由插件生成的默认生成器。
我尝试了这个解决方案 http://www.eclipse.org/forums/index.php/t/263021// ,但它不起作用,看起来与旧版本的xtext相关。
例如,我默认为
class com.company.mylang.generator.MylangGenerator implements IGenerator {...}
.
我需要添加其他一个
class com.company.mylang.generator.MylangGenerator2 implements IGenerator {...}
.
作为Eclipse构建的一部分运行。
解决方案
复合发电机可以工作。您的MylangGenerator可以作为综合和委派给其他生成器来实现,可能取决于资源中的某些配置或状态。
class MylangCompositeGenerator implements IGenerator {
@Inject MylangGenerator gen
@Inject MylangGenerator2 gen2
def doGenerate(Resource input, IFileSystemAccess fsa) {
gen.doGenerator(input, fsa)
gen2.doGenerator(input, fsa)
}
}
. 不隶属于 StackOverflow