Syntax Highlighting Tutorial

General Discussion on RSyntaxTextArea.

Moderator: robert

Syntax Highlighting Tutorial

Postby abgorn » Fri Jul 03, 2009 2:03 pm

I think it would be a fantastic idea for someone on the RSTA team to make a tutorial on how to create syntax highlighters because the source code is unbelievably hard to look through and understand. I've been looking at it for around two days now but it's so unorganized (sorry, that's what I think) that I can barely add/modify anything! And I'd really like to add some more features to my project and maybe help out with RSTA but I can't figure out how it works.
Posts: 4
Joined: Sun Jun 28, 2009 1:51 pm

Re: Syntax Highlighting Tutorial

Postby robert » Sat Jul 04, 2009 10:58 pm

Hi agborn,

Sorry you feel that way! I agree that it is difficult to add a new syntax highlighter to RSTA, because of the way it uses JFlex in a non-standard way. But the source code for the editor as a whole uses the same structure as the Swing text package. If you examine the JDK source of javax.swing.text.*, you'll see that RSTA classes are extensions and implementations of what's already there (which isn't to say the Swing text package is straightforward :)). And once you have a highlighter class, calling it from RSTA is easy.

But yes, actually implementing a syntax highlighter is difficult. It's best to contact me directly at robert /at/ fifesoft /dot/ com. One day in the distant future I plan on making an easier way to add highlighting for new languages, it's been on the to-do-list forever, but I haven't gotten around to it because it's not a frequently asked-for feature.
User avatar
Posts: 852
Joined: Sat May 10, 2008 5:16 pm

Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 1 guest