XText 使用来自外部 EMF 模型的类型信息
我正在考虑使用 XText 为我日常使用的语言创建一个 DSL 扩展,该语言有一些明显的缺点(AS3,通过 FlashBuilder)。
我有一个正在运行的语法和代码生成系统,其中下面的声明生成一个值类,带有构造函数、类级别变量和 getter 等。
class Person (name: String, age: int)
这很好,但我希望在 Flash 播放器库中定义类型以及我在扩展 DSL 中可用的用户项目中定义的类型。在上面的代码中,String
和 int
均来自本机 Flash 库。
我认为 Flash Builder 在内部使用 EMF 核心来表示任何包含的库 (swc) 以及我在项目中定义的任何类型。如果是这种情况,我的问题是:
How can I access the EMF model of FLash Builder?
如果没有 EMF 模型,那么我想我必须自己解析library.swc 和我的项目的源代码。
Is the Xtend language intended to preform these sort of native filesystem tasks?
谢谢
I'm looking into using XText to make an extenstion DSL to a language that I use daily and has some obvious shortcomings (AS3, through FlashBuilder).
I have a grammar and code generation system working, where the below declaration generates a value class, with constructor, class level vars and getters etc.
class Person (name: String, age: int)
This is fine, but I would like the have the types defined in the flash player library and also the types that I define in users projects available in my extension DSL. In the code above both String
and int
come from the native flash library.
I presume that Flash Builder uses the EMF core internally to represent both any included libs (swcs) and any types I define in my projects. If this is the case, my question is:
How can I access the EMF model of FLash Builder?
If there is no EMF model then I presume I would have to parse the library.swc myself and the source code of my projects.
Is the Xtend language intended to preform these sort of native filesystem tasks?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
让我们假设 Flash Builder 附带一个基于 EMF 的元模型。那么你要做的“事情”就是实现一个 IResourceServiceProvider。我在博客中介绍了为 uml 模型做同样的事情: http://christiandietrich.wordpress.com/2011/07/17/xtext-2-0-and-uml/
没有:xtend 是一种现代风格的编程编译为 Java 并具有良好的模板支持的语言。
Let us asume the Flash Builder comes with an EMF based metamodel. then the "thing" you have to do is to implement a IResourceServiceProvider. I have blogged on doing the very same stuff for uml models: http://christiandietrich.wordpress.com/2011/07/17/xtext-2-0-and-uml/
and no: xtend is a modern style programming language that compiles to Java and has nice Templating support.