Umm. I did one for the language in Second Life, LSL, but probably not the same way. I used something called Scintillua:
http://foicica.com/scintillua/I think what it does is, basically, define "preset" lexer functions, and effects, for doing the basics, then allows you to "extend" that, using the same sort of Lua stuff that you are trying to mess with. This means that, as long as most of your language definitions don't require anything really odd, its fairly easy to set up. The instructions are.. a bit inspecific to follow, which was the problem I ran into. Certain things are "required", for example:
{ 'any_char', l.any_char }
which is in the M._rules. This has the effect of "turning off" what ever highlighting was already in effect. I discovered, without it, it would react to the first thing it found, but then all other code would fail to highlight. The documentation also talks about existing style definitions. I ended up adding what I needed manually for those, but otherwise you have to add a line to import them. Obvious, in retrospect, but not so obvious if you are hacking the thing together, and making assumptions. In any case, I posts the lexer I made using it in the thread, and it might be a lot easier to use scintallua, than to start completely from scratch, especially since I have no idea how much "pre-work" is included, which you would have to do yourself, to make lua do anything at all, without the stuff the guy already did:
https://groups.google.com/forum/#!topic/scite-interest/vPh1OhBnreUOn Saturday, September 22, 2012 2:25:55 PM UTC-7, Sergio Spina wrote:
Hallo to all of you.
I'm trying to write a lexer in lua, according to the exampe in this page, but it seems to be a difficult task.
Is there someone who has written a lexer in lua? Can he/she post the code? What is the name of the file? In what directory was saved the file with the lexer? Can he/she post the lines in the .properties file regarding the lexer?
Many thank for every help.