Ihor Radchenko writes: > Eric Abrahamsen 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