A solution to highlight some parts of a text file in java ? How to implement a simple DSL editor?
I'm trying to find a solution to highlig开发者_StackOverflowht 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
I think Xtext is just what you are looking for, it generates an Eclipse editor and more from a grammar.
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/
精彩评论