Little improvement for creation of own syntax schemes

General Discussion on RSyntaxTextArea.

Moderator: robert

Little improvement for creation of own syntax schemes

Postby grzlbrmft » Fri Jul 23, 2010 8:00 am

Hi,

I was creating some own syntax schemes when I came across a functionality of JFlex that could be useful for you, too. As you know when generating own syntax schemes you have to adjust the generated .java file afterwards (delete two methods, do not initialize zzBuffer)

It is possible to pass a parameter to JFlex specifying an own skeleton file. The skeleton files JFlex usually uses can be found in its source directory.
You could create an own skeleton file that does those adjustments using the skeleton.default as template.
The call to jflex would then be something like
Code: Select all
java -jar [path to jflex]\JFlex.jar -skel [path to skeleton]\skeleton.rsyntax XYZTokenMaker.flex


BTW which version of JFlex are you using? I used your SQL syntax as template and there was an assigment to zzPushbackPos that was not declared in JFLex 1.4.3
grzlbrmft
 

Re: Little improvement for creation of own syntax schemes

Postby robert » Mon Jul 26, 2010 8:03 pm

You're right, in fact TokenMakerMaker uses its own skeleton file for this very reason. I haven't bothered doing something similar with the main RSTA project because I so infrequently modify the built-in TokenMakers. But perhaps it's finally time to bite the bullet and just do it? Manual steps are always bad! I'll probably do this after I release version 1.4.2 of RSTA.

And I'm currently using the ancient JFlex 1.4.1. There's no reason not to upgrade, except for the old "if it ain't broke..." mentality. Moving forward I'll probably go ahead and upgrade, and future modifications/new TokenMakers will be generated with 1.4.3, but I don't plan on re-generating what's already there. It looks like 1.4.2 and 1.4.3 don't offer any performance improvements, only bug fixes, so there's no benefit in re-generating existing TokenMakers unnecessarily.
User avatar
robert
 
Posts: 760
Joined: Sat May 10, 2008 5:16 pm


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron