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#59468: 29.0.50; c-ts-mode cannot fontify after macros are encountered Date: Tue, 22 Nov 2022 20:13:49 -0800 Message-ID: <928B0F3C-4C8C-49EF-AB27-D49BF5E27607@gmail.com> References: <87k03n4v0r.fsf@yahoo.com> <83tu2qz6s2.fsf@gnu.org> 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="30593"; mail-complaints-to="usenet@ciao.gmane.io" Cc: luangruo@yahoo.com, 59468@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 23 05:14:28 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 1oxh9U-0007YS-UY for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 23 Nov 2022 05:14:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oxh99-0002wP-OM; Tue, 22 Nov 2022 23:14:03 -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 1oxh98-0002wH-7Q for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 23:14: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 1oxh97-0002tQ-VD for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 23:14:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oxh97-00010B-Q0 for bug-gnu-emacs@gnu.org; Tue, 22 Nov 2022 23:14:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 23 Nov 2022 04:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59468 X-GNU-PR-Package: emacs Original-Received: via spool by 59468-submit@debbugs.gnu.org id=B59468.16691768393836 (code B ref 59468); Wed, 23 Nov 2022 04:14:01 +0000 Original-Received: (at 59468) by debbugs.gnu.org; 23 Nov 2022 04:13:59 +0000 Original-Received: from localhost ([127.0.0.1]:53158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxh95-0000zn-6H for submit@debbugs.gnu.org; Tue, 22 Nov 2022 23:13:59 -0500 Original-Received: from mail-pf1-f173.google.com ([209.85.210.173]:39656) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oxh92-0000za-OH for 59468@debbugs.gnu.org; Tue, 22 Nov 2022 23:13:57 -0500 Original-Received: by mail-pf1-f173.google.com with SMTP id 140so16262163pfz.6 for <59468@debbugs.gnu.org>; Tue, 22 Nov 2022 20:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jEAB10/DKLENHxNC/ZYqqxScUkL3MNdWGFXidlSaScA=; b=bl6sW414Nrb6GgVhqPL62GwvRowZDgX8HMxtYu4h68SkmS1sqfOWREbQG0BQog/vPG H8QdAWO52hRXieC4CEkGXM7zslpzFhinvjhdAmI8XbBu+kRMp3reNU2pxZ5M7CSjm8jU 9EcoGpuiHZbiq/yhe7bxQJ+nqCaCmhtuaUmsH7vBLuogsTvL+avjtvV3TefAXIfvFt2X XqeKrVlJjWjXllhVLXknpBoXZ+nFmDgCgxwXFIg/HJVP1OEqOV4W4YWzLLnnNBs6piq+ d2tpnRj7047OnprGn6Q9AZVI0T+7oh/89Ss4649xzdCE70FNVFQXeV5z4q76BFxlSS/Z MJCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jEAB10/DKLENHxNC/ZYqqxScUkL3MNdWGFXidlSaScA=; b=t4CvK07kY1VoMW8xGujPZuGjQgmX8W1gyJkFQ0aoNCkn1k/169di4QAep0qptrgIbI 1mt4TsSXZI1Ery+ql1Vj38YV+rUip0/+d1MZGLBiT56UIcptkOoXFcBA2O0wxZ4dO/gH MhBdjeP4Qr4jk4Vw5VYWQQeIJr/XjEuaNhwQL3Oh0F17eIl5L653qz811KdXcyxB+whd N6MFV5exRInd+pqzZIx9x9mvbWdb2RyCWfUN4qKgmtD8JtiCAYgczwhpeLbaeb4ukJ3n LAw5MK+3JFc4/NRFJc6YqJGJyHybR8bmTP9nRl6pml0pWws5zxpUr9WwsofyviKMniGh 12bg== X-Gm-Message-State: ANoB5plCH0CkSlFWS3aWDuhBKYgK3tVHyunGrt487I5eHe6gsLlNo3Jd uZXSR8NHGi0p2YVd7+ts5J0= X-Google-Smtp-Source: AA0mqf7fchbxKRC3tNmCEdRJi5tf6ONzXgdJs6C5ztbwCHml98tSOBmYkgcLLbFGaXwkaM+PSLIO5A== X-Received: by 2002:a63:5b47:0:b0:437:e9f3:8add with SMTP id l7-20020a635b47000000b00437e9f38addmr6697362pgm.438.1669176830859; Tue, 22 Nov 2022 20:13:50 -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 g197-20020a6252ce000000b0056e0ff577edsm11463037pfb.43.2022.11.22.20.13.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Nov 2022 20:13:50 -0800 (PST) In-Reply-To: <83tu2qz6s2.fsf@gnu.org> 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:248706 Archived-At: > On Nov 22, 2022, at 7:30 PM, Eli Zaretskii wrote: >=20 >> Cc: 59468@debbugs.gnu.org >> From: Yuan Fu >> Date: Tue, 22 Nov 2022 12:11:17 -0800 >>=20 >> I=E2=80=99m not even sure the author of tree-sitter-c would accept = changes that >> try to parse macros: he has made it clear that the purpose of >> tree-sitter-c is to support post-processed C and leave macros and >> preprocessor to error-recovery. >=20 > What do you mean by "error-recovery"? Basically if tree-sitter encounters something that doesn=E2=80=99t = comply to the grammar, it tries to skip a number of tokens, and parse = the rest of the file normally. This way any error is localized and the = rest of the file can still be parsed. It could also insert =E2=80=9Cmissin= g nodes=E2=80=9D to the tree (eg, a missing parentheses) if that works = better than skipping tokens. Those tokens that are skipped are put under = an ERROR node, to indicated that they are skipped and normally = shouldn=E2=80=99t be there in well-formed text. > Is it possible to do something on our end for processing the error = nodes, > which would remedy the issue with macros? Or maybe some other way of > handling the macros by ourselves? For each of the ERROR nodes, we can look at the skipped tokens inside, = and look around with some regex searching. That would take some = non-trivial effort, I imagine. Yuan=