From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Adam Porter Newsgroups: gmane.emacs.devel Subject: Re: Make peg.el a built-in library? Date: Sat, 2 Oct 2021 10:13:24 -0500 Message-ID: References: <875yvtbbn3.fsf@ericabrahamsen.net> <83wno8u3uz.fsf@gnu.org> <87v93s9q4n.fsf@ericabrahamsen.net> <875yvafjr9.fsf@ericabrahamsen.net> <878rzdreem.fsf@alphapapa.net> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12698"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Oct 02 17:14:14 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 1mWgiM-000386-IB for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Oct 2021 17:14:14 +0200 Original-Received: from localhost ([::1]:49426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWgiL-0002kL-3h for ged-emacs-devel@m.gmane-mx.org; Sat, 02 Oct 2021 11:14:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWghm-00023E-PU for emacs-devel@gnu.org; Sat, 02 Oct 2021 11:13:38 -0400 Original-Received: from mail-lf1-f45.google.com ([209.85.167.45]:43523) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWghl-0006q6-5R for emacs-devel@gnu.org; Sat, 02 Oct 2021 11:13:38 -0400 Original-Received: by mail-lf1-f45.google.com with SMTP id e15so51060395lfr.10 for ; Sat, 02 Oct 2021 08:13:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KKk1k7ClrJiIac4G9ovzVOUv2nPeh2d0CqI29ijiVBQ=; b=ueT4HjUdfVcC5NoDD4CSm+Fw+mCPp6ZAHVHE9V+UPLWcao13Qgtka1eOZu04QXcCop 8LvlKKFZJWMfM8perWOJH7V+3/29QBqMe3LP7znzziOOgeMHJT/wKfC5ewDnAfVZ7Lcg 3fbyt3CS01azPOpxnecAjw9D1680U4aGleK+lZIvT7GPVGfgIl3p6RO8Q4d8T97pRUMq EBWW5Ytk4OZKRdcvf9t7IS31vnpj+EuktCmlcNUJwUNhwhjMku33waOYtIaVdUhC41Lb 5YEf7R9ven7mWA0yY8QyMW9UwjIUSkvUz+OebzbF9tnfPtFq2htX+UBdmPEgYDjmgmDT Cw+w== X-Gm-Message-State: AOAM531pDigZQujDJuygBGVkC+cFFYnG/4r9VVpobP8VPFmGbNWvJWe3 5CEy2424+22BO2a80TaXh6M3alz71eH7gTCFiaOQWxf7uco= X-Google-Smtp-Source: ABdhPJyiTmwhtHSjFaVdZQEwhv98gwsPR70i3GiYnxFLdz3OBSt5TYBaVwrLaA/AK7M5OIT8nJedSKOomme1fypgHJg= X-Received: by 2002:a2e:8881:: with SMTP id k1mr4155011lji.443.1633187615174; Sat, 02 Oct 2021 08:13:35 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=209.85.167.45; envelope-from=alphadeltapapa@gmail.com; helo=mail-lf1-f45.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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.23 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:276069 Archived-At: On Sat, Oct 2, 2021 at 9:45 AM Stefan Monnier wrote: > > >> PS: BTW, regarding your comment: > >> > >> ;; Sort the keywords longest-first to work around what seems to be an > >> ;; obscure bug in `peg': when one keyword is a substring of another, > >> ;; and the shorter one is listed first, the shorter one fails to match. > >> > >> The behavior you describe indeed seems like a bug, but maybe what you > >> see is slightly different (and not a bug): if you have a PEX like > >> (and (or "foo" "foobar") "X") > >> the "foo" will match when faced with "foobarX" and the parser won't > >> backtrack to try and match the "foobar" when the "X" fails to match. > > > > Hmm, thanks. I think an example of the problem is that a predicate in > > org-ql might have a shorter alias, e.g. "heading" is has the alias > > "h", and predicates are followed by arguments, like "heading:foo", so > > IIRC, without sorting them there, "heading:foo" would work, while > > "h:foo" wouldn't. > > Odd. If you have (or "h" "header") in the grammar then I'd expect > "h:foo" to be recognized but "heading:foo" to be rejected (IOW, that > would be a bug in the grammar rather than in `peg.el`). > > But you describe the exact opposite for which I don't have > an explanation. So maybe it's a bug in `peg.el`. Could you try and > distill it into a bug report? Frankly, probably not. :) I worked on that code a long time ago and haven't touched it since, so my recollection might not even be accurate. For me, it Just Works(TM), and I have other Emacs-related projects that are higher priority, so I don't expect to be able to work on that part of org-ql or peg.el anytime soon. Sorry. :( (e.g. I'd really like to make progress on this bug report, so I could reasonably submit plz.el to ELPA (though I might do that anyway, since it mostly works fine): https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50166 But it's stumped me so far. Maybe someone else would have some ideas sometime...)