在特定于域的语言的自定义编辑器中实现类似 IntelliSense 的行为
我正在使用类似模板的编辑器创建 DSL,非常类似于 Alice 中的规则系统。 用户将能够从列表中选择关系以及要应用该关系的对象。 这两个列表应根据可接受的类型进行过滤 - 例如,如果关系“大于”,则可用对象必须是实现“大于”的类型。
同样,如果选择的对象不能与大于进行比较,则该关系不应出现在潜在关系列表中。 我认为这个问题的核心是类型检查器,但我不确定将这种类型的逻辑合并到我的应用程序中的最佳方法。 有人知道现有的 DSL 类型检查库吗?
我对开源和跨平台技术特别感兴趣。 Java 可能是我们最终将使用的语言,但这并不是固定的。
I'm creating a DSL with a template-like editor, much like the rule systems in Alice. Users will be able to select relationships from a list as well as the objects to apply the relation to. These two lists should be filtered based on the acceptable types -- for instance, if the relationship is "greater than" then the available objects must be of a type that "greater than" is implemented for.
Similarly, if an object is selected that is not comparable with greater than, then that relation should not be in the list of potential relations. I think the heart of this problem is a type checker, but I'm not certain of the best way to incorporate that type of logic in my application. Is anyone aware of existing type checking libraries for DSLs?
I am specifically interested in open-source and cross-platform technologies. Java is probably the language we will end up using, but that is not fixed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以查看 Scintilla。 它是 Notepad++ 等工具使用的编辑组件。 它对自动完成有一些支持,尽管我自己没有尝试过使用它,所以我不确定它的效果如何。 它是开源的,所以如果它不能满足您的需求,我认为您可以轻松扩展它。
You might look into Scintilla. It's the editing component used by Notepad++, among other tools. It has some support for doing autocompletion, although I haven't tried using it myself, so I'm not sure how well it works. It's open source, so if it doesn't meet your needs, you can extend it without too much hassle, I think.
这可能对智能感知有所帮助 - CodeTextBox
This might help on the intellisense side - CodeTextBox