emacs-devel
[Top][All Lists]
Advanced

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

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


From: Eric Abrahamsen
Subject: Re: [PATCH] Re: Make peg.el a built-in library?
Date: Sat, 26 Nov 2022 17:46:04 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

Ihor Radchenko <yantar92@posteo.net> writes:

> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>>>> +@item (* E)
>>>> +Zero or more of an expression, as the regexp ``*''.
>>>> +
>>>> +@item (+ E)
>>>> +One or more of an expression, as the regexp ``+''.
>>>
>>> It is worth highlighting the greedy part here and referring to &A and
>>> !A.
>>
>> I don't believe there is separate syntax for &A and !A -- those are
>> written (if A) and (not A).
>
> Indeed. I just felt lazy to write (if A) and (not A) and wrote &A and !A :)
>
> The comment is suggesting to add reference to the (if A)/(not A) and the
> "Writing PEGs" section.
>
>>> Actions are only run when the expression matches; with point moved after
>>> the match, right? What about &A and !A?
>>
>> That's right, actions only run if the parsing succeeds, and they run all
>> at once at the end. Maybe I can move all discussons of parsing success
>> vs failure into one place.
>
> I think that there might be confusion here because people are used to
> full success/full failure but not to partial success.
>
> And (if A) feels even more confusing because it does not actually move
> point and does not advance the parser. So, it is unclear what success
> means and what is the buffer/stack context when action is executed.

Here's a new version, that I hope clarifies these questions (instead of
doing the opposite).

Note that there's an open peg.el bug now (#59345), about whether the
"syntax-class" PEX is supposed to advance point or not -- you'd think
that it would, but it doesn't. No word from the author yet.

Lastly, nobody with a maintainer's hat on has actually given the green
light on this, and I assume we'll want to hold off until the next
version of Emacs is released; anyway it would be good to know what
Eli/Lars think. I haven't done any NEWS additions or anything, either.

Thanks!
Eric

Attachment: peg.texi
Description: TeXInfo document


reply via email to

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