Perhaps we could port [Willox' tokenizer](https://gist.github.com/bmwalters/f7e0dfd2d3041109a88ead4cd93119b7) to [CodeMirror's format](https://github.com/codemirror/CodeMirror/blob/master/mode/lua/lua.js).