GNU bug report logs -
#62238
30.0.50; Unusual interpretation of "S-expressions" in c-ts-mode
Previous Next
Full log
Message #53 received at 62238 <at> debbugs.gnu.org (full text, mbox):
>> > I don't understand how you came to that conclusion. Why would we want
>> > to use syntax tables when we have a parser at our fingertips? And if
>> > "the Tree-sitter function is general and should work for every
>> > language", as you say (and I agree), why should we refrain from using
>> > it for C?
>>
>> Note that basing C-M-x on syntax tables (that is, traditional
>> forward-sexp) does not completely exclude the use of Tree-sitter, AFAIU.
>> Here's my thought process: To do its job, C-M-x needs to know about some
>> code structures such as symbol constituents, strings, comments, and
>> parenthetical groups. If in some language or future version of C the
>> syntax is complex enough that getting the syntax class of a character
>> requires proper parsing, the Tree-sitter major modes can augment the
>> syntax table to make C-M-x work correctly. See
>> c-ts-mode--syntax-propertize for an example of how Tree-sitter can
>> augment a buffer's syntax table, if needed.
>
> We have already C mode that uses syntax tables. I think it's useful
> to try syntactic movement using results of parsing as well, and
> compare the relative merits and demerits.
After trying to tweak treesit-sexp-type-regexp a few times
I become convinced it is not up to the task of properly handling
all sexp operations. It seems the existing functions that
implement C-M-f (forward-sexp), C-M-u (backward-up-list), etc.
should remain in place, and the role of the tree-sitter would be
only to provide syntax information for them, i.e. just to replace
syntax tables with tree-sitter wrappers.
This bug report was last modified 2 years and 80 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.