emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tree-sitter: conceptional problem solvable at Emacs' level?


From: Ihor Radchenko
Subject: Re: tree-sitter: conceptional problem solvable at Emacs' level?
Date: Sat, 11 Feb 2023 09:34:42 +0000

Eli Zaretskii <eliz@gnu.org> writes:

> Another possibility is to complicate the function we pass to
> tree-sitter with which to read buffer text, in a way that replaces the
> text of a macro with something else (in the simplest case, just space
> characters), so as to avoid errors in the parser, and again analyze
> the macros in our own code.

Another idea is delegating parts of buffer to Elisp/alternative parser.

Tree sitter provides support to documents written using a mixture of
grammars: 
https://tree-sitter.github.io/tree-sitter/using-parsers#multi-language-documents
Macros can be considered such a "mixed" grammar with macros being a
grammar of their own.

AFAIU, tree sitter allows excluding certain file ranges from parsing
and instead parse the excluded ranges using alternative grammar. If
Elisp can somehow tell tree-sitter backend not skip parsing
macro-looking lines, it should solve the problem at least partially.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]