Is there a text editor that would allow me to create syntax highlighting easily?
Basically just the title said. The situation is basically I use a Domain-Specific Language called G'MIC, and to this day, I haven't found a satisfactory answer to the issue of lack of syntax highlighting. At the moment, I am using KDE Kate as it's pretty good at structuring the code with their find/replace feature, tab indicators, and multi-window support.
To make it clear, I have hard time getting “contexts” working.
Are there any particular problems?
However, if you're using Windows/have Wine installed and feel that contexts are an overkill, there is Notepad++' User Defined Languages, which as far as I can tell is purely based on lexemes.
Getting highlighting for regex-based selection to work. That seems confusing. I have 7 criterias which is recommended for the G'MIC language.
Note:
Strings that matches #( |$|(#)+).* gets treated as if it was a comment.
Strings that matches #@cli.* are treated as if they’re a header for CLI codes.
Strings that matches \$(-\d+|\w+|\d+) gets treated as if they’re accessed variables.
Strings that matches \w+: are treated as if they’re commands names.
Any texts under control-flow item list gets highlighted as long as they’re outside any characters between 2 quotation marks and of course, taking into account of / being used as escape character.
#@gui gets bolded.
Anything between 2 quotation marks gets highlighted though escape characters would be considered.
That looks odd and I'm somehow unable to find convincingly representative gmic scripts. Maybe those other highlighter files could help?
https://kate-editor.org/syntax/
So far, the most challenging part was highlighting things that counts as comment rather than pointers to image pixels or accessible variables. That's not the end of my trouble though.
I do want to figure out how to highlight "expr" including newlines inside expr. expr is basically any mathematical expression that is utilized on JIT compilation.
if expr
repeat expr
variable={expr}
variable:=expr <- : can be replaced with operator and it will still apply.
eval expr
eval "expr"
check "expr"
fill expr
fill "expr"
eval>expr
eval >"expr"
fill >expr
fill >"expr"
{expr}
for expr
{"expr"}
while expr
Along with that to set up regex inside it to highlight section of expr.
While still maintaining priority of regex. So, if one regex is more important, it'll overwrite whatever highlighted.
What do you mean? I'm pretty new to making syntax highlighting for KDE Kate, so I'm just now fixing my other thing before I get into much more advanced concept of it.
The way I remember stuff and it seems to be explained in here a context is a way to limit the amount of checked regexes. So as I understand you can start an expr context if you hit one of those keywords. Kind of like modes in XSL or working with a stack.
That document also describes how to handle newlines in context.
I haven't included some concepts in the example_cli as you can see that reptorian.gmic introduces some concepts not seen in both. Basically, writing a syntax highlighter for G'MIC would be a nightmare. But doable if I can figure things out.