在java中突出显示文本文件的某些部分的解决方案?如何实现一个简单的DSL编辑器?

发布于 2024-08-20 02:14:22 字数 300 浏览 4 评论 0原文

我正在尝试找到一种解决方案来突出显示 Java 中文本文件的一部分。 基本上,我正在做的是词法分析和解析符合特定语法的文本文件,存储与该文件的各个元素相关的一些信息,然后将信息记录到数据库中。

我想要一些更直观的东西,比如文本文件的表示,其中突出显示某些部分(以及所使用的各种颜色的索引),或者更好的是附加到特定标记的一些上下文相关信息。

有没有简单的方法可以做到这一点?基本上,就功能而言,我想要的是一个针对特定语言且独立的非常原始的 Eclipse 插件。也许有一个构建 DSL 编辑器的框架,类似的东西。

希望它是清楚的... 谢谢

I'm trying to find a solution to highlight part of a text file in Java.
Basically, what I'm doing is lexing and parsing a text file respecting a certain grammar, storing some information related to the various elements of this file and then logging the information to a database.

I would like to have something more visual like a representation of the text file with some parts highlighted (and an index of the various colors used) - or even better with some context-sensitive information attached to a particular token.

Is there an easy way to do so? Basically what I would like to have, in terms of features, is a really primitive Eclipse plugin for a particular language and stand-alone. Maybe there's a framework to build DSL editors, something like that.

Hope it is clear...
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

长不大的小祸害 2024-08-27 02:14:22

我认为 Xtext 正是您所寻找的,它会根据语法生成 Eclipse 编辑器和更多内容。

I think Xtext is just what you are looking for, it generates an Eclipse editor and more from a grammar.

拥有 2024-08-27 02:14:22

虽然不适用于 Eclipse,但 JetBrains(现在开源 IntelliJ IDEA 的制造商)的 MPS 可能值得一看:

http://www.jetbrains.com/mps/

Although not for Eclipse, there's MPS by JetBrains (the makers of the now open source IntelliJ IDEA) which may be worth taking a look at:

http://www.jetbrains.com/mps/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文