From: Chris Hanson Date: Wed, 3 May 2017 07:13:56 +0000 (-0700) Subject: Change regsexp value to have values of groups instead of indices. X-Git-Tag: mit-scheme-pucked-9.2.12~14^2~91 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=9e114e0cf5f1749049243b43ec41341c813155de;p=mit-scheme.git Change regsexp value to have values of groups instead of indices. This does weird things when a group is inside a repeat, but that's a bad idea so DON'T DO THAT! --- diff --git a/src/runtime/regsexp.scm b/src/runtime/regsexp.scm index a83d76ea4..242dd41fc 100644 --- a/src/runtime/regsexp.scm +++ b/src/runtime/regsexp.scm @@ -65,7 +65,7 @@ USA. (lambda (position groups fail) fail (cons (get-index position) - (%convert-groups groups)))))) + ((groups 'get-all))))))) (define-record-type (make-compiled-regsexp impl) @@ -77,9 +77,8 @@ USA. ((compiled-regsexp-impl crsexp) start-position (make-groups) (lambda () #f)))) (and result - (cons (%make-range (get-index start-position) - (car result)) - (cdr result))))) + (cons (get-index start-position) + result)))) (define (group-key? object) (or (fix:fixnum? object) @@ -306,16 +305,6 @@ USA. (define (insn:inverse-char-set char-set) (insn:test-char (negate (char-set-predicate char-set)))) -(define (insn:chars chars) - (lambda (succeed) - (lambda (position groups fail) - (let loop ((chars chars) (position position)) - (if (pair? chars) - (if (eqv? (next-char position) (car chars)) - (loop (cdr chars) (next-position position)) - (fail)) - (succeed position groups fail)))))) - (define (insn:string string) (let ((end (string-length string))) (cond ((fix:= end 0) @@ -338,13 +327,13 @@ USA. (lambda (succeed) (lambda (position groups fail) (succeed position - (%start-group key position groups) + ((groups 'start) key position) fail)))) (end (lambda (succeed) (lambda (position groups fail) (succeed position - (%end-group key position groups) + ((groups 'end) key position) fail))))) (lambda (succeed) (start (insn (end succeed)))))) @@ -352,7 +341,13 @@ USA. (define (insn:group-ref key) (lambda (succeed) (lambda (position groups fail) - (((%find-group key groups) succeed) position groups fail)))) + ((let ((value ((groups 'get-value) key))) + (if value + ((insn:string value) succeed) + ;; This can happen with (* (GROUP ...)), but in other cases it + ;; would be an error. + succeed)) + position groups fail)))) (define (insn:seq insns) (lambda (succeed) @@ -557,60 +552,36 @@ USA. (eqv? (caar started-groups) key))) (error "Incorrectly nested group:" key)) (state (cdr started-groups) - (cons (list key (cdar started-groups) position) + (cons (finish-group key + (cdar started-groups) + position) ended-groups))) - (define (find key) + (define (finish-group key start-position end-position) + (cons key + (let loop ((position end-position) (chars '())) + (if (same-positions? position start-position) + (list->string chars) + (let ((char (prev-char position))) + (loop (prev-position position) + (cons char chars))))))) + + (define (get-value key) (if (assv key started-groups) (error "Can't refer to unfinished group:" key)) (let ((p (assv key ended-groups))) - (if (not p) - ;; This can happen with (* (GROUP ...)), but in other cases it - ;; would be an error. - (insn:always-succeed) - (insn:chars (%group-chars (cadr p) (caddr p)))))) - - (define (%group-chars start-position end-position) - (let loop ((position end-position) (chars '())) - (if (same-positions? position start-position) - chars - (let ((char (prev-char position))) - (loop (prev-position position) - (cons char chars)))))) - - (define (convert) - (map (lambda (g) - (cons (car g) - (%make-range (get-index (cadr g)) - (get-index (caddr g))))) - (remove (lambda (g) - (null? (cddr g))) - ended-groups))) + (and p + (cdr p)))) (lambda (operator) (case operator ((start) start) ((end) end) - ((find) find) - ((convert) convert) + ((get-value) get-value) + ((get-all) (lambda () (reverse ended-groups))) (else (error "Unknown operator:" operator))))) (state '() '())) - -(define (%start-group key position groups) - ((groups 'start) key position)) - -(define (%end-group key position groups) - ((groups 'end) key position)) - -(define (%find-group key groups) - ((groups 'find) key)) - -(define (%convert-groups groups) - ((groups 'convert))) - -(define-integrable (%make-range start end) - (cons start end)) ;;;; Match and search diff --git a/tests/runtime/test-regsexp.scm b/tests/runtime/test-regsexp.scm index 1f5908dfa..852ddb9d4 100644 --- a/tests/runtime/test-regsexp.scm +++ b/tests/runtime/test-regsexp.scm @@ -37,7 +37,7 @@ USA. (map (lambda (p) (if (string? p) (%match-string-test pattern cr p - (list (cons 0 (string-length p)))) + (list 0 (string-length p))) (%match-string-test pattern cr (car p) (cadr p)))) entries)))) @@ -81,43 +81,43 @@ USA. (define-test 'match-any-char (match-strings-test '(any-char) '(("" #f) - ("a" ((0 . 1))) - ("b" ((0 . 1))) + ("a" (0 1)) + ("b" (0 1)) ("\n" #f)))) (define-test 'search-any-char (search-strings-test '(any-char) '(("" #f) - ("a" ((0 . 1))) - ("b" ((0 . 1))) + ("a" (0 1)) + ("b" (0 1)) ("\n" #f) - ("ab" ((0 . 1))) - ("\na" ((1 . 2)))))) + ("ab" (0 1)) + ("\na" (1 2))))) (define-test 'match-*any-char (match-strings-test '(* (any-char)) - '(("" ((0 . 0))) - ("a" ((0 . 1))) - ("ab" ((0 . 2))) - ("abc" ((0 . 3))) - ("ab\n" ((0 . 2))) - ("a\nb" ((0 . 1)))))) + '(("" (0 0)) + ("a" (0 1)) + ("ab" (0 2)) + ("abc" (0 3)) + ("ab\n" (0 2)) + ("a\nb" (0 1))))) (define-test 'search-+any-char (search-strings-test '(+ (any-char)) '(("" #f) - ("a" ((0 . 1))) - ("ab" ((0 . 2))) - ("abc" ((0 . 3))) - ("ab\n" ((0 . 2))) - ("a\nb" ((0 . 1))) - ("\nab" ((1 . 3)))))) + ("a" (0 1)) + ("ab" (0 2)) + ("abc" (0 3)) + ("ab\n" (0 2)) + ("a\nb" (0 1)) + ("\nab" (1 3))))) (define-test 'match-simple-seq - (match-string-test '(seq "a" "b") "ab" '((0 . 2)))) + (match-string-test '(seq "a" "b") "ab" '(0 2))) (define-test 'search-simple-seq - (search-string-test '(seq "a" "b") "1914ab37" '((4 . 6)))) + (search-string-test '(seq "a" "b") "1914ab37" '(4 6))) (define-test 'match/repeat-equivalences-test (let ((equivalents @@ -128,7 +128,7 @@ USA. pattern (map (lambda (string index) (list string - (and index (list (cons 0 index))))) + (and index (list 0 index)))) strings indices)))) patterns)))) @@ -188,101 +188,101 @@ USA. (define-test 'match-more-repeat-tests (list - (match-string-test '(seq (? "a") "a") "aab" '((0 . 2))) - (match-string-test '(seq (? "a") "ab") "aab" '((0 . 3))) + (match-string-test '(seq (? "a") "a") "aab" '(0 2)) + (match-string-test '(seq (? "a") "ab") "aab" '(0 3)) - (match-string-test '(seq (?? "a") "a") "aab" '((0 . 1))) - (match-string-test '(seq (?? "a") "ab") "aab" '((0 . 3))) + (match-string-test '(seq (?? "a") "a") "aab" '(0 1)) + (match-string-test '(seq (?? "a") "ab") "aab" '(0 3)) - (match-string-test '(** 1 2 "a") "aab" '((0 . 2))) - (match-string-test '(seq (** 1 2 "a") "b") "aab" '((0 . 3))) + (match-string-test '(** 1 2 "a") "aab" '(0 2)) + (match-string-test '(seq (** 1 2 "a") "b") "aab" '(0 3)) - (match-string-test '(**? 1 2 "a") "aab" '((0 . 1))) - (match-string-test '(seq (**? 1 2 "a") "b") "aab" '((0 . 3))) + (match-string-test '(**? 1 2 "a") "aab" '(0 1)) + (match-string-test '(seq (**? 1 2 "a") "b") "aab" '(0 3)) - (match-string-test '(** 1 3 "a") "aaab" '((0 . 3))) - (match-string-test '(seq (** 1 3 "a") "b") "aaab" '((0 . 4))) + (match-string-test '(** 1 3 "a") "aaab" '(0 3)) + (match-string-test '(seq (** 1 3 "a") "b") "aaab" '(0 4)) - (match-string-test '(**? 1 3 "a") "aaab" '((0 . 1))) - (match-string-test '(seq (**? 1 3 "a") "b") "aaab" '((0 . 4))) + (match-string-test '(**? 1 3 "a") "aaab" '(0 1)) + (match-string-test '(seq (**? 1 3 "a") "b") "aaab" '(0 4)) - (match-string-test '(seq (group foo (? "a")) "a") "aab" '((0 . 2) (foo 0 . 1))) - (match-string-test '(seq (group foo (? "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (match-string-test '(seq (group foo (? "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) + (match-string-test '(seq (group foo (? "a")) "a") "aab" '(0 2 (foo . "a"))) + (match-string-test '(seq (group foo (? "a")) "ab") "aab" '(0 3 (foo . "a"))) + (match-string-test '(seq (group foo (? "a")) "aab") "aab" '(0 3 (foo . ""))) - (match-string-test '(seq (group foo (?? "a")) "a") "aab" '((0 . 1) (foo 0 . 0))) - (match-string-test '(seq (group foo (?? "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (match-string-test '(seq (group foo (?? "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) + (match-string-test '(seq (group foo (?? "a")) "a") "aab" '(0 1 (foo . ""))) + (match-string-test '(seq (group foo (?? "a")) "ab") "aab" '(0 3 (foo . "a"))) + (match-string-test '(seq (group foo (?? "a")) "aab") "aab" '(0 3 (foo . ""))) - (match-string-test '(seq (group foo (* "a")) "b") "aab" '((0 . 3) (foo 0 . 2))) - (match-string-test '(seq (group foo (* "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (match-string-test '(seq (group foo (* "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) + (match-string-test '(seq (group foo (* "a")) "b") "aab" '(0 3 (foo . "aa"))) + (match-string-test '(seq (group foo (* "a")) "ab") "aab" '(0 3 (foo . "a"))) + (match-string-test '(seq (group foo (* "a")) "aab") "aab" '(0 3 (foo . ""))) - (match-string-test '(seq (group foo (*? "a")) "b") "aab" '((0 . 3) (foo 0 . 2))) - (match-string-test '(seq (group foo (*? "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (match-string-test '(seq (group foo (*? "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) + (match-string-test '(seq (group foo (*? "a")) "b") "aab" '(0 3 (foo . "aa"))) + (match-string-test '(seq (group foo (*? "a")) "ab") "aab" '(0 3 (foo . "a"))) + (match-string-test '(seq (group foo (*? "a")) "aab") "aab" '(0 3 (foo . ""))) )) (define-test 'search-repeat-tests (list - (search-string-test '(seq (? "a") "a") "aab" '((0 . 2))) - (search-string-test '(seq (? "a") "a") "xaab" '((1 . 3))) - (search-string-test '(seq (? "a") "ab") "aab" '((0 . 3))) - (search-string-test '(seq (? "a") "ab") "xaab" '((1 . 4))) - - (search-string-test '(seq (?? "a") "a") "aab" '((0 . 1))) - (search-string-test '(seq (?? "a") "a") "xaab" '((1 . 2))) - (search-string-test '(seq (?? "a") "ab") "aab" '((0 . 3))) - (search-string-test '(seq (?? "a") "ab") "xaab" '((1 . 4))) - - (search-string-test '(** 1 2 "a") "aab" '((0 . 2))) - (search-string-test '(** 1 2 "a") "xaab" '((1 . 3))) - (search-string-test '(seq (** 1 2 "a") "b") "aab" '((0 . 3))) - (search-string-test '(seq (** 1 2 "a") "b") "xaab" '((1 . 4))) - - (search-string-test '(**? 1 2 "a") "aab" '((0 . 1))) - (search-string-test '(**? 1 2 "a") "xaab" '((1 . 2))) - (search-string-test '(seq (**? 1 2 "a") "b") "aab" '((0 . 3))) - (search-string-test '(seq (**? 1 2 "a") "b") "xaab" '((1 . 4))) - - (search-string-test '(** 1 3 "a") "aaab" '((0 . 3))) - (search-string-test '(** 1 3 "a") "xaaab" '((1 . 4))) - (search-string-test '(seq (** 1 3 "a") "b") "aaab" '((0 . 4))) - (search-string-test '(seq (** 1 3 "a") "b") "xaaab" '((1 . 5))) - - (search-string-test '(**? 1 3 "a") "aaab" '((0 . 1))) - (search-string-test '(**? 1 3 "a") "xaaab" '((1 . 2))) - (search-string-test '(seq (**? 1 3 "a") "b") "aaab" '((0 . 4))) - (search-string-test '(seq (**? 1 3 "a") "b") "xaaab" '((1 . 5))) - - (search-string-test '(seq (group foo (? "a")) "a") "aab" '((0 . 2) (foo 0 . 1))) - (search-string-test '(seq (group foo (? "a")) "a") "xaab" '((1 . 3) (foo 1 . 2))) - (search-string-test '(seq (group foo (? "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (search-string-test '(seq (group foo (? "a")) "ab") "xaab" '((1 . 4) (foo 1 . 2))) - (search-string-test '(seq (group foo (? "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) - (search-string-test '(seq (group foo (? "a")) "aab") "xaab" '((1 . 4) (foo 1 . 1))) - - (search-string-test '(seq (group foo (?? "a")) "a") "aab" '((0 . 1) (foo 0 . 0))) - (search-string-test '(seq (group foo (?? "a")) "a") "xaab" '((1 . 2) (foo 1 . 1))) - (search-string-test '(seq (group foo (?? "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (search-string-test '(seq (group foo (?? "a")) "ab") "xaab" '((1 . 4) (foo 1 . 2))) - (search-string-test '(seq (group foo (?? "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) - (search-string-test '(seq (group foo (?? "a")) "aab") "xaab" '((1 . 4) (foo 1 . 1))) - - (search-string-test '(seq (group foo (* "a")) "b") "aab" '((0 . 3) (foo 0 . 2))) - (search-string-test '(seq (group foo (* "a")) "b") "xaab" '((1 . 4) (foo 1 . 3))) - (search-string-test '(seq (group foo (* "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (search-string-test '(seq (group foo (* "a")) "ab") "xaab" '((1 . 4) (foo 1 . 2))) - (search-string-test '(seq (group foo (* "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) - (search-string-test '(seq (group foo (* "a")) "aab") "xaab" '((1 . 4) (foo 1 . 1))) - - (search-string-test '(seq (group foo (*? "a")) "b") "aab" '((0 . 3) (foo 0 . 2))) - (search-string-test '(seq (group foo (*? "a")) "b") "xaab" '((1 . 4) (foo 1 . 3))) - (search-string-test '(seq (group foo (*? "a")) "ab") "aab" '((0 . 3) (foo 0 . 1))) - (search-string-test '(seq (group foo (*? "a")) "ab") "xaab" '((1 . 4) (foo 1 . 2))) - (search-string-test '(seq (group foo (*? "a")) "aab") "aab" '((0 . 3) (foo 0 . 0))) - (search-string-test '(seq (group foo (*? "a")) "aab") "xaab" '((1 . 4) (foo 1 . 1))) + (search-string-test '(seq (? "a") "a") "aab" '(0 2)) + (search-string-test '(seq (? "a") "a") "xaab" '(1 3)) + (search-string-test '(seq (? "a") "ab") "aab" '(0 3)) + (search-string-test '(seq (? "a") "ab") "xaab" '(1 4)) + + (search-string-test '(seq (?? "a") "a") "aab" '(0 1)) + (search-string-test '(seq (?? "a") "a") "xaab" '(1 2)) + (search-string-test '(seq (?? "a") "ab") "aab" '(0 3)) + (search-string-test '(seq (?? "a") "ab") "xaab" '(1 4)) + + (search-string-test '(** 1 2 "a") "aab" '(0 2)) + (search-string-test '(** 1 2 "a") "xaab" '(1 3)) + (search-string-test '(seq (** 1 2 "a") "b") "aab" '(0 3)) + (search-string-test '(seq (** 1 2 "a") "b") "xaab" '(1 4)) + + (search-string-test '(**? 1 2 "a") "aab" '(0 1)) + (search-string-test '(**? 1 2 "a") "xaab" '(1 2)) + (search-string-test '(seq (**? 1 2 "a") "b") "aab" '(0 3)) + (search-string-test '(seq (**? 1 2 "a") "b") "xaab" '(1 4)) + + (search-string-test '(** 1 3 "a") "aaab" '(0 3)) + (search-string-test '(** 1 3 "a") "xaaab" '(1 4)) + (search-string-test '(seq (** 1 3 "a") "b") "aaab" '(0 4)) + (search-string-test '(seq (** 1 3 "a") "b") "xaaab" '(1 5)) + + (search-string-test '(**? 1 3 "a") "aaab" '(0 1)) + (search-string-test '(**? 1 3 "a") "xaaab" '(1 2)) + (search-string-test '(seq (**? 1 3 "a") "b") "aaab" '(0 4)) + (search-string-test '(seq (**? 1 3 "a") "b") "xaaab" '(1 5)) + + (search-string-test '(seq (group foo (? "a")) "a") "aab" '(0 2 (foo . "a"))) + (search-string-test '(seq (group foo (? "a")) "a") "xaab" '(1 3 (foo . "a"))) + (search-string-test '(seq (group foo (? "a")) "ab") "aab" '(0 3 (foo . "a"))) + (search-string-test '(seq (group foo (? "a")) "ab") "xaab" '(1 4 (foo . "a"))) + (search-string-test '(seq (group foo (? "a")) "aab") "aab" '(0 3 (foo . ""))) + (search-string-test '(seq (group foo (? "a")) "aab") "xaab" '(1 4 (foo . ""))) + + (search-string-test '(seq (group foo (?? "a")) "a") "aab" '(0 1 (foo . ""))) + (search-string-test '(seq (group foo (?? "a")) "a") "xaab" '(1 2 (foo . ""))) + (search-string-test '(seq (group foo (?? "a")) "ab") "aab" '(0 3 (foo . "a"))) + (search-string-test '(seq (group foo (?? "a")) "ab") "xaab" '(1 4 (foo . "a"))) + (search-string-test '(seq (group foo (?? "a")) "aab") "aab" '(0 3 (foo . ""))) + (search-string-test '(seq (group foo (?? "a")) "aab") "xaab" '(1 4 (foo . ""))) + + (search-string-test '(seq (group foo (* "a")) "b") "aab" '(0 3 (foo . "aa"))) + (search-string-test '(seq (group foo (* "a")) "b") "xaab" '(1 4 (foo . "aa"))) + (search-string-test '(seq (group foo (* "a")) "ab") "aab" '(0 3 (foo . "a"))) + (search-string-test '(seq (group foo (* "a")) "ab") "xaab" '(1 4 (foo . "a"))) + (search-string-test '(seq (group foo (* "a")) "aab") "aab" '(0 3 (foo . ""))) + (search-string-test '(seq (group foo (* "a")) "aab") "xaab" '(1 4 (foo . ""))) + + (search-string-test '(seq (group foo (*? "a")) "b") "aab" '(0 3 (foo . "aa"))) + (search-string-test '(seq (group foo (*? "a")) "b") "xaab" '(1 4 (foo . "aa"))) + (search-string-test '(seq (group foo (*? "a")) "ab") "aab" '(0 3 (foo . "a"))) + (search-string-test '(seq (group foo (*? "a")) "ab") "xaab" '(1 4 (foo . "a"))) + (search-string-test '(seq (group foo (*? "a")) "aab") "aab" '(0 3 (foo . ""))) + (search-string-test '(seq (group foo (*? "a")) "aab") "xaab" '(1 4 (foo . ""))) )) @@ -293,7 +293,7 @@ USA. (any-char) (group-ref b) (group-ref a)) - '(("radar" ((0 . 5) (b 1 . 2) (a 0 . 1))))) + '(("radar" (0 5 (a . "r") (b . "a"))))) (match-strings-test '(seq (string-start) (group 1 (? (any-char))) (group 2 (? (any-char))) @@ -315,14 +315,14 @@ USA. (group-ref 2) (group-ref 1) (string-end)) - '(("civic" ((0 . 5) - (9 2 . 2) (8 2 . 2) (7 2 . 2) (6 2 . 2) - (5 2 . 2) (4 2 . 2) (3 2 . 2) (2 1 . 2) - (1 0 . 1))) - ("abba" ((0 . 4) - (9 2 . 2) (8 2 . 2) (7 2 . 2) (6 2 . 2) - (5 2 . 2) (4 2 . 2) (3 2 . 2) (2 1 . 2) - (1 0 . 1))))) + '(("civic" (0 5 + (1 . "c") (2 . "i") (3 . "") (4 . "") + (5 . "") (6 . "") (7 . "") (8 . "") + (9 . ""))) + ("abba" (0 4 + (1 . "a") (2 . "b") (3 . "") (4 . "") + (5 . "") (6 . "") (7 . "") (8 . "") + (9 . ""))))) (match-strings-test '(seq (string-start) (group 1 (?? (any-char))) (group 2 (?? (any-char))) @@ -344,14 +344,14 @@ USA. (group-ref 2) (group-ref 1) (string-end)) - '(("civic" ((0 . 5) - (9 1 . 2) (8 0 . 1) (7 0 . 0) (6 0 . 0) - (5 0 . 0) (4 0 . 0) (3 0 . 0) (2 0 . 0) - (1 0 . 0))) - ("abba" ((0 . 4) - (9 1 . 2) (8 0 . 1) (7 0 . 0) (6 0 . 0) - (5 0 . 0) (4 0 . 0) (3 0 . 0) (2 0 . 0) - (1 0 . 0))))) + '(("civic" (0 5 + (1 . "") (2 . "") (3 . "") (4 . "") + (5 . "") (6 . "") (7 . "") (8 . "c") + (9 . "i"))) + ("abba" (0 4 + (1 . "") (2 . "") (3 . "") (4 . "") + (5 . "") (6 . "") (7 . "") (8 . "a") + (9 . "b"))))) )) ;;; Ripped off from "grep/tests/bre.tests". @@ -368,14 +368,14 @@ USA. (* "c")) "b") ((seq) - ("abc" ((0 . 0)))) + ("abc" (0 0))) ((seq "a" (group x (* "b")) "c" (group-ref x) "d") ("abbcbd" #f) - ("abbcbbd" ((0 . 7) (x 1 . 3))) + ("abbcbbd" (0 7 (x . "bb"))) ("abbcbbbd" #f)) ((seq (string-start) (group x (any-char)) @@ -385,32 +385,32 @@ USA. (* (seq (group x (char-set "bc")) (group-ref x))) "d") - ("abbccd" ((0 . 6) (x 3 . 4) (x 1 . 2))) + ("abbccd" (0 6 (x . "b") (x . "c"))) ("abbcbd" #f)) ((seq "a" (* (seq (* (group x "b")) (group-ref x))) "d") - ("abbbd" ((0 . 5) (x 2 . 3) (x 1 . 2)))) + ("abbbd" (0 5 (x . "b") (x . "b")))) ((seq (group x "a") (group-ref x) "bcd") - ("aabcd" ((0 . 5) (x 0 . 1)))) + ("aabcd" (0 5 (x . "a")))) ((seq (group x "a") (group-ref x) "b" (* "c") "d") - ("aabcd" ((0 . 5) (x 0 . 1))) - ("aabd" ((0 . 4) (x 0 . 1))) - ("aabcccd" ((0 . 7) (x 0 . 1)))) + ("aabcd" (0 5 (x . "a"))) + ("aabd" (0 4 (x . "a"))) + ("aabcccd" (0 7 (x . "a")))) ((seq (group x "a") (group-ref x) "b" (* "c") (char-set "ce") "d") - ("aabcccd" ((0 . 7) (x 0 . 1)))) + ("aabcccd" (0 7 (x . "a")))) ((seq (string-start) (group x "a") (group-ref x) @@ -418,7 +418,7 @@ USA. (* "c") "cd" (string-end)) - ("aabcccd" ((0 . 7) (x 0 . 1)))) + ("aabcccd" (0 7 (x . "a")))) ((seq (** 1 "a") "b") "ab") ((seq (** 1 #f "a") "b") @@ -470,7 +470,7 @@ USA. `(((alt "abc" "de") "abc") ((alt "a" "b" "c") - ("abc" ((0 . 1)))) + ("abc" (0 1))) ((seq "a" (any-char) "c") "abc") ((seq "a" (char-set "bc") "d") @@ -517,18 +517,18 @@ USA. "aaaaabaaaabaaaabaaaabweeknights") ((seq (char-set "ab") (char-set "cd") (char-set "ef") (char-set "gh") (char-set "ij") (char-set "kl") (char-set "mn")) - ("acegikmoq" ((0 . 7)))) + ("acegikmoq" (0 7))) ((seq (char-set "ab") (char-set "cd") (char-set "ef") (char-set "gh") (char-set "ij") (char-set "kl") (char-set "mn") (char-set "op")) - ("acegikmoq" ((0 . 8)))) + ("acegikmoq" (0 8))) ((seq (char-set "ab") (char-set "cd") (char-set "ef") (char-set "gh") (char-set "ij") (char-set "kl") (char-set "mn") (char-set "op") (char-set "qr")) - ("acegikmoqy" ((0 . 9)))) + ("acegikmoqy" (0 9))) ((seq (char-set "ab") (char-set "cd") (char-set "ef") (char-set "gh") (char-set "ij") (char-set "kl") (char-set "mn") (char-set "op") (char-set "q")) - ("acegikmoqy" ((0 . 9)))) + ("acegikmoqy" (0 9))) ("aBc" ("Abc" #f)) ((seq "a" (* (char-set "Bc")) "d") @@ -554,7 +554,7 @@ USA. ((seq "a" (+ (seq (? "b") "c")) "d") "accd") ((* "a") - ("b" ((0 . 0)))) + ("b" (0 0))) ((seq (alt "wee" "week") (alt "knights" "night")) "weeknights") ((seq (alt "we" "wee" "week" "frob") (alt "knights" "night" "day")) @@ -662,9 +662,9 @@ USA. "abc" ("abcc" #f)) ((seq (string-start) "abc") - ("abcc" ((0 . 3)))) + ("abcc" (0 3))) ((string-start) - ("abc" ((0 . 0)))) + ("abc" (0 0))) ((string-end) "" ("a" #f)) @@ -691,22 +691,22 @@ USA. "aabbc" ("aabbabc" #f)) ((* (* "a")) - ("-" ((0 . 0)))) + ("-" (0 0))) ((+ (* "a")) - ("-" ((0 . 0)))) + ("-" (0 0))) ((? (* "a")) - ("-" ((0 . 0)))) + ("-" (0 0))) ((* (alt "a" (seq))) - ("-" ((0 . 0)))) + ("-" (0 0))) ((* (alt (* "a") "b")) - ("-" ((0 . 0)))) + ("-" (0 0))) ((* (alt (+ "a") "b")) "ab") ((+ (alt (+ "a") "b")) "ab") ((? (alt (+ "a") "b")) - ("ba" ((0 . 1))) - ("ab" ((0 . 1)))) + ("ba" (0 1)) + ("ab" (0 1))) ((* (inverse-char-set "ab")) "cde") ((seq (* (char-set "abc")) "d") @@ -722,11 +722,11 @@ USA. ("multiple words of text" ("uh-uh" #f)) ("multiple words" - ("multiple words, yeah" ((0 . 14)))) + ("multiple words, yeah" (0 14))) ((seq (group x (seq (any-char) (any-char) (any-char) (any-char))) (* (any-char)) (group-ref x)) - ("beriberi" ((0 . 8) (x 0 . 4))))))) + ("beriberi" (0 8 (x . "beri"))))))) (define-test 're-pattern->regsexp (map (lambda (entry)