emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Make peg.el a built-in library?


From: Adam Porter
Subject: Re: Make peg.el a built-in library?
Date: Sat, 2 Oct 2021 10:13:24 -0500

On Sat, Oct 2, 2021 at 9:45 AM Stefan Monnier <monnier@iro.umontreal.ca> 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...)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]