GNU bug report logs -
#78884
30.1; peg-parse does not treat its arguments as sequence
Previous Next
Reported by: Tim Landscheidt <tim <at> tim-landscheidt.de>
Date: Tue, 24 Jun 2025 00:13:02 UTC
Severity: normal
Found in version 30.1
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 78884 in the body.
You can then email your comments to 78884 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
:
bug#78884
; Package
emacs
.
(Tue, 24 Jun 2025 00:13:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Tim Landscheidt <tim <at> tim-landscheidt.de>
:
New bug report received and forwarded. Copy sent to
monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org
.
(Tue, 24 Jun 2025 00:13:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The docstring for Emacs 30.1's peg-parse reads:
| (peg-parse &rest PEXS)
| Match PEXS at point.
| PEXS is a sequence of PEG expressions, implicitly combined with ‘and’.
| Returns STACK if the match succeed and signals an error on failure,
| moving point along the way.
However, it will fail with (for example) "Wrong type
argument: listp" when called as such:
| ELISP> (with-temp-buffer
| (insert "ABCDEF")
| (goto-char (point-min))
| (peg-parse
| (bob)
| "ABC"))
| *** Eval error *** Wrong type argument: listp, "ABC"
| ELISP>
An explicit sequence with "and" works:
| ELISP> (with-temp-buffer
| (insert "ABCDEF")
| (goto-char (point-min))
| (peg-parse
| (and
| (bob)
| "ABC")))
| t
| ELISP>
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#78884
; Package
emacs
.
(Tue, 24 Jun 2025 18:13:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 78884 <at> debbugs.gnu.org (full text, mbox):
Tim Landscheidt [2025-06-24 00:12:11] wrote:
> The docstring for Emacs 30.1's peg-parse reads:
>
> | (peg-parse &rest PEXS)
>
> | Match PEXS at point.
> | PEXS is a sequence of PEG expressions, implicitly combined with ‘and’.
> | Returns STACK if the match succeed and signals an error on failure,
> | moving point along the way.
>
> However, it will fail with (for example) "Wrong type
> argument: listp" when called as such:
>
> | ELISP> (with-temp-buffer
> | (insert "ABCDEF")
> | (goto-char (point-min))
> | (peg-parse
> | (bob)
> | "ABC"))
> | *** Eval error *** Wrong type argument: listp, "ABC"
> | ELISP>
>
> An explicit sequence with "and" works:
>
> | ELISP> (with-temp-buffer
> | (insert "ABCDEF")
> | (goto-char (point-min))
> | (peg-parse
> | (and
> | (bob)
> | "ABC")))
> | t
>
> | ELISP>
Can you check that the quick-fix below fixes things on your side (and
not just for your example)?
Stefan
diff --git a/lisp/progmodes/peg.el b/lisp/progmodes/peg.el
index 7827990af35..b5ffff31362 100644
--- a/lisp/progmodes/peg.el
+++ b/lisp/progmodes/peg.el
@@ -320,8 +320,9 @@ peg-parse
moving point along the way."
(if (and (consp (car pexs))
(symbolp (caar pexs))
- (not (ignore-errors
- (not (eq 'call (car (peg-normalize (car pexs))))))))
+ (not (or (get (peg--rule-id (caar pexs)) 'peg--rule-definition)
+ (ignore-errors
+ (not (eq 'call (car (peg-normalize (car pexs)))))))))
;; The first of `pexs' has not been defined as a rule, so assume
;; that none of them have been and they should be fed to
;; `with-peg-rules'
Reply sent
to
Stefan Monnier <monnier <at> iro.umontreal.ca>
:
You have taken responsibility.
(Sat, 28 Jun 2025 03:16:04 GMT)
Full text and
rfc822 format available.
Notification sent
to
Tim Landscheidt <tim <at> tim-landscheidt.de>
:
bug acknowledged by developer.
(Sat, 28 Jun 2025 03:16:05 GMT)
Full text and
rfc822 format available.
Message #13 received at 78884-done <at> debbugs.gnu.org (full text, mbox):
> Can you check that the quick-fix below fixes things on your side (and
> not just for your example)?
Well, I pushed it to `master`, and I'm closing the bug.
In case it's not fully fixed, feel free to reopen, of course.
Stefan
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 26 Jul 2025 11:24:13 GMT)
Full text and
rfc822 format available.
This bug report was last modified 13 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.