From e5dbaeb419fb4ad6890ec91444367db87d02883f Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 5 May 2017 21:28:21 -0700 Subject: [PATCH] Change regsexp {,inverse-}char-set to char-{,not-}in. --- src/runtime/mime-codec.scm | 8 +- src/runtime/pgsql.scm | 6 +- src/runtime/regsexp.scm | 10 +-- tests/runtime/test-regsexp.scm | 150 ++++++++++++++++----------------- 4 files changed, 87 insertions(+), 87 deletions(-) diff --git a/src/runtime/mime-codec.scm b/src/runtime/mime-codec.scm index f2928cca6..2e65ab9d0 100644 --- a/src/runtime/mime-codec.scm +++ b/src/runtime/mime-codec.scm @@ -709,11 +709,11 @@ USA. (define binhex40-header-regexp (compile-regsexp - '(seq (* (char-set "\r\n\t ")) + '(seq (* (char-in "\r\n\t ")) "(This file must be converted with BinHex" (* (any-char)) - (char-set "\r\n") - (* (char-set "\r\n\t ")) + (char-in "\r\n") + (* (char-in "\r\n\t ")) ":"))) (define (decode-binhex40-decoding context string start end) @@ -1018,7 +1018,7 @@ USA. '(seq (line-start) "begin" (+ #\space) - (+ (char-set (48 . 56))) + (+ (char-in (48 . 56))) (+ #\space) (+ (any-char)) (line-end)))) diff --git a/src/runtime/pgsql.scm b/src/runtime/pgsql.scm index 126687d8f..3dc47214a 100644 --- a/src/runtime/pgsql.scm +++ b/src/runtime/pgsql.scm @@ -215,11 +215,11 @@ USA. (define error-regsexp (compile-regsexp '(seq (string-start) - (* (char-set whitespace)) + (* (char-in whitespace)) (? (string-ci "error:")) - (* (char-set whitespace)) + (* (char-in whitespace)) (group message (* (any-char))) - (* (char-set whitespace)) + (* (char-in whitespace)) (string-end)))) (define (open-pgsql-conn parameters #!optional wait?) diff --git a/src/runtime/regsexp.scm b/src/runtime/regsexp.scm index d80f5d299..ee6644d01 100644 --- a/src/runtime/regsexp.scm +++ b/src/runtime/regsexp.scm @@ -148,11 +148,11 @@ USA. (else (error:not-a unary-procedure? predicate)))))) -(define-rule '(char-set * datum) +(define-rule '(char-in * datum) (lambda items (insn:char-set (char-set* items)))) -(define-rule '(inverse-char-set * datum) +(define-rule '(char-not-in * datum) (lambda items (insn:inverse-char-set (char-set* items)))) @@ -698,8 +698,8 @@ USA. ((#\B) (output-expr '(not-word-bound))) ((#\`) (output-expr '(string-start))) ((#\') (output-expr '(string-end))) - ((#\w) (output-expr '(char-set whitespace))) - ((#\W) (output-expr '(inverse-char-set whitespace))) + ((#\w) (output-expr '(char-in whitespace))) + ((#\W) (output-expr '(char-not-in whitespace))) ((#\s) (output-expr `(legacy-char-syntax ,(get-next)))) ((#\S) (output-expr `(inverse-legacy-char-syntax ,(get-next)))) ((#\() (start-group)) @@ -751,7 +751,7 @@ USA. (receive (ranges invert?) (re-char-pattern->code-points (list->string (reverse chars))) - (cons (if invert? 'inverse-char-set 'char-set) + (cons (if invert? 'char-not-in 'char-in) (normalize-ranges ranges)))) (loop (cons char chars)))))) diff --git a/tests/runtime/test-regsexp.scm b/tests/runtime/test-regsexp.scm index 852ddb9d4..d890a3ea4 100644 --- a/tests/runtime/test-regsexp.scm +++ b/tests/runtime/test-regsexp.scm @@ -382,7 +382,7 @@ USA. (group-ref x)) ("abc" #f)) ((seq "a" - (* (seq (group x (char-set "bc")) + (* (seq (group x (char-in "bc")) (group-ref x))) "d") ("abbccd" (0 6 (x . "b") (x . "c"))) @@ -408,7 +408,7 @@ USA. (group-ref x) "b" (* "c") - (char-set "ce") + (char-in "ce") "d") ("aabcccd" (0 7 (x . "a")))) ((seq (string-start) @@ -460,20 +460,20 @@ USA. "d") "acd") ((seq (** 0 1 "-") - (+ (char-set "0123456789")) + (+ (char-in "0123456789")) (string-end)) "-5")))) ;;; Ripped off from "grep/tests/ere.tests". (define-test 'match-grep-ere (multi-match-strings-test - `(((alt "abc" "de") + '(((alt "abc" "de") "abc") ((alt "a" "b" "c") ("abc" (0 1))) ((seq "a" (any-char) "c") "abc") - ((seq "a" (char-set "bc") "d") + ((seq "a" (char-in "bc") "d") "abd") ((seq "a" (* "b") "c") "abc") @@ -481,74 +481,74 @@ USA. "abc") ((seq "a" (? "b") "c") "abc") - ((seq "a" (char-set "b") "c") + ((seq "a" (char-in "b") "c") "abc") - ((seq "a" (char-set "ab") "c") + ((seq "a" (char-in "ab") "c") "abc") - ((seq "a" (inverse-char-set "ab") "c") + ((seq "a" (char-not-in "ab") "c") ("abc" #f) "adc") - ((seq "a" (char-set ,char-set:alphabetic) "c") + ((seq "a" (char-in alphabetic) "c") "abc" "adc") - ((seq "a" (+ (char-set ,char-set:numeric)) "c") + ((seq "a" (+ (char-in numeric)) "c") "a019c") - ((seq "A" (+ (char-set ,char-set:lower-case)) "C") + ((seq "A" (+ (char-in lower-case)) "C") "AabC") - ((seq "a" (+ (char-set ,char-set:upper-case)) "c") + ((seq "a" (+ (char-in upper-case)) "c") "aBCc") - ((seq "a" (** 20 (char-set "ab"))) + ((seq "a" (** 20 (char-in "ab"))) "aaaaabaaaabaaaabaaaab") ((seq "a" - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab")) + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab")) "aaaaabaaaabaaaabaaaab") ((seq "a" - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") - (char-set "ab") (char-set "ab") (char-set "ab") (char-set "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") + (char-in "ab") (char-in "ab") (char-in "ab") (char-in "ab") (alt "wee" "week") (alt "knights" "night")) "aaaaabaaaabaaaabaaaabweeknights") - ((seq (char-set "ab") (char-set "cd") (char-set "ef") (char-set "gh") - (char-set "ij") (char-set "kl") (char-set "mn")) + ((seq (char-in "ab") (char-in "cd") (char-in "ef") (char-in "gh") + (char-in "ij") (char-in "kl") (char-in "mn")) ("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")) + ((seq (char-in "ab") (char-in "cd") (char-in "ef") (char-in "gh") + (char-in "ij") (char-in "kl") (char-in "mn") (char-in "op")) ("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")) + ((seq (char-in "ab") (char-in "cd") (char-in "ef") (char-in "gh") + (char-in "ij") (char-in "kl") (char-in "mn") (char-in "op") + (char-in "qr")) ("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")) + ((seq (char-in "ab") (char-in "cd") (char-in "ef") (char-in "gh") + (char-in "ij") (char-in "kl") (char-in "mn") (char-in "op") + (char-in "q")) ("acegikmoqy" (0 9))) ("aBc" ("Abc" #f)) - ((seq "a" (* (char-set "Bc")) "d") + ((seq "a" (* (char-in "Bc")) "d") "acBd" "aBcd" "aBcBcBd" ("aBCd" #f) ("abcd" #f) ("abBCcd" #f)) - ((seq "a" (inverse-char-set "b") "c") + ((seq "a" (char-not-in "b") "c") ("abc" #f) "aBc" "adc") - ((seq (char-set "a") "b" (char-set "c")) + ((seq (char-in "a") "b" (char-in "c")) "abc") - ((seq (char-set "a") "b" (char-set "a")) + ((seq (char-in "a") "b" (char-in "a")) "aba") - ((seq (char-set "abc") "b" (char-set "abc")) + ((seq (char-in "abc") "b" (char-in "abc")) "abc") - ((seq (char-set "abc") "b" (char-set "abd")) + ((seq (char-in "abc") "b" (char-in "abd")) ("abc" #f) "abd") ((seq "a" (+ (seq (? "b") "c")) "d") @@ -563,19 +563,19 @@ USA. "abcdefghijklmnop") ("abcdefghijklmnopqrstuv" "abcdefghijklmnopqrstuv") - ((alt (seq "CC" (char-set "13") "1") + ((alt (seq "CC" (char-in "13") "1") (seq (** 21 "a") - (char-set "23") - (char-set "EO") - (char-set "123") - (char-set "Es") - (char-set "12") + (char-in "23") + (char-in "EO") + (char-in "123") + (char-in "Es") + (char-in "12") (** 15 "a") "aa" - (char-set "34") - (char-set "EW") + (char-in "34") + (char-in "EW") "aaaaaaa" - (char-set "X") + (char-in "X") "a")) "CC11")))) @@ -583,23 +583,23 @@ USA. (define-test 'match-grep-muammar-qaddafi (match-strings-test '(seq "M" - (char-set "ou") + (char-in "ou") (? "'") "a" (+ "m") - (char-set "ae") + (char-in "ae") "r " (* (any-char)) - (? (seq (char-set "AEae") + (? (seq (char-in "AEae") "l" - (char-set "- "))) - (char-set "GKQ") + (char-in "- "))) + (char-in "GKQ") (? "h") - (+ (char-set "aeu")) - (+ (seq (char-set "dtz") - (? (char-set "dhz")))) + (+ (char-in "aeu")) + (+ (seq (char-in "dtz") + (? (char-in "dhz")))) "af" - (char-set "iy")) + (char-in "iy")) '("Muammar Qaddafi" "Mo'ammar Gadhafi" "Muammar Kaddafi" @@ -674,16 +674,16 @@ USA. ((seq "a" (* (any-char)) "c") "axyzc" ("axyzd" #f)) - ((seq "a" (char-set "bc") "d") + ((seq "a" (char-in "bc") "d") ("abc" #f) "abd") - ((seq "a" (char-set "bcd") "e") + ((seq "a" (char-in "bcd") "e") ("abd" #f) "ace") - ((seq "a" (char-set "bcd")) + ((seq "a" (char-in "bcd")) "ac" ("aac" #f)) - ((seq "a" (inverse-char-set "bc") "d") + ((seq "a" (char-not-in "bc") "d") "aed" ("abd" #f)) ((seq (+ "a") (+ "b") "c") @@ -707,11 +707,11 @@ USA. ((? (alt (+ "a") "b")) ("ba" (0 1)) ("ab" (0 1))) - ((* (inverse-char-set "ab")) + ((* (char-not-in "ab")) "cde") - ((seq (* (char-set "abc")) "d") + ((seq (* (char-in "abc")) "d") "abbbcd") - ((seq (* (char-set "abc")) "bcd") + ((seq (* (char-in "abc")) "bcd") "abcd") ((alt "a" "b" "c" "d" "e") "e") @@ -734,38 +734,38 @@ USA. (assert-equal (re-pattern->regsexp (car entry)) (cadr entry)))) '(("[\r\n\t ]*(This file must be converted with BinHex.*[\r\n][\r\n\t ]*:" - (seq (* (char-set (9 . 11) 13 32)) + (seq (* (char-in (9 . 11) 13 32)) "(This file must be converted with BinHex" (* (any-char)) - (char-set 10 13) - (* (char-set (9 . 11) 13 32)) + (char-in 10 13) + (* (char-in (9 . 11) 13 32)) ":")) ("^begin +[0-7]+ +.+$" (seq (line-start) "begin" (+ #\space) - (+ (char-set (48 . 56))) + (+ (char-in (48 . 56))) (+ #\space) (+ (any-char)) (line-end))) ("\\`8859-[0-9]+\\'" - (seq (string-start) "8859-" (+ (char-set (48 . 58))) (string-end))) + (seq (string-start) "8859-" (+ (char-in (48 . 58))) (string-end))) ("\\`0x\\([0-9A-Fa-f][0-9A-Fa-f]\\)\t0x\\([0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f][0-9A-Fa-f]\\)\t" (seq (string-start) "0x" (group 1 - (seq (char-set (48 . 58) (65 . 71) (97 . 103)) - (char-set (48 . 58) (65 . 71) (97 . 103)))) + (seq (char-in (48 . 58) (65 . 71) (97 . 103)) + (char-in (48 . 58) (65 . 71) (97 . 103)))) "\t0x" (group 2 - (seq (char-set (48 . 58) (65 . 71) (97 . 103)) - (char-set (48 . 58) (65 . 71) (97 . 103)) - (char-set (48 . 58) (65 . 71) (97 . 103)) - (char-set (48 . 58) (65 . 71) (97 . 103)))) + (seq (char-in (48 . 58) (65 . 71) (97 . 103)) + (char-in (48 . 58) (65 . 71) (97 . 103)) + (char-in (48 . 58) (65 . 71) (97 . 103)) + (char-in (48 . 58) (65 . 71) (97 . 103)))) "\t")) ("\\`\\s *\\(error:\\)?\\s *\\(.*\\)\\s *\\'" -- 2.25.1