From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.devel Subject: Re: Tree sitter support for C-like languages Date: Tue, 15 Nov 2022 23:57:13 +0530 Message-ID: <87zgcsul8e.fsf@gmail.com> 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> Mime-Version: 1.0 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="21116"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Stefan Monnier , casouri@gmail.com, theo@thornhill.no, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 15 19:43:21 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 1ov0ty-0005E8-Kh for ged-emacs-devel@m.gmane-mx.org; Tue, 15 Nov 2022 19:43:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ov0tO-0007TH-FM; Tue, 15 Nov 2022 13:42:42 -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 1ov0eX-00016n-Dd for emacs-devel@gnu.org; Tue, 15 Nov 2022 13:27:21 -0500 Original-Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ov0eV-0004Jx-Ko; Tue, 15 Nov 2022 13:27:21 -0500 Original-Received: by mail-pg1-x543.google.com with SMTP id 136so14052898pga.1; Tue, 15 Nov 2022 10:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BvcMjqH6qX4nuGKwPrXVvrg87Vt2pJrUVa89ThjxKis=; b=ZQNIPxQd65ijvyVe/m/5banQDdwwhfiIzqRVw5AJkee/0XvXV6+KSht/GlJvT5h1L3 aWv7sSQq0LK+H68Svfm/TOcG5CFN1we2QJRa/Lt7+WpO/2BgsMFdunn5ntEyPDbOeytX UndfxEUw49DCW9+tBDrc7AZWMtzhl4cAWpt4dnmgWXWFh4pbdIVFuWmoe8HqXl8ahaF4 umsgZJKeCxzOukQSoVR2w7PqqF8FE0X8pl5QycanSc1jQqydpozFE5434DooqBatxGtV CX5gXQ86l+PgSFekocGf1GaszCDpI9EcWONFxZrhRcxDGj0vwUVyINVPOjbeVeI6oqMY hxGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BvcMjqH6qX4nuGKwPrXVvrg87Vt2pJrUVa89ThjxKis=; b=MbGG9qZBjq+nHd8TpOzlYKW7e0LCEAYrKx9xhH4Ix/oDheUEyPPapIAB3jtV3yobO4 PJpHUsrltbkR2zErR1GywJHy7Dqf7MsIv57bKTdVGwd1L/CWaLt/DIsYAt8jzaPYBkD0 JJFTnZgWgfeBAzG6XN4rF1CfIhzGsh8nJsVRNwxX5MDv16Sg5OIL9ZjtG9jLo/v0B80k f2gmDU3uSUh59oMY/qp3fCJUCPAVTR57RYZWm3Tqo4b+jSL5pKl3Q9ZVueHQ06CxUZDe qBrQ4CAo/N1oFFqdqNFY+m3+8NPKxe0fzdTC3cg6GRAP1/L2q800SP9U8ZdmiWqSFv1a GSmQ== X-Gm-Message-State: ANoB5pnMFrEci59ZFSticQkUhhtSuynItajuN4f4S42qAjhkMr1DixUj Hv9nBAMMYSa3jwrzAR3h8pAbnri4Jd8= X-Google-Smtp-Source: AA0mqf6eo299CsOPVsre3JpXGSuYFzNcFexeO+YpPuGGwvPZExwsr21c3w6O5ZW/5mCKXXFbrAI5pA== X-Received: by 2002:a65:580b:0:b0:434:c0ca:b376 with SMTP id g11-20020a65580b000000b00434c0cab376mr16360020pgr.180.1668536837406; Tue, 15 Nov 2022 10:27:17 -0800 (PST) Original-Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id q101-20020a17090a1b6e00b002130ad34d24sm12046907pjq.4.2022.11.15.10.27.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Nov 2022 10:27:16 -0800 (PST) In-Reply-To: <835yfgi26h.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 15 Nov 2022 18:59:34 +0200") Received-SPF: pass client-ip=2607:f8b0:4864:20::543; envelope-from=visuweshm@gmail.com; helo=mail-pg1-x543.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-Mailman-Approved-At: Tue, 15 Nov 2022 13:42:40 -0500 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:299870 Archived-At: [=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] E= li Zaretskii wrote: >> 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. > > 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. > >> So my guess is that this is going to be a "wont fix". > > 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. 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 cust= om 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).