From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yoav Marco Newsgroups: gmane.emacs.devel Subject: Re: Tree-sitter api Date: Fri, 24 Dec 2021 12:21:16 +0200 Message-ID: <877dbu5mgj.fsf@gmail.com> References: <9C5A86D6-0E7D-4DDF-B211-278EF9AC7E01@gmail.com> <87a6gq5mxl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16526"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.6.3; emacs 28.0.60 Cc: cpitclaudel@gmail.com, theo@thornhill.no, ubolonton@gmail.com, emacs-devel@gnu.org, p.stephani2@gmail.com, monnier@iro.umontreal.ca, eliz@gnu.org, stephen_leake@stephe-leake.org, john@yates-sheets.org To: casouri@gmail.com Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Dec 24 14:21:51 2021 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 1n0kW5-00048K-SL for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Dec 2021 14:21:49 +0100 Original-Received: from localhost ([::1]:38498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n0kW0-00018v-Ak for ged-emacs-devel@m.gmane-mx.org; Fri, 24 Dec 2021 08:21:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:55198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n0hlK-0001ql-3z for emacs-devel@gnu.org; Fri, 24 Dec 2021 05:25:22 -0500 Original-Received: from [2a00:1450:4864:20::52a] (port=41654 helo=mail-ed1-x52a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n0hlH-0004DC-2x; Fri, 24 Dec 2021 05:25:20 -0500 Original-Received: by mail-ed1-x52a.google.com with SMTP id b13so31814072edd.8; Fri, 24 Dec 2021 02:25:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:cc:subject:date:in-reply-to :message-id:mime-version; bh=/JLY9tsGrQea+mdcxrcOxLQK5b1RVV8uISahDp0QeAs=; b=abRbabDsduEzhFkitjSlbVZYnK4liAfCcz1kVYI833DPYlkBTmkCFlOUJCzv1Eo57Y y+QJe5cu17szMpTchj4+5bh6+t1/TddX65Dm78XV+ylBojitZg0/BvUOQRqA7MymUiuG fCUAYQquh8xgdpP08nN/Lx30sHsGOLlKjbM9QZWPVLG4+uXkH4aMbzqRJoiL7nAhRO4Q VQXh7pNjj00+U0tx3fJbUSZTKiAA1BaUVYLoxHb8M1ibgZyoVH0kXNBcJO2GF73CwYU8 FclOlDdqx7NscFj+Ac00LVOom0pjFp4g8zjuVlsUVPp7mJzxUAyiOzyGq2XF2BoHr5v2 carg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:cc:subject:date :in-reply-to:message-id:mime-version; bh=/JLY9tsGrQea+mdcxrcOxLQK5b1RVV8uISahDp0QeAs=; b=ExEbzQP8KI3ipVl9ZUsgyiwO6MxOpCT04/brnvbcdMwZFbq8nThlPJhXxVzIoN0KG0 LwpM8Ns7uGtXBVoVMwzSgYEd5Jesl6pccofrfPEvQ5b/uThFa2Xlufdy00OpOchmDnPp gcvtqEafD+3b3eYWB/lm67llmcAfl4YFjIC1/rREkk8RRjRMHF6olB0gE0Bq5q5EtpFq T5YX6K7tSRaoEip7wiw2JZsF7k9yaMkiF+R4xwBGafxptSDLI/JpFdmnp/BSrpfX0aok ToZbNxnt4wt8xGOtXejOQTTF3t5OvGcnctYASU6OEjFTDAJSiYBOXjrEk94e6b9n+759 FdYA== X-Gm-Message-State: AOAM530k0/hNsAPlO5go8eiOg/1zt7Dgc9UtP7RT81iTkzISaO5R5E1h 3Miz4nEx6bVn8cgXl+u1uvU= X-Google-Smtp-Source: ABdhPJzp8krgZy1x8c1QOO+UsyQ6Gs635wys+u9XAkQwqRnRLcyIXgILxHrF0qwqFUu7qEnw4N7s9g== X-Received: by 2002:a17:906:130e:: with SMTP id w14mr5021057ejb.411.1640341516720; Fri, 24 Dec 2021 02:25:16 -0800 (PST) Original-Received: from localhost ([77.124.194.146]) by smtp.gmail.com with ESMTPSA id d18sm2867345edj.23.2021.12.24.02.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Dec 2021 02:25:16 -0800 (PST) In-reply-to: <87a6gq5mxl.fsf@gmail.com> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::52a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::52a; envelope-from=yoavm448@gmail.com; helo=mail-ed1-x52a.google.com X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SORTED_RECIPS=2.499, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Fri, 24 Dec 2021 08:19:31 -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" Xref: news.gmane.io gmane.emacs.devel:283138 Archived-At: > Yuan Fu writes: >> I can see some advantages to compile the query ahead of time. 1) It would be >> helpful to know there is an error before calling >> tree-sitter-font-lock-fontify-region and see an unfontified buffer, not >> knowing what went wrong. I can add a function, say, tree-sitter-compile-query >> that checks a query (as in query pattern) and passes it on if its correct. 2) >> It could potentially saves recompilation of the query. But computing the query >> most probably takes negligible time. I'll try to benchmark it. Would be great if it really is nothing. >> On the other hand, compiling the query has downsides: I don't know what does >> tsc-make-query return, I assume an internal object? I try to minimize the >> number of new object types I introduce to Emacs, for hygiene. So far I've >> managed to add only parser object and node object. If there aren't good >> reasons I'm inclined to not add a query object. So far the advantages that I >> see aren't very convincing. Yeah, it returns a user-pointer.