I am preparing the creating of an Atom package that highlights Adobe ZStrings in Lua files for Adobe Lightroom plugins. That’s a very special thing and is probably never needed by another Atom user, but I wanted a small project for getting familiar with Atom package development anyways.
Here is an example for an Adobe ZString. It always starts with
I already managed to create a working syntax highlighter for ZStrings using Atom’s old TextMate-like parser and now I struggle to adopt that success to tree-sitter. I know that’s a better case for the TextMate parser anyways, but I want to do it with tree-sitter just for sake of learning and modernness.
This is my current tree-sitter grammar:
This is my testing file:
abc "$$$" def u hupe9hupe9rhp "$$$/LightroomPluginName/Meta/PluginName=Plugin Title" 8hpu 9ohj9iof gz8uo
This is the parsing output using
tree-sitter parse from tree-sitter-cli:
I already tried dozens of variations and I can’t stop tree-sitter from assuming that the first string is a ZString too. I want tree-sitter to define the first string as
$._junk and just move on, but it currently tries to intepret the string using the
$.zString rule. So how can I tell tree-sitter to look ahead and check if the whole string part until end is a ZString, otherwise set the parser pointer back, define the string as
$.junk and continue with parsing? I had some success while playing around with
token.immediate, but I can’t use the functions, because every part of my
$.zString rule is another named rule.