GNU bug report logs -
#76555
30.1; PEG's doc needs some correction
Previous Next
Reported by: "Yue Yi" <include_yy <at> qq.com>
Date: Tue, 25 Feb 2025 14:55:02 UTC
Severity: minor
Found in version 30.1
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #28 received at 76555 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Stefan Kangas writes: > Ping, Eric, WDYT? Can we install the below change? > > > diff --git a/doc/lispref/peg.texi b/doc/lispref/peg.texi > > index 80e2581e7bb..e03ec57a457 100644 > > --- a/doc/lispref/peg.texi > > +++ b/doc/lispref/peg.texi > > @@ -141,8 +141,8 @@ Parsing Expression Grammars > > @example > > @group > > (define-peg-ruleset number-grammar > > + ;; `digit' here references the definition above. > > '((number sign digit (* digit)) > > - digit ;; A reference to the definition above. > > (sign (or "+" "-" "")))) > > @end group > > @end example The example in peg.texi is incorrect, and we should not modify it this way. Refer to peg.el for the correct usage: @@ -141,9 +141,9 @@ Parsing Expression Grammars @example @group (define-peg-ruleset number-grammar - '((number sign digit (* digit)) - digit ;; A reference to the definition above. - (sign (or "+" "-" "")))) + (number () sign digit (* digit)) + (digit () [0-9]) + (sign () (or "+" "-" ""))) @end group @end example BTW, as I mentioned last month, the indentation of `define-peg-rule' has an issue. I'm not very familiar with the history of peg.el, but could it be that the indentation rule was forgotten to be updated after introducing the parameter? Please consider fixing it. I believe the documentation of `peg-parse' may contain some potentially misleading parts. If needed, I can provide a simple patch.
[Message part 2 (text/html, inline)]
This bug report was last modified 138 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.