[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tree-sitter: conceptional problem solvable at Emacs' level?
From: |
Eli Zaretskii |
Subject: |
Re: tree-sitter: conceptional problem solvable at Emacs' level? |
Date: |
Sat, 11 Feb 2023 12:42:10 +0200 |
> From: Ihor Radchenko <yantar92@posteo.net>
> Cc: Yuan Fu <casouri@gmail.com>, luangruo@yahoo.com,
> holgerschurig@gmail.com, Emacs-devel@gnu.org
> 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.
Could be. However:
> 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.
I believe the problem is with handling the parts which _use_ the
macro, not those parts which _define_ macros.
Still, this idea should be explored, I think.
Thanks.
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, (continued)
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Konstantin Kharlamov, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Theodor Thornhill, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Konstantin Kharlamov, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Konstantin Kharlamov, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Konstantin Kharlamov, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Theodor Thornhill, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Konstantin Kharlamov, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Konstantin Kharlamov, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Eli Zaretskii, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Ihor Radchenko, 2023/02/11
- Re: tree-sitter: conceptional problem solvable at Emacs' level?,
Eli Zaretskii <=
- Re: tree-sitter: conceptional problem solvable at Emacs' level?, Lynn Winebarger, 2023/02/11
Re: tree-sitter: conceptional problem solvable at Emacs' level?, Ergus, 2023/02/09