Hardcoding the rules for every language makes the process of developing a new language very tedious. It would be better to use a grammar description, written in a text file, that can easily be parsed at runtime. This would also make it much easier to share language defintions and possibly reuse already existing ones of other projects.
Specifically, the implementation of the VSCode language server uses the TextMate grammar.
The library that is used by VSCode for tokenizing can be found here:
https://github.com/microsoft/vscode-textmate
Since it is written in JavaScript, it would need a manual rewrite in Kotlin to be able to use it on Android.
Since the regex dialect used is different from the one used in Java/Kotlin, something like Joni might do the trick.
Hardcoding the rules for every language makes the process of developing a new language very tedious. It would be better to use a grammar description, written in a text file, that can easily be parsed at runtime. This would also make it much easier to share language defintions and possibly reuse already existing ones of other projects.
Specifically, the implementation of the VSCode language server uses the TextMate grammar.
The library that is used by VSCode for tokenizing can be found here:
https://github.com/microsoft/vscode-textmate
Since it is written in JavaScript, it would need a manual rewrite in Kotlin to be able to use it on Android.
Since the regex dialect used is different from the one used in Java/Kotlin, something like Joni might do the trick.