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: Call for volunteers: add tree-sitter support to major modes Date: Tue, 18 Oct 2022 18:36:08 +0800 Message-ID: <87h701beqv.fsf@yahoo.com> References: <83czb1jrm3.fsf@gnu.org> <878rlo7on0.fsf@thornhill.no> <83k04y1gd2.fsf@gnu.org> <87wn8xbyr2.fsf@yahoo.com> <713135A0-FF74-43F5-969E-CECDF3C02DE6@gmail.com> <87sfjlbpw9.fsf@yahoo.com> <21B0931E-728E-4F17-8BC0-D8218BE65489@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="23009"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org, Yuan Fu , Alan Mackenzie , theo@thornhill.no To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Oct 18 12:42: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 1okk3A-0005qB-9a for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 12:42:20 +0200 Original-Received: from localhost ([::1]:37492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1okk39-0002yI-4W for ged-emacs-devel@m.gmane-mx.org; Tue, 18 Oct 2022 06:42:19 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39108) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1okjxX-0000CT-As for emacs-devel@gnu.org; Tue, 18 Oct 2022 06:36:37 -0400 Original-Received: from sonic308-56.consmr.mail.ne1.yahoo.com ([66.163.187.31]:36136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1okjxS-0006f8-3L for emacs-devel@gnu.org; Tue, 18 Oct 2022 06:36:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666089382; bh=Lg9Ve1a/U+iGr6r09/p9aUhZ7jK/vw3cEE5zU4KiSBE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=rqXtOE8Y3XkgugV6SM0RYx0xd6jSXz4Sw2X+8QS41GboZyvsX9v5o0gQ9GRhJYG1TPXhin0jZOwdxlMon2YqhNxiusSZUkIhNWMGQq5H7/X448TDqbSVk5hhbneFmMbMD6w92DpkxH0BJl/9gapkGGsOVaUVC4eXuZ4QulJNXu1yhagCSjSBpqTZ6men3SzExJ1wFLqL/b5gezkPRTsVs6WNoZYnri2Zu7bMm63x5Zp+AjAjrVnWAU3B8Y/OhCyvK6Hr8Wv/wBnwXx+TRmT2PFpJDRAeRV3cI0DaWUpY/bOSP5c9Ez8VPxIl0vy7oivbpT+1+GrR2FlwisMJx5NSzA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1666089382; bh=to7eft32H4Be8jpjBAuX5SOA53dwc9y0J4Kdlb/IOeG=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=J7x6Q+qC/6cso0y8ludKmlhfK7SFXdjsd6iZ388QenDhLczju8ohSvHhTEYaEs7F9sAO2MstsO1zGEF802/k1fOgpPqvnbuQf5J8merxI3QHqBoo1NvNaJRxa4cWmGIBXIJS2k4CCWjMA6wfpj05/DG8K6/VTUCLRAvFIacTccrqWs/TQ0eUZwt/RO3zlGLVtEvXVaUXzZrUiUwzIJfeMDFIGQGBiNplfTjpdJRvV+zDrRYir2vBNtYqabgYu+b96F7mHrJ7SVm3Vqe+bAI5KKjVMSOacAGSojvPuHqfgDwSmAipk7DYWmsvl5cG+Is+FPjUcOksx+3T+vfF0OituA== X-YMail-OSG: N.eyX70VM1nl4yj56EV1kAK59IuaYXND8GN4nvqEvnPdm9oI4IhgTfUf.eOpovM CgJYd6DUaQAFHbKap_mf69SozDe06rpZqYxzZw4DRtdhzn3ClGSm8ZB7hk19VKlPXmm9cQGwC9Yc kqLfHxe7JdAbM71wXJz0ilT4WblKNfpN6dtvssWm5Qm1L6P9sLJUoKCHfGnB6h1LkorI5fOUOfQP n5G6g1lUV4mUXPuKmY_HEbVu7Gc1rGbYGoVno3KGkLya5GTr7ri89cBVcR8YurTLw.HXGRy4wJ7Y sK.cBaYRpIuPLGplzxSX9UCVSF11XkzPU78GSA32NGDKMPsX4.TiRwqLXSCM0uKm9OXeAtOSPTx3 e_4cUzRJKfQtDArvem0_M0GRwp0.YC6j63ci.so9BNQuJ8CLTTi3CrLRrHJN49xJGd6h3JDRrsWq ZOXDOSWdPV5Y3vqUP4m6kgMxw5YfpBH0lh28KsuC3OVfaV0fCzLFjb5dwWje86kOku92kWs80hDw NJaDruw1LqqQm6txTULqrT51tcGjkUvW40pmvgTfLsrrodZ_XwIxBcEQEncobm.mmZDwpEuXL0Nl NqVbCZCJVHm4ZEdj.dVJMh.u_OLzfGv.auL8f5zHG6viUw447nzBikjXlf8mETD2AA4nlaOsZXfn b4tFUHSAGEeR0p5C8BB_FTBee6I7nUUpdm5GbS9Y9icOEvWUKKG3to9VkpG.VIKYRiw.4OpmlYVT bT82AkIMQjoHrUaDg.DGXrvzzTHnRGWPxmE.LKEvKflKWgVtlYM36V32MVE9cij7Nwj8yaTTfrF7 elb59p5zUqVTU3FBag_age6pjoUcwmJ6.YhsPFxrDY X-Sonic-MF: Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic308.consmr.mail.ne1.yahoo.com with HTTP; Tue, 18 Oct 2022 10:36:22 +0000 Original-Received: by hermes--production-sg3-785466d859-xnk8q (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9adf1efafd439f2d5a5ed6ffccd6369d; Tue, 18 Oct 2022 10:36:16 +0000 (UTC) In-Reply-To: <21B0931E-728E-4F17-8BC0-D8218BE65489@gnu.org> (Eli Zaretskii's message of "Tue, 18 Oct 2022 12:45:50 +0300") X-Mailer: WebService/1.1.20740 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo Received-SPF: pass client-ip=66.163.187.31; envelope-from=luangruo@yahoo.com; helo=sonic308-56.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=unavailable 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" Xref: news.gmane.io gmane.emacs.devel:298028 Archived-At: Eli Zaretskii writes: > It does? Which part(s) are "much worse" and why? > > The code you presented is invalid C, so I cannot see how we could pass > any objective judgment about which fontification is "correct". It is not invalid C, at least not for this (proprietary) C compiler. Anyway, I'll try to explain what the problem is with the fontification. BEGIN_A_KIND_OF_SECTION starts a closure, ENTRY (dx, dy, shx, shy) expands to the important part of which is a nested function declaration (that is then put in a struct, etc, but that is not really relevant here): [use: fcsr, f20, f21, f22 capture: etc] __section_name_entry (dx, dy, shx, shy, AP, ...) float dx, dy, shx, shy; frame_t *AP; { ... Notice how tree_sitter fontifies everything between ENTRY and shy as a type, while dx, dy, shx, shy are actually arguments in the "K&R area". They are fontified correctly by CC Mode, which only fontifies "float" as a type. The fontification of "_P" is also wrong. It is a macro that expands to nothing if prototype checking is not enabled in the compiler, and otherwise literally expands to each one of its arguments. Yes, the way the macro is defined is not standard C, but CC Mode has so far fared quite well: # define _P(args...) ##args register float is the type of argument that is expected to be taken by the closure. There can only be several: register float, register doublefloat, register int, doubleword, long. section_name is an argument to the macro, and is used to name both section_name_desc and __section_name_entry, and other things: struct [align: 8] proc_jump_struct section_name_desc; [use: fcsr, f20, f21, f22 capture: etc] __section_name_entry (dx, dy... ... section_name_desc.entry = (char *) &__section_name_entry; ... and more code here ... so it should not be fontified as a function either. In tree-sitter, "cells" (an argument in the K&R area) is also fontified as a function. > This kind of "argument" is not useful. Why?