Subject: Re: bug#76555: 30.1; PEG's doc needs some correction

From: "Yue Yi" <[email-masked]>
Date: Wed, 19 Mar 2025 00:01:30 +0800

Stefan Kangas writes: &gt; Ping, Eric, WDYT?  Can we install the below change? &gt;  &gt; &gt; diff --git a/doc/lispref/peg.texi b/doc/lispref/peg.texi &gt; &gt; index 80e2581e7bb..e03ec57a457 100644 &gt; &gt; --- a/doc/lispref/peg.texi &gt; &gt; +++ b/doc/lispref/peg.texi &gt; &gt; @@ -141,8 +141,8 @@ Parsing Expression Grammars &gt; &gt;  @example &gt; &gt;  @group &gt; &gt;  (define-peg-ruleset number-grammar &gt; &gt; +        ;; `digit' here references the definition above. &gt; &gt;          '((number sign digit (* digit)) &gt; &gt; -          digit  ;; A reference to the definition above. &gt; &gt;            (sign (or "+" "-" "")))) &gt; &gt;  @end group &gt; &gt;  @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.