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

From: Stefan Monnier <[email-masked]>
Date: Tue, 25 Feb 2025 13:14:18 -0500

>> As we know, Emacs 30 introduced a PEG implementation, peg.el. I found
>> that the following code doesn't work properly when reading the PEG
>> documentation with folks:
>> -------------- code from lispref/peg.texi -------------------------
>> (define-peg-rule digit ()
>>   [0-9])
>> (define-peg-ruleset number-grammar
>>         '((number sign digit (* digit))
>>           digit  ;; A reference to the definition above.
>>           (sign (or "+" "-" ""))))
>> -------------------------------------------------------------------

Eric, where does this "reference" line come from?
I don't think we've ever supported such a thing, nor needed it.
Did you mean something like what I have in the patch below?

        Stefan

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