From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#59435: 29.0.50; tree-sitter fails to fontify or indent simple function Date: Wed, 23 Nov 2022 15:31:28 -0800 Message-ID: References: <871qpw7s9k.fsf@yahoo.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34324"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59435@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 24 00:32:27 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oxzEB-0008mG-0K for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Nov 2022 00:32:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxzDo-0006oK-BQ; Wed, 23 Nov 2022 18:32:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oxzDm-0006o6-Qq for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 18:32:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oxzDm-0007nH-7p for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 18:32:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxzDm-0005jV-3H for bug-gnu-emacs@gnu.org; Wed, 23 Nov 2022 18:32:02 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <871qpw7s9k.fsf@yahoo.com> Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Nov 2022 23:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59435 X-GNU-PR-Package: emacs Original-Received: via spool by 59435-submit@debbugs.gnu.org id=B59435.166924629822005 (code B ref 59435); Wed, 23 Nov 2022 23:32:02 +0000 Original-Received: (at 59435) by debbugs.gnu.org; 23 Nov 2022 23:31:38 +0000 Original-Received: from localhost ([127.0.0.1]:56587 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxzDO-0005io-Fh for submit@debbugs.gnu.org; Wed, 23 Nov 2022 18:31:38 -0500 Original-Received: from mail-pl1-f176.google.com ([209.85.214.176]:34503) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxzDL-0005iV-Nj for 59435@debbugs.gnu.org; Wed, 23 Nov 2022 18:31:36 -0500 Original-Received: by mail-pl1-f176.google.com with SMTP id w4so9209919plp.1 for <59435@debbugs.gnu.org>; Wed, 23 Nov 2022 15:31:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=efvV6dwJSqZYQ7y21RYIcO7DeA7gMvEA/XRc17rn+1s=; b=dI5FXOhtZcbl1E0xTuPqwe6CKU0hfY5xHY0bDTSaJCQ7JmBfqDbPmgYJOkaeSmpo1R OaXl40paiph5NBcRgskndYKQqY4gy8MgmNzMZc1QQajjVq3YHgmZoYFXkjGhcLDOObtk mVYhXgoOhsrSAIf3LMJYZGs+U5MdhaMtTqwkSKx+NkX92Pujs9umm7C/N4PRfA8XKmeL PA9LHjuncYScllR/O4AJTg/ynEALptxn3QriOlTo1I+Yz57mQc1Iy/BroWcqtZSWV/MI sKx/2OvDYnt7dH48FiM4+qjHzPATyscQLRMRoo/ARgCnjRdtU0FdwVMtL1S3gyd/4iS4 hyqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=efvV6dwJSqZYQ7y21RYIcO7DeA7gMvEA/XRc17rn+1s=; b=6dB7KV6xHMSjln83c1857eTxDAULdN+2zQqPz+l4gWe/V3llAZdiK1iIZ9cduiTXPv O8GWFeq6KBgi3j09CBDUKqpnY6aonJbYIwBAc+kMCNyaBTQq4nFPhlMCTedRm2fGGl8H dVIC3xXqrk47b9ZfXozj1OikypODL6lTUpI1JTMRlHNzj7Q3KUhvL7m+0W3xXB5P18lr 85WmqbuvhdMjKSUYlfIF/KTOzM+w5QxPrWIkZjmjERZjwyRBI5cEJgWBbXqVP9DqT2Ho 0c3lhv0WvgmNgZlItk+Ij+qj8vhe8HhKRCUImgLpli+R+nZUTpQ12w8jxr20X0tHfEFc nbNA== X-Gm-Message-State: ANoB5pnaEvHtlS1O9cVUEBCxczuxN9l76BoGYV4hJkB48rgX76I1OY5P d66g82jo35yIe6xqf2+YBI0= X-Google-Smtp-Source: AA0mqf4kO6fNL6mBCTot/DMFUpNdveyCu6UWNkq8tpNs67h8M1f/Mr21R2WIFTvLjc2EvG8pbf5RZg== X-Received: by 2002:a17:903:2093:b0:188:82fc:e284 with SMTP id d19-20020a170903209300b0018882fce284mr11177934plc.76.1669246289793; Wed, 23 Nov 2022 15:31:29 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id y19-20020a1709027c9300b0017f9db0236asm14848109pll.82.2022.11.23.15.31.29 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Nov 2022 15:31:29 -0800 (PST) X-Mailer: Apple Mail (2.3696.120.41.1.1) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248796 Archived-At: Po Lu writes: > Yuan Fu writes: > >>> On Nov 20, 2022, at 10:09 PM, Po Lu via Bug reports for GNU Emacs, = the Swiss army knife of text editors wrote: >>>=20 >>>=20 >>> c-ts-mode cannot fontify the following code: >>>=20 >>> ifsubmitbufl (tp) >>> { >>> register *kb1 =3D tp; >>> extern tbase, i_len; >>> register l =3D len; >>>=20 >>> again: >>>=20 >>> highprio (); /* tbase is used by protoureg */ >>> iomap (&UBR, tbase +=3D UBR_SIZ); >>> UBR->addr_l =3D kb1; >>> UBR->addr_m =3D kb1 >> 010; >>> UBR->mode_l =3D 07777 &~ UBR_INST; >>> UBR->mode_m =3D 0; >>> UBR->long_l =3D l; >>> UBR->long_m =3D l >> 010; >>>=20 >>> iounmap (); >>> tally_iostat (tbase); >>> iospoke (UBR, P_LOCK); >>> resetprio (); >>>=20 >>> SWITCH (S_WAIT|S_HIGH|S_IMMED, 0700, again); /* this returns to >>> BR->senv[0], except >>> if CL_HI */ >>> } >>>=20 >>> 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=E2=80=99s face. > > Thanks. > >> As for ifsubmitbufl, tbase, and l, I don=E2=80=99t 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=E2=80=99t much we can do (except for maybe improve >> tree-sitter-c=E2=80=99s parser). > > Would someone try that? > >> Seems to work fine here. I don=E2=80=99t see anything I changed = recently that >> could affect this, either. > > Sorry, I think I meant "before". Place point after "l =3D len;", then > press RET. That seems to work too. It is indented as much as the previous line. Yuan=