Hi,

I tried to write one some time ago but it seems my knowledge of ConTeXt was insufficient. I gave up. I also think it would be nice. 

If I can recall, one of the first problems I ran into concerned how ConTeXt environments work (among other things I cannot recall). In LaTeX, you have something like:
\begin{theorem}
When you are writing the grammar, you can clearly separate the tokens into '\', 'begin', '{' and '}'. So you get a consistent object that the tree-sitter library can work with. But with ConTeXt, you have something like this:
\startTheorem
We know that it is actually made up of '\', 'start' and 'Theorem'. But there is nothing separating the latter two so I couldn't find a way to make it general enough across board because of how configurable ConTeXt is (we have very few pre-defined environments). So I went with \start[theorem]. I am very sure it was my skill but just some thoughts from someone who tried in the past.

Maybe we could benefit from pre-converting the source file to an XML-like tree before applying the grammar? At which point you are venturing into LSP territory...

Jethro 

On Thu, Jul 4, 2024 at 7:36 PM juh+ntg-context--- via ntg-context <ntg-context@ntg.nl> wrote:
Dear all,

no mention here https://tree-sitter.github.io/tree-sitter/ and searching
for treesitter on the Wiki gives no match?

Many texteditors have treesitter support builtin so having a ConTeXt
grammar would be nice.

TIA
juh
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________