|
From: Shlomy R. <sre...@gm...> - 2009-10-02 19:06:30
|
> In the meantime, is there is a way to write a mode purely in java, > without going through the compilation machinery of a mode file, so that > I might have a look at writing my own special syntax highlighter and > indentation? I guess I'm wondering what events the syntax highlighter > has to respond to, and similarly for indentation, and what functions I > might be able to re-use to simply tell jedit what colour to use for what > chunks of text... > > as I write this, I'm starting to think this might be a lot of work... > > any suggestions and comments would be very welcome, > > best, > lucas > > -- > The University of Edinburgh is a charitable body, registered in > Scotland, with registration number SC005336. > > You can start by reading the documentation of edit modes. That's what a mode file defines, and instead of writing a mode file you can set the objects at run-time. It's probably not what you want, anyway, because it's just filling in the mode file properties dynamically in java. To apply the mode rules, see the TokenMarker class. It has a method for marking tokens in a line. This is the starting point, but as you think, it's an awful lot of work. ... and thanks for mentioning the parser you used. I recall that looking for a C++ parser, I encountered something named "The Harmonia project", which is hosted by a university, and as far as I understand is a self-adjustable parser, that can listen to changes anywhere in the parsed text and do the minimal things to adapt the parse tree and associated actions. But I never went into detail to understand how it works. |