[Top][All Lists]

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

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

From: Po Lu
Subject: Re: tree-sitter: conceptional problem solvable at Emacs' level?
Date: Thu, 09 Feb 2023 18:13:59 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

> Suggestions for what to do for now aside, I would still want us to try
> to figure out the possibilities for better handling of C/C++ macros in
> tree-sitter supported modes.  I don't want to give up yet, because the
> kludges similar to c-add-style used by CC mode might be possible with
> tree-sitter modes as well.  Or maybe some other solution could work,
> including the idea of letting tree-sitter see preprocessed source code
> (although this is probably harder to implement, and must be done on
> the C level).

I don't oppose us trying, I just see problems with trying to parse C
macros with anything other than guesswork whilst maintaining reasonable

Preprocessing C can be very slow, and might not be easy to set up to run
on each edit, which would be necessary to let tree-sitter see
preprocessed source code.

And once you start trying to do that, you have to determine how to run
whatever C preprocessor is supposed to preprocess a file.  Even language
servers, which are typically entire C compilers, fail to understand some
kinds of macros not written with them in mind.  I guess one example
would be the very compiler specific ``macro''-like keywords used by
various compilers to designate long and short interrupt service
routines, or Intel's ``near'' and ``far'' keywords.

reply via email to

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