So basically, this is as much a porting guide as instructions for creating syntax colors (and more stuff in the future) for regular expressions. Although, if all you're doing is taking tokens from an existing module, and rewriting them the Schliemann way (i.e., regular expressions), then you're not really porting. So little of the original code can be reused, because you need so little code for Schliemann in the first place.
Interestingly, here we're using Schliemann within a JEditorPane, instead of in the NetBeans editor. That's also totally possible, simply by putting the MIME type in the contentType property of the JEditorPane. So, this is what I did:
Usefully, because nothing you type matches a token (because you have not defined tokens yet), the entire line/s that you enter in the JEditorPane is/are displayed in red, as shown below:
If part of the line were recognized as a token, that part would not be red, as we shall see later.
As you define your tokens, keep on checking your progress, by installing the module again and seeing how much of your code is captured by the token definitions. Here you can see we've made some progress already:
Not quite done yet, clearly, but getting there. And all it took was that I defined the following tokens and colors, partly based on Martin Adamek's regular expression tester on nbextras.org:
TOKEN:string:( "\\'" )
TOKEN:identifier:( ["a"-"z"] ["a"-"z" "0"-"9"]\* )
TOKEN:operator:( "-" | "+" | "\*" | "!" | "=" | "," | ";" )
TOKEN:bracket:( "(" | ")" | "<" | ">" | "[" | "]" )
TOKEN:dot:( "." )
Now I basically have the basis for further support for regular expressions, such as a navigator and other cool language features. Tools for regular expressions are going to become pretty important in 6.0, I reckon, because so much of Schliemann depends on working with regular expressions. So, the modules by Martin and Sandip (or derivatives of these) in this area are going to be helpful to have around.
By the way, thanks especially to Alex Kotchnev (plus a few others, such as Jochen from the Groovy mailing list), I now have a full blown functioning Groovy Console integrated in NetBeans IDE (plus, including the menu bar). Thanks to the NetBeans windowing system, I can even have two consoles (or as many as my heart desires) open at the same time:
Hurray for Groovy. Next, I'm going to try and do something with the Groovy Compiler. Or are there other things that should be looked at more urgently, either in relation to Groovy or in relation to Grails?
In other news. "Schliemannizing" is a brand new word. It means: "to radically simplify the implementation of, while extensively improving, something", as in the sentence: "He Schliemannized his NetBeans module, and now there are only two files left, instead of 200, while at the same time 10 new features have been added." When the word starts being used everywhere, from the depths of your local pub ("they Schliemannized my favorite beer, so now I get a hangover after just a single drop"), to the middle of a Larry King interview ("has your life improved now that your breasts have been Schliemannized?") , to the high point of the Queen's Christmas speech ("we will do all we can to Schliemannize our next Christmas speech, but chances are that it will be equally dull and at least three times as long"), remember... you heard it here first.