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.bugs Subject: bug#64017: Wrong conversion from Emacs to Tree-sitter S-expression syntax Date: Sat, 17 Jun 2023 16:02:58 -0700 Message-ID: References: <43D49A55-2C3F-4EA4-8DF8-0CD9A516573E@gmail.com> <0CBD145C-0A92-4258-A5F3-6FC616E89ED8@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.600.7\)) 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="38431"; mail-complaints-to="usenet@ciao.gmane.io" Cc: contovob@tcd.ie, 64017@debbugs.gnu.org To: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 18 01:04:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1qAexv-0009mL-4Q for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Jun 2023 01:04:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAexg-0003AV-3V; Sat, 17 Jun 2023 19:04:04 -0400 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 1qAexe-0003A5-Qk for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 19:04:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAexe-0007EY-53 for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 19:04:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAexd-0006Lw-VB for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 19:04:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Jun 2023 23:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64017 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: Basil Contovounesios , Bug Report Emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.168704299524363 (code B ref -1); Sat, 17 Jun 2023 23:04:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 17 Jun 2023 23:03:15 +0000 Original-Received: from localhost ([127.0.0.1]:52790 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAewt-0006Ks-G3 for submit@debbugs.gnu.org; Sat, 17 Jun 2023 19:03:15 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:37136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAewq-0006Kk-Q8 for submit@debbugs.gnu.org; Sat, 17 Jun 2023 19:03:14 -0400 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 1qAewq-00037e-Jj for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 19:03:12 -0400 Original-Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAewo-00072q-VV for bug-gnu-emacs@gnu.org; Sat, 17 Jun 2023 19:03:12 -0400 Original-Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6b46831fd13so278273a34.3 for ; Sat, 17 Jun 2023 16:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687042990; x=1689634990; 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=5RddoXXl6F28VWQozBCKEL4+0F4WlwIQBf4ncVt/LaU=; b=RmEJiPnNH1vcp/d25ekUo/IlJ98EIxLqI9vrKgxI7QFc/xOpFyptzUMPL3PxEbQp0j ZACVseq2xYNA2frnuhDcNeRhb9gs6j1OzS+GbNlIG/2X4y1Y4gABWetjL4w9N/Jh/PLI dM6ZrUiu7M4hXSu2xMGwQ1V4OkJVCYCwrZrTLRJbI1leV3u4hk1rvTpVniuUblDfTMw6 //XvuJsWZxmhy8kLIPSgRXw+atK4NzvdH7Hs6iYpbGuABTvETX5MyeMWRh1BTdrxD8IR qijt/CSrcB5azrBLc49eH8y6ZsKaLz8zKsj+JlWlJ3TZCrs9BJfONCTql+Lj600H/dUH jzAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687042990; x=1689634990; 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=5RddoXXl6F28VWQozBCKEL4+0F4WlwIQBf4ncVt/LaU=; b=j4v1ejvUMT+Y9CHl+1TJZK6Mx9Wh+zAbSo7yB9mT0PmPziKU7wrVYAl2FA+8KCheSA 5nipJQIMlU9cWqS9h59Uq17m9FcldiB8F4D+R6PlkdWr3YiOZ69XHojPPTgiIxt9UL/8 QxrKx4GUNTzDOjPr5plORJFQorpi+aGTExZJskwaL5SkB8N4M3Zfzj5+kSdvplXnr3Ub XaGatyw7r7dbmyfK1SLpG2KXnKWGrzzfsBrKLVQMp6x1Ndk4S3RVwjrwDUqZ+UKtoTYT B6ewjAQRFlN/jBGx0D6AwwxeqvrBY80lJU0Tvu/3gNX2fcsl+mO+UNNsU9CytKrDL5D8 ZWig== X-Gm-Message-State: AC+VfDx1Qq2v5miVmSZ3K8EuHjdmx76vywdrjGpfCOFaZ0JKoPG168oD ZGr23Jlr+QkMMNtry/ntvBI= X-Google-Smtp-Source: ACHHUZ4TNkSl+N03cLdfGg0EYd9nZWhszDCWrJBumYvK5YKhkhzGpr9liwEBZXiZijJm5a48tbjoCA== X-Received: by 2002:a05:6359:203:b0:123:3cc5:e6be with SMTP id ej3-20020a056359020300b001233cc5e6bemr3470022rwb.9.1687042989628; Sat, 17 Jun 2023 16:03:09 -0700 (PDT) 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 k5-20020a170902ba8500b001ae5fe602c3sm17944555pls.159.2023.06.17.16.03.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 17 Jun 2023 16:03:09 -0700 (PDT) In-Reply-To: <0CBD145C-0A92-4258-A5F3-6FC616E89ED8@gmail.com> X-Mailer: Apple Mail (2.3731.600.7) Received-SPF: pass client-ip=2607:f8b0:4864:20::32b; envelope-from=casouri@gmail.com; helo=mail-ot1-x32b.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, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263586 Archived-At: >=20 > Yes, so it seemed to me but reading the source code (lib/src/query.c) = seems to indicate that what I thought were symbols -- *, +, ?, @thing, = #thing -- appear to be special postfix and prefix operators. = (Ironically, there doesn't seem to be a grammar for this language = anywhere, or am I mistaken?) >=20 > Thus a structurally correct Lispish translation of >=20 > (teet "toot"* (#equal "fie" @fum)) >=20 > should arguable be something like >=20 > (teet (* "toot") ((# equal) "fie" (@ fum))) >=20 > rather than the current >=20 > (teet "toot" :* (:equal "fie @fum)) >=20 > but I'm not demanding that it all be changed at this stage. IMHO the query syntax is already pretty far away from a =E2=80=9Cproper = sexp=E2=80=9D that we expect, so changing these little things don=E2=80=99= t have much benefit. For example, the field names and trailing capture = names are not conventional, are we going to change them to be more sexpy = too?=20 In a proper sexp they would have been wrapped too, like (field-name: node) rather than field-name: node (@fn node) rather than node @fn Not to mention using colon and @ to distinguish field-names and capture = names from nodes=E2=80=94not very conventional either. Also a more conventional sexp syntax would be much more verbose than the = current one, and arguable harder to translate to the tree-sitter string = syntax, which is ultimately what we feed to tree-sitter functions. Yuan=