GNU bug report logs - #60122
29.0.60; c-ts-mode breaks with '"' separated macros

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Fri, 16 Dec 2022 14:53:02 UTC

Severity: normal

Found in version 29.0.60

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Mohammed Sadiq <sadiq <at> sadiqpk.org>
To: Theodor Thornhill <theo <at> thornhill.no>
Cc: 60122 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: bug#60122: 29.0.60; c-ts-mode breaks with '"' separated macros
Date: Sat, 17 Dec 2022 12:50:54 +0530
On 2022-12-17 01:00, Theodor Thornhill wrote:
> Mohammed Sadiq <sadiq <at> sadiqpk.org> writes:
> 
>> The following code is parsed wrong with c-ts-mode:
>> 
>> 
>> #include <gio/gio.h>
>> 
>> int
>> main (void)
>> {
>>   GFileInfo *info;
>>   GFile *file;
>> 
>>   file = g_file_new_for_path ("some/path");
>>   info = g_file_query_info (file,
>>                             G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID ","
>>                             G_FILE_ATTRIBUTE_THUMBNAILING_FAILED ","
>>                             G_FILE_ATTRIBUTE_TIME_MODIFIED ","
>>                             
>> G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE,
>>                             G_FILE_QUERY_INFO_NONE,
>>                             NULL, NULL);
>> }
>> 
>> 
>> c-ts-mode doesn't assume  G_FILE_ATTRIBUTE_THUMBNAIL_IS_VALID (and
>> others) to be a string (or some function/macro call that results in a
>> string) resulting in broken font locking and tab indentation.
>> 
>> The same code seems to work fine with c-mode
>> 
> 
> Hi!
> 
> If you use treesit-explore-mode, you can see that the tree-sitter 
> parser
> returns this ast:
> 
>    (expression_statement
>     (assignment_expression left: (identifier) operator: =
>      right:
>       (call_expression function: (identifier)
>        arguments:
>         (argument_list ( (identifier) , (identifier)
>          (ERROR ")
>          ,
>          (string_literal "
>           (ERROR (identifier))
>           ")
>          ,
>          (string_literal "
>           (ERROR (identifier))
>           ")
>          ,
>          (ERROR ")
>          (identifier) , (identifier) , (null) , (null) ))))
>     ;)
> 
> 
> Because tree-sitter fails to parse this there's only so much we can do.
> 
> I think you should file this as a bug at the parser issue tracker over
> at github[0].  Maybe it's a known problem already?
> 
> Theo
> 
> 
> [0]: https://github.com/tree-sitter/tree-sitter-c/issues


I did notice that later and filed an issue: 
https://github.com/tree-sitter/tree-sitter-c/issues/120


cheers,
Mohammed Sadiq




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

Previous Next


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