mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
PEG: string-peg: Fix [^...] interpretation.
* module/ice-9/peg/string-peg.scm (NotInClass->defn): Adjust. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
parent
c2829e4a86
commit
c86a48a92f
1 changed files with 12 additions and 4 deletions
|
@ -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 ...)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue