unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Ekaitz Zarraga <ekaitz@elenq.tech>
To: 73188@debbugs.gnu.org
Cc: ludo@gnu.org, Ekaitz Zarraga <ekaitz@elenq.tech>
Subject: bug#73188: [PATCH 1/3] PEG: fix [^...]
Date: Sun, 22 Dec 2024 21:01:06 +0100	[thread overview]
Message-ID: <20241222200128.13782-1-ekaitz@elenq.tech> (raw)
In-Reply-To: <78a81bc5-cd0d-0506-185b-c733c66e96ae@elenq.tech>

---
 module/ice-9/peg/string-peg.scm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/module/ice-9/peg/string-peg.scm b/module/ice-9/peg/string-peg.scm
index 0026f8930..745d8e8e7 100644
--- a/module/ice-9/peg/string-peg.scm
+++ b/module/ice-9/peg/string-peg.scm
@@ -301,11 +301,19 @@ EndOfFile < !.
 (define (Literal->defn lst for-syntax)
   (apply string (map (lambda (x) (Char->defn x for-syntax)) (cdr lst))))
 
-;; (NotInClass ...)
-;;  `-> (and ...)
+;; (NotInClass (Range ...) (Range ...))
+;;  `-> (and (followed-by (not-in-range ...))
+;;           (followed-by (not-in-range ...))
+;;           ...
+;;           (not-in-range ...))
+;; NOTE: the order doesn't matter, because all `not-in-range`s will always
+;; parse exactly one character, but all the elements but the last need not to
+;; consume the input.
 (define (NotInClass->defn lst for-syntax)
-  #`(and #,@(map (lambda (x) (NotInRange->defn x for-syntax))
-                 (cdr lst))))
+  #`(and
+      #,@(map (lambda (x) #`(followed-by #,(NotInRange->defn x for-syntax)))
+              (cddr lst))
+      #,(NotInRange->defn (cadr lst) for-syntax)))
 
 ;; (Class ...)
 ;;  `-> (or ...)
-- 
2.46.0






  parent reply	other threads:[~2024-12-22 20:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11 22:03 bug#73188: PEG parser does not support full PEG grammar Ekaitz Zarraga
2024-09-12 20:57 ` bug#73188: [PATCH v2] PEG: Add full support for PEG + some extensions Ekaitz Zarraga
2024-10-13 20:29   ` bug#73188: PEG parser does not support full PEG grammar Ludovic Courtès
2024-10-13 20:59     ` Ekaitz Zarraga
2024-10-14 11:56       ` Ludovic Courtès
2024-10-14 14:00         ` Ekaitz Zarraga
2024-10-20 10:10           ` Ludovic Courtès
2024-10-20 20:18             ` Ekaitz Zarraga
2024-12-09 17:23               ` Ludovic Courtès
2024-10-11 12:31 ` bug#73188: [PATCH] PEG: Add support for `not-in-range` and [^...] Ekaitz Zarraga
2024-10-30 19:04 ` bug#73188: PEG: Fix bugs and add complex PEG for testing Ekaitz Zarraga
2024-12-22 17:45 ` bug#73188: PEG parser does not support full PEG grammar Ekaitz Zarraga
2024-12-22 20:09   ` Ekaitz Zarraga
2024-12-22 20:01 ` Ekaitz Zarraga [this message]
2024-12-22 20:01   ` bug#73188: [PATCH 2/3] PEG: string-peg: better support for escaping Ekaitz Zarraga
2024-12-22 20:01   ` bug#73188: [PATCH 3/3] PEG: add large string-peg patch Ekaitz Zarraga
2024-12-22 21:22   ` bug#73188: PEG parser does not support full PEG grammar Ludovic Courtès
2024-12-23 22:04     ` bokr
2024-12-23 22:13       ` Ekaitz Zarraga
2024-12-28 20:30         ` Bengt Richter
2024-12-28 20:44           ` Ekaitz Zarraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241222200128.13782-1-ekaitz@elenq.tech \
    --to=ekaitz@elenq.tech \
    --cc=73188@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).