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 documentation Date: Mon, 7 Nov 2022 12:47:30 -0800 Message-ID: <14DDD315-2399-41F7-B1C6-10433C27CF5C@gmail.com> References: <48A65188-BBC6-442F-A552-5FEA1416F936@gmail.com> <83a653ynec.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="12316"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Nov 07 21:48:01 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 1os92G-0002uX-Id for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Nov 2022 21:48:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1os91s-0001a1-Tj; Mon, 07 Nov 2022 15:47:36 -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 1os91r-0001Zl-Fi for emacs-devel@gnu.org; Mon, 07 Nov 2022 15:47:35 -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 1os91p-0002nQ-TC; Mon, 07 Nov 2022 15:47:35 -0500 Original-Received: by mail-pl1-x62e.google.com with SMTP id l2so12135667pld.13; Mon, 07 Nov 2022 12:47:33 -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=ibTn6GshBVauv2yhI//BhXIS3LAQKBTgU6fV3HlogvA=; b=qrq+44rbb29gEfEQwxys42+uc3p/mCfT3tOIfNe0v1DKrwYaY6XUxNXTahG7DpVi+w kVCz1oYVZ+nveBP7t00F4EKmORZf1QPa35BpXMA+4FT40KaGYFJmF+ThaqKY1hfbBZBb EQ+7Zg1kKboKqu5oUzuTCXVmBy8DDkpDOSIrEp9zp8i5xc4a+gpzNr5MZUNhv9i4t2/P WMNTH7uBFzQZbvtuTjdC0c4LQ5NciKxdQe60KhqkZV6XVAUG+cIcWKuCwj7nazhAFyGx NMPSJPNfil4vO/x5aLTElfTEtpJ/XeSEAXKQXGU0McQv0AHso6UHyIoBkJyFWu31pSeZ M9KQ== 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=ibTn6GshBVauv2yhI//BhXIS3LAQKBTgU6fV3HlogvA=; b=hXWLbXEMSz8x//yM6mfBpH/WGmA+QoNX4V1SnYgSQcAbOewZZPST9Yl7m82ny2nm5X EZXkZaxkOncZ2pgNAKm7n4JufDzcjDO2unmmlvb5ts/IAw2HMp2dSH/sDJeJsFSmCpkQ OgxIkbppDBmcvY1vh7Wd9I38fTDS9uEzRPL1w07aKAZxT27Kr7tPE2mPa4jluL4cZXzz UrZNd1C8WxIt9Gm7jrTnFTkUjfYRii+QSyyqAHNnPRT/2yqMsbi4+uYNVcFwHSLJuPJQ 9t5l653vLgqiS0+YjIhbp5SewvhXEmCO82C1VchTTxD9xd2nz4Pc/udDbsfKrlNHQ8jT RT3A== X-Gm-Message-State: ACrzQf1E+j7UKO8cW8RQ/FlStn3A8IdR6BdOu9xsRK8kWLy2nAWI1LZR bufrgBfBnE+2xbkTq12NAM4p6ri5GAo= X-Google-Smtp-Source: AMsMyM6NifodTRcMG/oQEtETq6mwbyRyXiECoUsr8zt/iNV7Epn//CqCIvl2yirJULmcBnUHjZ7+Qg== X-Received: by 2002:a17:90a:600a:b0:213:2a:851c with SMTP id y10-20020a17090a600a00b00213002a851cmr70023339pji.177.1667854051900; Mon, 07 Nov 2022 12:47:31 -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 iw17-20020a170903045100b00186a6b63525sm5387303plb.120.2022.11.07.12.47.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Nov 2022 12:47:31 -0800 (PST) In-Reply-To: <83a653ynec.fsf@gnu.org> 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:299306 Archived-At: > On Nov 7, 2022, at 4:11 AM, Eli Zaretskii wrote: >=20 >> From: Yuan Fu >> Date: Mon, 7 Nov 2022 02:13:20 -0800 >>=20 >>> This function takes a series of @var{query-spec}s, which are = triplets >>> @w{@code{@var{:keyword} @var{value} @dots{} @var{query}}}. Each >>> @var{query} is a tree-sitter query in either the string, = s-expression >>> or compiled form. >>>=20 >> Is is ok to use =E2=80=9Ctriplets=E2=80=9D here? Because there can be = more than one pair of :keyword and values before a query, eg, >>=20 >> :keyword value >> :keyword value >> query >=20 > In that case, "triplets" is definitely incorrect, but I had no way of > understanding that this is possible. >=20 > It should be possible top describe this kind of argument list, but > does it really have to be so complicated? These are not internal > functions, so Lisp programmers will have to battle with this signature > all the time. Can we make the function's signature easier to > document, understand, and use? >=20 > For example, what about accepting an alist as the argument, where each > alist element specifies a query and its keyword/value pairs that > customize the query? Alists has too much layers of parenthesizes that is verbose and easy to = get wrong. Compare: (treesit-font-lock-rules :language 'python :override t :feature 'string '((string :anchor "\"" @python--treesit-fontify-string) (string) @contextual) :feature 'string-interpolation :language 'python :override t '((interpolation (identifier) @font-lock-variable-name-face))) With (treesit-font-lock-rules '((((string :anchor "\"" @python--treesit-fontify-string) (string) @contextual) (language . python) (override . t) (feature . string)) (((interpolation (identifier) @font-lock-variable-name-face)) (language . python) (override . t) (feature . string-interpolation)))) Yuan=