From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: parser error recovery algorithm vs treesit indentation "blinking" Date: Mon, 03 Apr 2023 14:47:29 -0700 Message-ID: <868rf8vdse.fsf_-_@stephe-leake.org> References: <87lejgsf0m.fsf@gmail.com> <83pm8s70o3.fsf@gnu.org> <83mt3u65vw.fsf@gnu.org> <87y1newqus.fsf@gmail.com> <83bkka5z7w.fsf@gnu.org> <871ql6a4d4.fsf@gmail.com> <83jzyy4776.fsf@gnu.org> <9F152CAA-6326-459F-84FF-87988B3A92B6@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="36170"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Yuan Fu , Eli Zaretskii , theodor thornhill , geza.herman@gmail.com, Daniel Colascione , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Apr 03 23:49:41 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 1pjS3Y-00097V-FA for ged-emacs-devel@m.gmane-mx.org; Mon, 03 Apr 2023 23:49:40 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pjS2k-0000qo-34; Mon, 03 Apr 2023 17:48:50 -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 1pjS2g-0000qU-02 for emacs-devel@gnu.org; Mon, 03 Apr 2023 17:48:46 -0400 Original-Received: from gproxy3-pub.mail.unifiedlayer.com ([69.89.30.42]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pjS1Z-0005LD-My for emacs-devel@gnu.org; Mon, 03 Apr 2023 17:48:45 -0400 Original-Received: from cmgw13.mail.unifiedlayer.com (unknown [10.0.90.128]) by progateway5.mail.pro1.eigbox.com (Postfix) with ESMTP id 183981003EA21 for ; Mon, 3 Apr 2023 21:47:32 +0000 (UTC) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with ESMTP id jS1TpZlqZNX2ajS1TpE4bs; Mon, 03 Apr 2023 21:47:32 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=NMAQR22g c=1 sm=1 tr=0 ts=642b4974 a=dWLzHQi6WpdymmZIwiVdBw==:117 a=Fln8i1WyhtedwaIJAdHvmw==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=dKHAf1wccvYA:10:nop_rcvd_month_year a=vvvmwbhNdt4A:10:endurance_base64_authed_username_1 a=68U1OaUFYg-KaBGrb2oA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=rr9AxZmodqSI77EJB5OoimYlrrZpRZFUO8d/tqW3tFA=; b=qb4KDPz3oZ+ddZB7eqYtb4ehHe sAGpp5ou1I3bf9bW9nFVpqvOgaMgqcBB8Qxv0zsfGWBtzoF2ZNZTUCmxPEJO0FR9WB1Q1Q7CtVSlA fYrLAJCNWeGae+ZglHAsm7+R4rHvFdR0RmmOSu7LlgEseVPJ9U6VwHScdGY6/re5D0BO8R5+9zY1t iWrTsun51N/9L8z90CxeZYB/ldA6ch7dzCoa42d7P2bicyXPy14Vo0OpzwIzfAgIWI4yNkT5jIzCI 5qLt5RtikW0D/RzlgU2ilhFBsOvh9vayf9IW4LI5Kb3UBh5kcl2AxrNc9weArnP/Uf/ZFB/KLBje7 vm6h7x2w==; Original-Received: from 135-180-197-170.fiber.dynamic.sonic.net ([135.180.197.170]:64454 helo=DESKTOP-G20DCG1) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pjS1T-002YiO-5d; Mon, 03 Apr 2023 15:47:31 -0600 In-Reply-To: (Alan Mackenzie's message of "Sun, 2 Apr 2023 14:26:04 +0000") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 135.180.197.170 X-Source-L: No X-Exim-ID: 1pjS1T-002YiO-5d X-Source-Sender: 135-180-197-170.fiber.dynamic.sonic.net (DESKTOP-G20DCG1) [135.180.197.170]:64454 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 7 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: pass client-ip=69.89.30.42; envelope-from=stephen_leake@stephe-leake.org; helo=gproxy3-pub.mail.unifiedlayer.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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:305087 Archived-At: Alan Mackenzie writes: > Does the parser not produce adequate information for source code which > isn't syntactically valid (which is most of the time when editing is in > progress)? It often does, but also often does not. The error recovery algorithm in tree-sitter is apparently not good enough for this use case (indentation with a missing close block symbol). That's because the tree-sitter algorithm does not insert symbols, it only skips them. The error recovery algorithm in the wisitoken parser used by ada-mode does work well in this case; it inserts the missing close block symbol (and in general inserts other missing symbols). It would be interesting to convert the C++ grammar used by tree-sitter to a wisitoken grammar, and see how well that works. I don't have time or energy for that, but I could support someone else doing it. I am currently working on using tree-sitter as an ada-mode backend parser, so we will be able to compare the two parser's indent behavior using Ada test cases. -- -- Stephe