all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Mohammed Sadiq <sadiq@sadiqpk.org>
Cc: 60122@debbugs.gnu.org, casouri@gmail.com
Subject: bug#60122: 29.0.60; c-ts-mode breaks with '"' separated macros
Date: Fri, 16 Dec 2022 20:30:39 +0100	[thread overview]
Message-ID: <87cz8jrvs0.fsf@thornhill.no> (raw)
In-Reply-To: <84db9d18bd013acbff59890f895e26f0@sadiqpk.org> (Mohammed Sadiq's message of "Fri, 16 Dec 2022 20:22:26 +0530")

Mohammed Sadiq <sadiq@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







  reply	other threads:[~2022-12-16 19:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 14:52 bug#60122: 29.0.60; c-ts-mode breaks with '"' separated macros Mohammed Sadiq
2022-12-16 19:30 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2022-12-17  7:20   ` Mohammed Sadiq
2023-01-07 23:17 ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87cz8jrvs0.fsf@thornhill.no \
    --to=bug-gnu-emacs@gnu.org \
    --cc=60122@debbugs.gnu.org \
    --cc=casouri@gmail.com \
    --cc=sadiq@sadiqpk.org \
    --cc=theo@thornhill.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.