From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu Newsgroups: gmane.emacs.devel Subject: Re: tree-sitter: conceptional problem solvable at Emacs' level? Date: Thu, 09 Feb 2023 18:13:59 +0800 Message-ID: <87r0uz4048.fsf@yahoo.com> References: <87zg9n45ig.fsf@yahoo.com> <83h6vvmdcc.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5278"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: holgerschurig@gmail.com, Emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 09 11:16:42 2023 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 1pQ3yr-0001Cj-Nb for ged-emacs-devel@m.gmane-mx.org; Thu, 09 Feb 2023 11:16:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQ3yS-0004bH-Ji; Thu, 09 Feb 2023 05:16:16 -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 1pQ3yP-0004b1-Ei for Emacs-devel@gnu.org; Thu, 09 Feb 2023 05:16:13 -0500 Original-Received: from sonic309-47.consmr.mail.ne1.yahoo.com ([66.163.184.173]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pQ3yN-0005Or-Np for Emacs-devel@gnu.org; Thu, 09 Feb 2023 05:16:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1675937769; bh=5QENstt8dLHfPlshm2Uwa3qig62GaJPjQM2uKnfXPvo=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=V1PNbNrU1Z4PV+090A3sl3JCLv6Y0GbZIvdQrzgdbEPk9xttAR2nKT6lNhhDOF8q0A/S019Kao+GA44PU+tpMyqA+Gf91nTsO6exBedbl2DGqmHtvi4cdvgfd3HZf7kPPtXAm1+1gfpT3PTdWEOkXoaUhbfb/u/Koyj1no0wJKd5ul0JI7PI94cWqoV5T1mlaXJkAYin1qPMQDR5oxD2Y54WsF/OUdAlKPuHjB19trYmf/a3Pz+o4m6tSvuGat6955RDOOEm4nYSdej5wyukvVqBdIp3dTIKYwdWpou2nx1wOB4FrbSe866+4IkRN1fdxQpzp+fLiTsJqP5Vcben7A== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1675937769; bh=yYqV+QbvZlmcZgZbYnAvsIzSGYD3g74vakWrPcKOFk9=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=cGH3fqu06e6hwcKAbK6I7t6KwQWhUvyUKnEHiInZ5jFtJJec07vbKQX0Vj51iZ/2kJE5Foo/qooL7J4yG/bR76TlafYqthKOxjRdrpUOa75gIWbNr13+WjUs5AaBpx8ToiiXS8WaEjVULJ2RlPebyb4WepP1NdEl+1Jp2t2xGOe7MhQdpjEJ+KcJCo7nohZf5d7NVlEfHkE79UamWGVKaP689iA4hU4KrJdJBNi3JpLcTRK+2dZga397yIRz+ukm6DfIQGRzR547mgPbwmeWe9wM2cwVkUEVURILQPFXgyagQbDQ1Za28fktHAXGBt8pxvX1UOb74YvJvnyZjFpWfg== X-YMail-OSG: .2a7210VM1n2Fs1TDcywzUT.LRkVd8LByYEnn3jctgl0r93X0p0aaiRtfsShtjQ _TRjbZvNER9qPbW1nOvboJptjzlv0cONFhILjRKW2kuFyuJyFdHPY3dFwOf2a3a1b0_JrvQtb8FT yT1bNZKufpmN3V0nhN4D9UyhFjJ3TSev4qB9VI32V.48c.cWXQSIENZO2039K99sX4Ud8RtZdXI2 eQOVzm70ge7aSbatUjJIkpja9OTUnaK2n_ddkgTYtZTuUIcczaZsL0a_RnK2nLgoMi6.5VbJEqUZ 0jubiWFVTuGvfAp2TNPjgecHr51XX8xgqhup.pGVde8j4e_icQzNhnZ3LgjZr5S7p2ajLZwICk3Q .k1tpmMIjbRQ8YFeYD2x.5GX44Z7ZdZjgt1LIjet8Y_bfhSiZnu3v.1Ty.4PooRGQSzB00DeAnLj hVYqXBy82VDiUIUUtB0nmIFFQCQ.24ILoW2zbS3gusgK2A1Z3TLqp31kSGghGiWycoIUR98SroOc FsHUFPFTrPX2cQ1SurlLYstukeO5VgM4TGaIqLGS_ZfUDmFvTMgm.kFggbMJdOeOR_NSJKCHTSU0 epgMndt9kzGhLNaVsXHbu3XWgLbMDxlTwNWK1kyM.vYArEJHY7rt73yYjIX0ESrzzKycN6DpyOUU Y.9dWLyj_OhBSV_dhTZe6F.ITLnddnCTq9kghtadOqBIDthR9L4CJBorqPLKXBVc9uuGbCMDxtV. LhO_oEdIznc9A36hTxqGrUSiNSoFYWDLwMNhaCXtir5eYpuVB8.Y1lTbe0ARgSsibaKE4wodsrHo swhacFK6YxIZj4VJkOnBNBBFACD3mrrLDZ9EDqaXEg X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic309.consmr.mail.ne1.yahoo.com with HTTP; Thu, 9 Feb 2023 10:16:09 +0000 Original-Received: by hermes--production-sg3-9fc5746c8-pz6sb (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c6eba993f77519e7c87350ed462df47b; Thu, 09 Feb 2023 10:14:06 +0000 (UTC) In-Reply-To: <83h6vvmdcc.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 09 Feb 2023 10:50:59 +0200") X-Mailer: WebService/1.1.21161 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.184.173; envelope-from=luangruo@yahoo.com; helo=sonic309-47.consmr.mail.ne1.yahoo.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:303070 Archived-At: Eli Zaretskii writes: > Suggestions for what to do for now aside, I would still want us to try > to figure out the possibilities for better handling of C/C++ macros in > tree-sitter supported modes. I don't want to give up yet, because the > kludges similar to c-add-style used by CC mode might be possible with > tree-sitter modes as well. Or maybe some other solution could work, > including the idea of letting tree-sitter see preprocessed source code > (although this is probably harder to implement, and must be done on > the C level). I don't oppose us trying, I just see problems with trying to parse C macros with anything other than guesswork whilst maintaining reasonable speed. Preprocessing C can be very slow, and might not be easy to set up to run on each edit, which would be necessary to let tree-sitter see preprocessed source code. And once you start trying to do that, you have to determine how to run whatever C preprocessor is supposed to preprocess a file. Even language servers, which are typically entire C compilers, fail to understand some kinds of macros not written with them in mind. I guess one example would be the very compiler specific ``macro''-like keywords used by various compilers to designate long and short interrupt service routines, or Intel's ``near'' and ``far'' keywords.