GNU bug report logs - #59468
29.0.50; c-ts-mode cannot fontify after macros are encountered

Previous Next

Package: emacs;

Reported by: Po Lu <luangruo <at> yahoo.com>

Date: Tue, 22 Nov 2022 01:52:02 UTC

Severity: normal

Found in version 29.0.50

Full log


View this message in rfc822 format

From: Yuan Fu <yuf011 <at> ucsd.edu>
To: Po Lu <luangruo <at> yahoo.com>
Cc: 59468 <at> debbugs.gnu.org
Subject: bug#59468: 29.0.50; c-ts-mode cannot fontify after macros are  encountered
Date: Tue, 22 Nov 2022 17:27:30 -0800
Po Lu <luangruo <at> yahoo.com> writes:

> Yuan Fu <casouri <at> gmail.com> writes:
>
>> Thanks for these reports! Buuuuut as we’ve seen, tree-sitter really
>> doesn’t handle macros that well. I’ll see what I can do when I find the
>> time, but there really isn’t any good solutions to this (right now, that
>> I can think of). I’m not even sure the author of tree-sitter-c would
>
> Thanks, and too bad.  However, one cannot help but wonder how he is
> supposed to write only "post-processed" C.

I think the idea is that most macros are defined like functions, so they
are just parsed as function invocations. Other things can be handled by
tree-sitter’s error recovery to some degree. Not saying this is correct,
but that’s probably the idea.


>> accept changes that try to parse macros: he has made it clear that the
>> purpose of tree-sitter-c is to support post-processed C and leave macros
>> and preprocessor to error-recovery.
>
> I think that attitude of the
> tree-sitter-c developer is extremely nasty.

For the record, because I don’t want to put words into tree-sitter’s
author’s mouth, I came up with this observation from [1], and I could be
wrong. Also, I think it’s more about the limitation of parser-base
approach than about policy.

[1]: https://github.com/tree-sitter/tree-sitter-c/issues/7

Yuan




This bug report was last modified 2 years and 302 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.