From: Yuan Fu <casouri@gmail.com>
To: Po Lu <luangruo@yahoo.com>
Cc: 59435@debbugs.gnu.org
Subject: bug#59435: 29.0.50; tree-sitter fails to fontify or indent simple function
Date: Wed, 23 Nov 2022 15:31:28 -0800 [thread overview]
Message-ID: <ED53BB4C-8E38-403E-B907-D6D414274D93@gmail.com> (raw)
In-Reply-To: <871qpw7s9k.fsf@yahoo.com>
Po Lu <luangruo@yahoo.com> writes:
> Yuan Fu <casouri@gmail.com> writes:
>
>>> On Nov 20, 2022, at 10:09 PM, Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors <bug-gnu-emacs@gnu.org> wrote:
>>>
>>>
>>> c-ts-mode cannot fontify the following code:
>>>
>>> ifsubmitbufl (tp)
>>> {
>>> register *kb1 = tp;
>>> extern tbase, i_len;
>>> register l = len;
>>>
>>> again:
>>>
>>> highprio (); /* tbase is used by protoureg */
>>> iomap (&UBR, tbase += UBR_SIZ);
>>> UBR->addr_l = kb1;
>>> UBR->addr_m = kb1 >> 010;
>>> UBR->mode_l = 07777 &~ UBR_INST;
>>> UBR->mode_m = 0;
>>> UBR->long_l = l;
>>> UBR->long_m = l >> 010;
>>>
>>> iounmap ();
>>> tally_iostat (tbase);
>>> iospoke (UBR, P_LOCK);
>>> resetprio ();
>>>
>>> SWITCH (S_WAIT|S_HIGH|S_IMMED, 0700, again); /* this returns to
>>> BR->senv[0], except
>>> if CL_HI */
>>> }
>>>
>>> here, ifsubmitbufl, tbase, l and again are fontified as types. They are
>>> fontified correctly by CC Mode, as three identifiers and one label.
>>
>> Thanks, I fixe the label’s face.
>
> Thanks.
>
>> As for ifsubmitbufl, tbase, and l, I don’t really understand the
>> syntax here, and I think neither does tree-sitter . In general
>> tree-sitter struggles with nonstandard (in its book anyway) syntax.
>
> Well, that code is 100% valid C. "*kb1, tbase, i_len, l" are implicitly
> int (which on that machine is 16 bits wide), and so is the value of
> "ifsubmitbufl" and "tp".
>
>> And there aren’t much we can do (except for maybe improve
>> tree-sitter-c’s parser).
>
> Would someone try that?
>
>> Seems to work fine here. I don’t see anything I changed recently that
>> could affect this, either.
>
> Sorry, I think I meant "before". Place point after "l = len;", then
> press RET.
That seems to work too. It is indented as much as the previous line.
Yuan
prev parent reply other threads:[~2022-11-23 23:31 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <871qpw7s9k.fsf.ref@yahoo.com>
2022-11-21 6:09 ` bug#59435: 29.0.50; tree-sitter fails to fontify or indent simple function Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-21 9:45 ` Yuan Fu
2022-11-21 11:57 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-21 13:53 ` Eli Zaretskii
2022-11-24 23:38 ` Richard Stallman
2022-11-25 5:12 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-28 21:37 ` Richard Stallman
2022-11-29 0:46 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-04 23:12 ` Richard Stallman
2022-12-05 1:15 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-25 6:38 ` Yuan Fu
2022-11-25 7:45 ` Eli Zaretskii
2022-11-28 21:37 ` Richard Stallman
2022-12-06 21:08 ` Florian Weimer
2022-12-07 1:02 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-07 10:50 ` Florian Weimer
2022-12-07 11:01 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-21 13:52 ` Stefan Kangas
2022-11-23 23:31 ` Yuan Fu [this message]
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=ED53BB4C-8E38-403E-B907-D6D414274D93@gmail.com \
--to=casouri@gmail.com \
--cc=59435@debbugs.gnu.org \
--cc=luangruo@yahoo.com \
/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.