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.devel Subject: Re: Tree sitter support for C-like languages Date: Tue, 15 Nov 2022 10:36:09 -0800 Message-ID: References: <87tu36em9t.fsf@thornhill.no> <87v8nkgcqj.fsf@thornhill.no> <87sfiogcbm.fsf@thornhill.no> <83pmdrkyj7.fsf@gnu.org> <87v8njw5th.fsf@thornhill.no> <83leofkwjm.fsf@gnu.org> <9E9244D3-2EFB-4621-91E0-FC8B8C1C2D52@gmail.com> <186915C1-1C47-43DC-A386-B447A2E7528D@gmail.com> <83h6z1k6z8.fsf@gnu.org> <52D18BA8-C9A8-4E9A-9DDA-76E48744DDC9@gmail.com> <837czxjrxu.fsf@gnu.org> <8BEF109A-A5B3-4CF4-AE07-AEB9388B0A07@gmail.com> <83zgcti9gh.fsf@gnu.org> <83y1scj3s8.fsf@gnu.org> <7082237A-2BD6-4A1C-8BEC-4D470B0D204F@gmail.com> <83a64si7jo.fsf@gnu.org> <835yfgi26h.fsf@gnu.org> <87zgcsul8e.fsf@gmail.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="27877"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Monnier , Theodor Thornhill , emacs-devel , =?utf-8?B?VHXhuqVuLUFuaCBOZ3V54buFbg==?= To: Visuwesh Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 15 19:37:09 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ov0o1-00071v-6A for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Nov 2022 19:37:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ov0nJ-0004AW-GC; Tue, 15 Nov 2022 13:36:25 -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 1ov0nD-0004AA-4Z for emacs-devel@gnu.org; Tue, 15 Nov 2022 13:36:19 -0500 Original-Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ov0n9-0005uq-Ic; Tue, 15 Nov 2022 13:36:18 -0500 Original-Received: by mail-pl1-x62e.google.com with SMTP id j12so13960092plj.5; Tue, 15 Nov 2022 10:36:13 -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=a/PAVFDy/TiMwkjKPd2EJ9OXdtjOM8jAfmJqCEhED5c=; b=fpMROXM4FOrZMmogYIucGE575agqRDb/Oy+8nHoA4usG5M0KR8auLZbBXxtyFW9nd2 ECOTgeBf0qOOck2iFZDkh54bUW1yHZgoQiHFMH4+rOO8A/SMldrmjDYxmJyFRQRm3d7r 1lFC0PxJ3ofSOXuMHwdE1knzYPrLdp0iMTVLqHSmsraJRvGsCYa7Ek4Yoq7pAdyieQic hQdrbSE0Rm1yKIxIY5RBgVCrLGDQXYShXZnZwyk09aeV4vthIOdWlUKwX6IiPYBFHSIK HwqVRKS93S9gFpAxWDs7tNMCS6wPtKzS33+HTbXQ0WNDQR+JBES8A9SX/Wsk2TR/SWGz VnqA== 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=a/PAVFDy/TiMwkjKPd2EJ9OXdtjOM8jAfmJqCEhED5c=; b=P1QjVNHvRrf7cx77AppEJeIQa37TVhtZswfFZ4qSNXrb0tTXcPd4OHwx80zykTDuEo YJRks2IAXTn3iu8TkQQwPyRYHGvLbZWeVeDVkuj1JospFMGd7V5efDACfJWVL7+6bcOq RtVk+LSbZxjHtls27Ypf0ix5jAWGFhBxzhJAWob5kSgsc1DIJq5AqrVcOhscvMddAxgt G2hYVmnqOGfaUykzlk7e/4oMvF8BA+/PaJvwj4O0ROVzllIpJ/wMZ+H+2DvZ9s0GVxiL ZmnfJT2di55P80PRNH+N4C7Jv1Yk2Ctj2l88yu0i+JB3+xoe+raVkmPxzPAmgm/VLgKh 7XwQ== X-Gm-Message-State: ANoB5pnYWuhPUFBtNhiMs9UBiei6qAmzLkfTAlqLGCsEQwLeGva+48Gr 0C5KQhxBevH+7QVY+FAiRxg= X-Google-Smtp-Source: AA0mqf7k9YQIFIpL5WdMQ23Bgvu5VxejBBS+HBMmW9w8yZujXDNAfap8V9CfV2mAg5/BFhEHshSuTA== X-Received: by 2002:a17:903:2d2:b0:188:4f86:e4d5 with SMTP id s18-20020a17090302d200b001884f86e4d5mr5424546plk.16.1668537372307; Tue, 15 Nov 2022 10:36:12 -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 k3-20020a170902c40300b00176ea6ce0efsm10356445plk.109.2022.11.15.10.36.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Nov 2022 10:36:11 -0800 (PST) In-Reply-To: <87zgcsul8e.fsf@gmail.com> X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=casouri@gmail.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299868 Archived-At: > On Nov 15, 2022, at 10:27 AM, Visuwesh wrote: >=20 > [=E0=AE=9A=E0=AF=86=E0=AE=B5=E0=AF=8D=E0=AE=B5=E0=AE=BE=E0=AE=AF=E0=AF=8D= =E0=AE=A8=E0=AE=B5=E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=B0=E0=AF=8D 15, = 2022] Eli Zaretskii wrote: >=20 >>> From: Stefan Monnier >>> Cc: Yuan Fu , theo@thornhill.no, = emacs-devel@gnu.org >>> Date: Tue, 15 Nov 2022 11:01:24 -0500 >>>=20 >>>> I guess we need to report these to the developers of the = Tree-sitter's >>>> C parser? Is there anything else we could do until they fix >>>> the parser? >>>=20 >>> AFAIK the tree-sitter parser parses basically already-preprocessed = C. >>> It's wickedly hard to parse meaningfully notyet-preprocessed C with >>> something based on a BNF grammar. >>=20 >> There are a lot of macros in our code that tree-sitter based C mode >> gets right, so I'm not sure this is accurate. >>=20 >>> So my guess is that this is going to be a "wont fix". >>=20 >> Maybe we should grow some augmentations for tree-sitter, at least >> given enough time. Or maybe it's possible to identify the parts = where >> this happens by some tree-sitter indications, and tweak the faces in >> those regions in some way. >=20 > I'm not sure how similar the emacs-tree-sitter > (https://github.com/ubolonton/emacs-tree-sitter) and Yuan's code are = but > in his EmacsConf 2020 talk, Tu=E1=BA=A5n-Anh Nguy=E1=BB=85n wrote some = custom > tree-sitter query (?) to correctly parse our macros and highlighted = the > type, the function name, etc. with the approriate faces. > You can find his talk here: https://emacsconf.org/2020/talks/23 and = his > demonstration of the Emacs source code is around the 20 minute mark > (after a quick search in the subtitles). Oh nice, I=E2=80=99ll check that out. CCing him for some insights :-) Yuan