all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
To: 36167@debbugs.gnu.org
Subject: bug#36167: [PATCH] Replace [0-9a-fA-F] with [[:xdigit:]]
Date: Tue, 11 Jun 2019 15:29:25 +0300	[thread overview]
Message-ID: <20190611122925.12809-1-Hi-Angel@yandex.ru> (raw)
In-Reply-To: <1560254386.25060.0@yandex.ru>

* etc/schema/od-schema-v1.2-os.rnc: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/calc/calc-aent.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/calc/calc-ext.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/calc/calc-lang.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/cedet/semantic/java.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/cedet/semantic/lex.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/emulation/cua-rect.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/gnus/gnus-art.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/gnus/mml-sec.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/gnus/nneething.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/international/mule-cmds.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/net/shr-color.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/nxml/rng-cmpct.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/nxml/rng-uri.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/nxml/rng-xsd.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/nxml/xmltok.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/org/org-mobile.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/progmodes/ada-mode.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/progmodes/cc-mode.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/progmodes/cperl-mode.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/progmodes/ebnf-dtd.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/progmodes/hideif.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/progmodes/prolog.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/textmodes/css-mode.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/textmodes/sgml-mode.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/version.el: replace [0-9a-fA-F] with [[:xdigit:]]
* lisp/xml.el: replace [0-9a-fA-F] with [[:xdigit:]]
* test/src/emacs-module-tests.el: replace [0-9a-fA-F] with [[:xdigit:]]
---
 etc/schema/od-schema-v1.2-os.rnc |  2 +-
 lisp/calc/calc-aent.el           |  2 +-
 lisp/calc/calc-ext.el            |  4 ++--
 lisp/calc/calc-lang.el           |  2 +-
 lisp/cedet/semantic/java.el      |  4 ++--
 lisp/cedet/semantic/lex.el       |  4 ++--
 lisp/emulation/cua-rect.el       |  2 +-
 lisp/gnus/gnus-art.el            |  8 ++++----
 lisp/gnus/mml-sec.el             |  2 +-
 lisp/gnus/nneething.el           |  2 +-
 lisp/international/mule-cmds.el  |  2 +-
 lisp/net/shr-color.el            |  2 +-
 lisp/nxml/rng-cmpct.el           |  2 +-
 lisp/nxml/rng-uri.el             | 10 +++++-----
 lisp/nxml/rng-xsd.el             |  2 +-
 lisp/nxml/xmltok.el              |  2 +-
 lisp/org/org-mobile.el           |  2 +-
 lisp/progmodes/ada-mode.el       |  2 +-
 lisp/progmodes/cc-mode.el        | 16 ++++++++--------
 lisp/progmodes/cperl-mode.el     |  8 ++++----
 lisp/progmodes/ebnf-dtd.el       | 14 +++++++-------
 lisp/progmodes/hideif.el         |  4 ++--
 lisp/progmodes/prolog.el         |  2 +-
 lisp/textmodes/css-mode.el       |  6 +++---
 lisp/textmodes/sgml-mode.el      |  2 +-
 lisp/version.el                  |  2 +-
 lisp/xml.el                      |  8 ++++----
 test/src/emacs-module-tests.el   |  2 +-
 28 files changed, 60 insertions(+), 60 deletions(-)

diff --git a/etc/schema/od-schema-v1.2-os.rnc b/etc/schema/od-schema-v1.2-os.rnc
index 8d679d62e4e..36e4645d7ee 100644
--- a/etc/schema/od-schema-v1.2-os.rnc
+++ b/etc/schema/od-schema-v1.2-os.rnc
@@ -6233,7 +6233,7 @@ signedZeroToHundredPercent =
 relativeLength = xsd:string { pattern = "[0-9]+\*" }
 coordinate = length
 distance = length
-color = xsd:string { pattern = "#[0-9a-fA-F]{6}" }
+color = xsd:string { pattern = "#[[:xdigit:]]{6}" }
 angle = xsd:string
 CURIE =
   xsd:string { pattern = "(([\i-[:]][\c-[:]]*)?:)?.+" minLength = "1" }
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index f16e665fc34..f1ef5c170bc 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -728,7 +728,7 @@ math-read-token
 						 math-exp-str (1- math-exp-pos))
 				   (1- math-exp-pos))))))
 	     (or (and (memq calc-language calc-lang-c-type-hex)
-		      (eq (string-match "0[xX][0-9a-fA-F]+" math-exp-str
+		      (eq (string-match "0[xX][[:xdigit:]]+" math-exp-str
                                         math-exp-pos)
                           math-exp-pos))
 		 (string-match "_?\\([0-9]+.?0*@ *\\)?\\([0-9]+.?0*' *\\)?\\(0*\\([2-9]\\|1[0-4]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-dA-D.]+[eE][-+_]?[0-9]+\\|0*\\([2-9]\\|[0-2][0-9]\\|3[0-6]\\)\\(#[#]?\\|\\^\\^\\)[0-9a-zA-Zα-ωΑ-Ω:.]+\\|[0-9]+:[0-9:]+\\|[0-9.]+\\([eE][-+_]?[0-9]+\\)?\"?\\)?"
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index 1456fb28570..c7b4c3b091d 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -3019,13 +3019,13 @@ math-read-number-fancy
 
    ;; C language hexadecimal notation
    ((and (eq calc-language 'c)
-	 (string-match "^0[xX]\\([0-9a-fA-F]+\\)$" s))
+	 (string-match "^0[xX]\\([[:xdigit:]]+\\)$" s))
     (let ((digs (math-match-substring s 1)))
       (math-read-radix digs 16)))
 
    ;; Pascal language hexadecimal notation
    ((and (eq calc-language 'pascal)
-	 (string-match "^\\$\\([0-9a-fA-F]+\\)$" s))
+	 (string-match "^\\$\\([[:xdigit:]]+\\)$" s))
     (let ((digs (math-match-substring s 1)))
       (math-read-radix digs 16)))
 
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index ee107df39c1..4a9771d7438 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -243,7 +243,7 @@ calc-pascal-language
 (put 'pascal 'math-lang-read-symbol
      '((?\$
         (eq (string-match
-             "\\(\\$[0-9a-fA-F]+\\)\\($\\|[^0-9a-zA-Zα-ωΑ-Ω]\\)"
+             "\\(\\$[[:xdigit:]]+\\)\\($\\|[^0-9a-zA-Zα-ωΑ-Ω]\\)"
              math-exp-str math-exp-pos)
             math-exp-pos)
         (setq math-exp-token 'number
diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el
index 54cce965459..7f9c93b906f 100644
--- a/lisp/cedet/semantic/java.el
+++ b/lisp/cedet/semantic/java.el
@@ -51,7 +51,7 @@ semantic-java-number-regexp
             "\\|"
             "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>"
             "\\|"
-            "\\<0[xX][0-9a-fA-F]+[lL]?\\>"
+            "\\<0[xX][[:xdigit:]]+[lL]?\\>"
             "\\|"
             "\\<[0-9]+[lLfFdD]?\\>"
             "\\)"
@@ -63,7 +63,7 @@ semantic-java-number-regexp
     [1-9][0-9]*
   ;
 HEX_LITERAL:
-    0[xX][0-9a-fA-F]+
+    0[xX][[:xdigit:]]+
   ;
 OCTAL_LITERAL:
     0[0-7]*
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index 2690122f067..f1c6b014182 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -596,7 +596,7 @@ semantic-lex-number-expression
             "\\|"
             "\\<[0-9]+[eE][-+]?[0-9]+[fFdD]?\\>"
             "\\|"
-            "\\<0[xX][0-9a-fA-F]+[lL]?\\>"
+            "\\<0[xX][[:xdigit:]]+[lL]?\\>"
             "\\|"
             "\\<[0-9]+[lLfFdD]?\\>"
             "\\)"
@@ -609,7 +609,7 @@ semantic-lex-number-expression
     [1-9][0-9]*
   ;
 HEX_LITERAL:
-    0[xX][0-9a-fA-F]+
+    0[xX][[:xdigit:]]+
   ;
 OCTAL_LITERAL:
     0[0-7]*
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 706634a5017..1a19cc2910e 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -1127,7 +1127,7 @@ cua-incr-rectangle
   (cua--rectangle-operation 'keep nil t 1 nil
      (lambda (_s e _l _r)
         (cond
-         ((re-search-forward "0x\\([0-9a-fA-F]+\\)" e t)
+         ((re-search-forward "0x\\([[:xdigit:]]+\\)" e t)
           (let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1)))
                  (n (string-to-number txt 16))
                  (fmt (format "0x%%0%dx" (length txt))))
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index d826faca5bd..e6a75660fe8 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -7426,10 +7426,10 @@ gnus-button-mid-or-mail-heuristic-alist
     (-2.0  . "^[0-9]")
     (-1.0  . "^[0-9][0-9]")
     ;;
-    ;; -3.0 /^[0-9][0-9a-fA-F]{2,2}/;
-    (-3.0  . "^[0-9][0-9a-fA-F][0-9a-fA-F][^0-9a-fA-F]")
-    ;; -5.0 /^[0-9][0-9a-fA-F]{3,3}/;
-    (-5.0  . "^[0-9][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][^0-9a-fA-F]")
+    ;; -3.0 /^[0-9][[:xdigit:]]{2,2}/;
+    (-3.0  . "^[0-9][[:xdigit:]][[:xdigit:]][^0-9a-fA-F]")
+    ;; -5.0 /^[0-9][[:xdigit:]]{3,3}/;
+    (-5.0  . "^[0-9][[:xdigit:]][[:xdigit:]][[:xdigit:]][^0-9a-fA-F]")
     ;;
     (-3.0  .  "[0-9][0-9][0-9][0-9][0-9][^0-9].*@") ;; "[0-9]{5,}.*\@"
     (-3.0  .  "[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][^0-9].*@")
diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el
index db7489fbf1c..02a27b367cd 100644
--- a/lisp/gnus/mml-sec.el
+++ b/lisp/gnus/mml-sec.el
@@ -725,7 +725,7 @@ mml-secure-find-usable-keys
 is expired or revoked.
 If optional JUSTONE is not nil, return the first key instead of a list."
   (let* ((keys (epg-list-keys context name))
-	 (iskeyid (string-match "\\(0x\\)?\\([0-9a-fA-F]\\{8,\\}\\)" name))
+	 (iskeyid (string-match "\\(0x\\)?\\([[:xdigit:]]\\{8,\\}\\)" name))
 	 (fingerprint (match-string 2 name))
 	 result)
     (when (and iskeyid (>= (length keys) 2))
diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el
index f64007aaf79..c3d511bc6e0 100644
--- a/lisp/gnus/nneething.el
+++ b/lisp/gnus/nneething.el
@@ -297,7 +297,7 @@ nneething-encode-file-name
 (defun nneething-decode-file-name (file &optional coding-system)
   "Decode the name of the FILE is encoded in CODING-SYSTEM."
   (let ((pos 0) buf)
-    (while (string-match "%\\([0-9a-fA-F][0-9a-fA-F]\\)" file pos)
+    (while (string-match "%\\([[:xdigit:]][[:xdigit:]]\\)" file pos)
       (setq buf (cons (string (string-to-number (match-string 1 file) 16))
 		      (cons (substring file pos (match-beginning 0)) buf))
 	    pos (match-end 0)))
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 47b07479c3c..1edf80d14c8 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -3079,7 +3079,7 @@ read-char-by-name
 	 (char
           (cond
            ((char-from-name input t))
-           ((string-match-p "\\`[0-9a-fA-F]+\\'" input)
+           ((string-match-p "\\`[[:xdigit:]]+\\'" input)
             (ignore-errors (string-to-number input 16)))
            ((string-match-p "\\`#\\([bBoOxX]\\|[0-9]+[rR]\\)[0-9a-zA-Z]+\\'"
                             input)
diff --git a/lisp/net/shr-color.el b/lisp/net/shr-color.el
index 2d6cf68d8ff..af0b99c76f4 100644
--- a/lisp/net/shr-color.el
+++ b/lisp/net/shr-color.el
@@ -235,7 +235,7 @@ shr-color->hexadecimal
     (cond
      ;; Hexadecimal color: #abc or #aabbcc
      ((string-match
-       "\\(#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?\\)"
+       "\\(#[[:xdigit:]]\\{3\\}[[:xdigit:]]\\{3\\}?\\)"
        color)
       (match-string 1 color))
      ;; rgb() or rgba() colors
diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el
index d36f9d92f26..60c871990e1 100644
--- a/lisp/nxml/rng-cmpct.el
+++ b/lisp/nxml/rng-cmpct.el
@@ -369,7 +369,7 @@ rng-c-process-escapes
     (and pos
 	 (rng-c-error "Nul character found (binary file?)")))
   (let ((offset 0))
-    (while (re-search-forward "\\\\x+{\\([0-9a-fA-F]+\\)}"
+    (while (re-search-forward "\\\\x+{\\([[:xdigit:]]+\\)}"
 			      (point-max)
 			      t)
       (let* ((ch (decode-char 'ucs (string-to-number (match-string 1) 16))))
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el
index 798475bbc3d..5a67cc7f145 100644
--- a/lisp/nxml/rng-uri.el
+++ b/lisp/nxml/rng-uri.el
@@ -68,7 +68,7 @@ rng-uri-pattern-file-name-replace-match
 
 ;; pattern is either nil or match or replace
 (defun rng-uri-file-name-1 (uri pattern)
-  (unless (string-match "\\`\\(?:[^%]\\|%[0-9a-fA-F]{2}\\)*\\'" uri)
+  (unless (string-match "\\`\\(?:[^%]\\|%[[:xdigit:]]{2}\\)*\\'" uri)
     (rng-uri-error "Bad escapes in URI `%s'" uri))
   (setq uri (rng-uri-unescape-multibyte uri))
   (let* ((components
@@ -299,7 +299,7 @@ rng-join-path
        (mapconcat 'identity segments "/")))
 
 (defun rng-uri-unescape-multibyte (str)
-  (replace-regexp-in-string "\\(?:%[89a-fA-F][0-9a-fA-F]\\)+"
+  (replace-regexp-in-string "\\(?:%[89a-fA-F][[:xdigit:]]\\)+"
 			    'rng-multibyte-percent-decode
 			    str))
 
@@ -310,7 +310,7 @@ rng-multibyte-percent-decode
 			 'utf-8))
 
 (defun rng-uri-unescape-unibyte (str)
-  (replace-regexp-in-string "%[0-7][0-9a-fA-F]"
+  (replace-regexp-in-string "%[0-7][[:xdigit:]]"
 			    (lambda (h)
 			      (string-to-number (substring h 1) 16))
 			    str
@@ -318,7 +318,7 @@ rng-uri-unescape-unibyte
 			    t))
 
 (defun rng-uri-unescape-unibyte-match (str)
-  (replace-regexp-in-string "%[0-7][0-9a-fA-F]\\|[^%]"
+  (replace-regexp-in-string "%[0-7][[:xdigit:]]\\|[^%]"
 			    (lambda (match)
 			      (if (string= match "*")
 				  "\\([^/]*\\)"
@@ -333,7 +333,7 @@ rng-uri-unescape-unibyte-match
 
 (defun rng-uri-unescape-unibyte-replace (str next-match-index)
   (replace-regexp-in-string
-   "%[0-7][0-9a-fA-F]\\|[^%]"
+   "%[0-7][[:xdigit:]]\\|[^%]"
    (lambda (match)
      (if (string= match "*")
 	 (let ((n next-match-index))
diff --git a/lisp/nxml/rng-xsd.el b/lisp/nxml/rng-xsd.el
index f308b049f3b..c0c679532ac 100644
--- a/lisp/nxml/rng-xsd.el
+++ b/lisp/nxml/rng-xsd.el
@@ -360,7 +360,7 @@ rng-xsd-base64-binary-length
       n)))
 
 (defun rng-xsd-convert-any-uri (string)
-  (and (string-match "\\`\\(?:[^%]\\|%[0-9a-fA-F][0-9a-fA-F]\\)*\\'" string)
+  (and (string-match "\\`\\(?:[^%]\\|%[[:xdigit:]][[:xdigit:]]\\)*\\'" string)
        (string-match "\\`[^#]*\\(?:#[^#]*\\)?\\'" string)
        (string-match "\\`\\(?:[a-zA-Z][-+.A-Za-z0-9]*:.+\\|[^:]*\\(?:[#/?].*\\)?\\)\\'" string)
        string))
diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el
index afa33e064f3..3cab5ed9b7b 100644
--- a/lisp/nxml/xmltok.el
+++ b/lisp/nxml/xmltok.el
@@ -413,7 +413,7 @@ xmltok-forward
 		   (xmltok-g decimal-ref-close ";") opt))
 	 (hex-ref
 	  (xmltok+ "x" open
-		   (xmltok-g hex "[0-9a-fA-F]" +)
+		   (xmltok-g hex "[[:xdigit:]]" +)
 		   (xmltok-g hex-ref-close ";") opt
 		   close opt))
 	 (char-ref
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index 8b4e8953889..e24ee8ed7c5 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -761,7 +761,7 @@ org-mobile-update-checksum-for-capture-file
 	 (buffer (find-file-noselect file)))
     (when buffer
       (with-current-buffer buffer
-	(when (re-search-forward (concat "\\([0-9a-fA-F]\\{30,\\}\\).*?"
+	(when (re-search-forward (concat "\\([[:xdigit:]]\\{30,\\}\\).*?"
 					 (regexp-quote org-mobile-capture-file)
 					 "[ \t]*$") nil t)
 	  (goto-char (match-beginning 1))
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index 77c1e5e2d87..ded9a08d0ee 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -909,7 +909,7 @@ ada-mode-symbol-syntax-table
 			       change))
 	    (replace-match "'A'"))
 	  (goto-char from)
-	  (while (re-search-forward "\\(#[0-9a-fA-F]*#\\)" to t)
+	  (while (re-search-forward "\\(#[[:xdigit:]]*#\\)" to t)
 	    (setq change (cons (list (match-beginning 1)
 				     (length (match-string 1))
 				     (match-string 1))
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 6afcb08a7ca..6feb326cf16 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1415,7 +1415,7 @@ c-after-change-mark-abnormal-strings
 (defconst c-maybe-quoted-number-head
   (concat
    "\\(0\\("
-       "\\([Xx]\\([0-9a-fA-F]\\('[0-9a-fA-F]\\|[0-9a-fA-F]\\)*'?\\)?\\)"
+       "\\([Xx]\\([[:xdigit:]]\\('[[:xdigit:]]\\|[[:xdigit:]]\\)*'?\\)?\\)"
        "\\|"
        "\\([Bb]\\([01]\\('[01]\\|[01]\\)*'?\\)?\\)"
        "\\|"
@@ -1449,7 +1449,7 @@ c-quoted-number-head-before-point
 (defconst c-maybe-quoted-number-tail
   (concat
    "\\("
-       "\\([xX']?[0-9a-fA-F]\\('[0-9a-fA-F]\\|[0-9a-fA-F]\\)*\\)"
+       "\\([xX']?[[:xdigit:]]\\('[[:xdigit:]]\\|[[:xdigit:]]\\)*\\)"
    "\\|"
        "\\([bB']?[01]\\('[01]\\|[01]\\)*\\)"
    "\\|"
@@ -1469,7 +1469,7 @@ c-quoted-number-tail-after-point
 (defconst c-maybe-quoted-number
   (concat
    "\\(0\\("
-       "\\([Xx][0-9a-fA-F]\\('[0-9a-fA-F]\\|[0-9a-fA-F]\\)*\\)"
+       "\\([Xx][[:xdigit:]]\\('[[:xdigit:]]\\|[[:xdigit:]]\\)*\\)"
        "\\|"
        "\\([Bb][01]\\('[01]\\|[01]\\)*\\)"
        "\\|"
@@ -1530,7 +1530,7 @@ c-parse-quotes-before-change
 	(if (>= (point) c-new-BEG)
 	    (setq c-new-BEG (match-beginning 0))))
        ((looking-at
-	 "\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\)'")
+	 "\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][[:xdigit:]]+\\|.\\)\\)'")
 	(goto-char (match-end 0))
 	(if (> (match-end 0) c-new-BEG)
 	    (setq c-new-BEG (1- (match-beginning 0)))))
@@ -1559,7 +1559,7 @@ c-parse-quotes-before-change
 	(if (> (match-end 0) c-new-END)
 	    (setq c-new-END (match-end 0))))
        ((looking-at
-	 "\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\)'")
+	 "\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][[:xdigit:]]+\\|.\\)\\)'")
 	(goto-char (match-end 0))
 	(if (> (match-end 0) c-new-END)
 	    (setq c-new-END (match-end 0))))
@@ -1579,8 +1579,8 @@ c-parse-quotes-before-change
      ((c-quoted-number-tail-after-point)
       (setq c-new-END (match-end 0)))
      ((looking-at
-       "\\(\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\|.\\)?\
-\\('\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\)\\)*'")
+       "\\(\\\\\\([0-7]\\{1,3\\}\\|[xuU][[:xdigit:]]+\\|.\\)\\|.\\)?\
+\\('\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][[:xdigit:]]+\\|.\\)\\)\\)*'")
       (setq c-new-END (match-end 0))))
 
     ;; Remove the '(1) syntax-table property from any "'"s within (c-new-BEG
@@ -1632,7 +1632,7 @@ c-parse-quotes-after-change
 					      'c-digit-separator t ?')
 	       (goto-char num-end))
 	      ((looking-at
-		"\\([^\\']\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\
+		"\\([^\\']\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][[:xdigit:]]+\\|.\\)\
 \\)'") ; balanced quoted expression.
 	       (goto-char (match-end 0)))
 	      ((looking-at "\\\\'")	; Anomalous construct.
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index ba007d67c0d..c58acf0c2ff 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -3507,18 +3507,18 @@ cperl-look-at-leading-count
 (defsubst cperl-highlight-charclass (endbracket dashface bsface onec-space)
   (let ((l '(1 5 7)) ll lle lll
 	;; 2 groups, the first takes the whole match (include \[trnfabe])
-	(singleChar (concat "\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)")))
+	(singleChar (concat "\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([[:xdigit:]][[:xdigit:]]?\\|\\={[[:xdigit:]]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)")))
     (while				; look for unescaped - between non-classes
 	(re-search-forward
 	 ;; On 19.33, certain simplifications lead
 	 ;; to bugs (as in  [^a-z] \\| [trnfabe]  )
 	 (concat	       		; 1: SingleChar (include \[trnfabe])
 	  singleChar
-	  ;;"\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
+	  ;;"\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([[:xdigit:]][[:xdigit:]]?\\|\\={[[:xdigit:]]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
 	  "\\("				; 3: DASH SingleChar (match optionally)
 	    "\\(-\\)"			; 4: DASH
 	    singleChar			; 5: SingleChar
-	    ;;"\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
+	    ;;"\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." "\\|" "\\\\x" "\\([[:xdigit:]][[:xdigit:]]?\\|\\={[[:xdigit:]]+}\\)" "\\|" "\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
 	  "\\)?"
 	  "\\|"
 	  "\\("				; 7: other escapes
@@ -4420,7 +4420,7 @@ cperl-find-pods-heres
 					    "\\=[0123456789]*" (1- e) 'to-end))
 				      (and (eq qtag ?x)
 					   (re-search-forward
-					    "\\=[0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}"
+					    "\\=[[:xdigit:]][[:xdigit:]]?\\|\\={[[:xdigit:]]+}"
 					    (1- e) 'to-end))
 				      (and (memq qtag (append "pPN" nil))
 					   (re-search-forward "\\={[^{}]+}\\|."
diff --git a/lisp/progmodes/ebnf-dtd.el b/lisp/progmodes/ebnf-dtd.el
index 94d96432614..17c7aebf2a9 100644
--- a/lisp/progmodes/ebnf-dtd.el
+++ b/lisp/progmodes/ebnf-dtd.el
@@ -324,7 +324,7 @@
 ;; /* Character Reference */
 ;;
 ;; CharRef ::= '&#' [0-9]+ ';'
-;;           | '&#x' [0-9a-fA-F]+ ';'
+;;           | '&#x' [[:xdigit:]]+ ';'
 ;;           [WFC: Legal Character]
 ;;
 ;;
@@ -915,9 +915,9 @@ ebnf-dtd-operators
 ;;; EntityRef ::= '&' Name ';'
 ;;;
 ;;; CharRef ::= '&#' [0-9]+ ';'
-;;;           | '&#x' [0-9a-fA-F]+ ';'
+;;;           | '&#x' [[:xdigit:]]+ ';'
 
-;;; "^\\(&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[0-9a-fA-F]+\\|[0-9]+\\)\\);\\|[^<&]\\)*$"
+;;; "^\\(&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[[:xdigit:]]+\\|[0-9]+\\)\\);\\|[^<&]\\)*$"
 
 
 (defun ebnf-dtd-attlistdecl ()
@@ -945,7 +945,7 @@ ebnf-dtd-attlistdecl
 	     (setq token (ebnf-dtd-lex)))
 	(or (and (eq token 'string)
 		 (string-match
-		  "^\\(&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[0-9a-fA-F]+\\|[0-9]+\\)\\);\\|[^<&]\\)*$"
+		  "^\\(&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[[:xdigit:]]+\\|[0-9]+\\)\\);\\|[^<&]\\)*$"
 		  ebnf-dtd-lex))
 	    (error "Invalid default value in ATTLIST declaration"))))
     (or (eq token 'end-decl)
@@ -986,9 +986,9 @@ ebnf-dtd-namelist
 ;;; EntityRef ::= '&' Name ';'
 ;;;
 ;;; CharRef ::= '&#' [0-9]+ ';'
-;;;           | '&#x' [0-9a-fA-F]+ ';'
+;;;           | '&#x' [[:xdigit:]]+ ';'
 
-;;; "^\\(%[A-Za-z_:][-A-Za-z0-9._:]*;\\|&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[0-9a-fA-F]+\\|[0-9]+\\)\\);\\|[^%&]\\)*$"
+;;; "^\\(%[A-Za-z_:][-A-Za-z0-9._:]*;\\|&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[[:xdigit:]]+\\|[0-9]+\\)\\);\\|[^%&]\\)*$"
 
 
 (defun ebnf-dtd-entitydecl ()
@@ -1001,7 +1001,7 @@ ebnf-dtd-entitydecl
     (setq token (ebnf-dtd-lex))
     (if (eq token 'string)
 	(if (string-match
-	     "^\\(%[A-Za-z_:][-A-Za-z0-9._:]*;\\|&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[0-9a-fA-F]+\\|[0-9]+\\)\\);\\|[^%&]\\)*$"
+	     "^\\(%[A-Za-z_:][-A-Za-z0-9._:]*;\\|&\\([A-Za-z_:][-A-Za-z0-9._:]*\\|#\\(x[[:xdigit:]]+\\|[0-9]+\\)\\);\\|[^%&]\\)*$"
 	     ebnf-dtd-lex)
 	    (setq token (ebnf-dtd-lex))
 	  (error "Invalid ENTITY definition"))
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index 32b0b7551f9..1b06077005c 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -540,7 +540,7 @@ hif-valid-token-list
 
 (defconst hif-token-regexp
   (concat (regexp-opt (mapcar 'car hif-token-alist))
-          "\\|0x[0-9a-fA-F]+\\.?[0-9a-fA-F]*"
+          "\\|0x[[:xdigit:]]+\\.?[[:xdigit:]]*"
           "\\|[0-9]+\\.?[0-9]*"  ;; decimal/octal
           "\\|\\w+"))
 
@@ -595,7 +595,7 @@ hif-tokenize
                    ;; 1. postfix 'l', 'll', 'ul' and 'ull'
                    ;; 2. floating number formats (like 1.23e4)
                    ;; 3. 098 is interpreted as octal conversion error
-                   (if (string-match "0x\\([0-9a-fA-F]+\\.?[0-9a-fA-F]*\\)"
+                   (if (string-match "0x\\([[:xdigit:]]+\\.?[[:xdigit:]]*\\)"
                                      token)
                        (hif-string-to-number (match-string 1 token) 16)) ;; hex
                    (if (string-match "\\`0[0-9]+\\(\\.[0-9]+\\)?\\'" token)
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index 296a7ac3c95..780eff2d8a0 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1071,7 +1071,7 @@ prolog-syntax-propertize-function
      ;; Supposedly, ISO-Prolog wants \NNN\ for octal and \xNNN\ for hexadecimal
      ;; escape sequences in atoms, so be careful not to let the terminating \
      ;; escape a subsequent quote.
-     ("\\\\[x0-7][0-9a-fA-F]*\\(\\\\\\)" (1 "_"))
+     ("\\\\[x0-7][[:xdigit:]]*\\(\\\\\\)" (1 "_"))
      )))
 
 (defun prolog-mode-variables ()
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 5d5d787945d..b0653bce81c 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -873,7 +873,7 @@ css-syntax-propertize-function
    (css--uri-re (1 "|") (2 "|"))))
 
 (defconst css-escapes-re
-  "\\\\\\(?:[^\000-\037\177]\\|[0-9a-fA-F]+[ \n\t\r\f]?\\)")
+  "\\\\\\(?:[^\000-\037\177]\\|[[:xdigit:]]+[ \n\t\r\f]?\\)")
 (defconst css-nmchar-re (concat "\\(?:[-[:alnum:]]\\|" css-escapes-re "\\)"))
 (defconst css-nmstart-re (concat "\\(?:[[:alpha:]]\\|" css-escapes-re "\\)"))
 (defconst css-ident-re ;; (concat css-nmstart-re css-nmchar-re "*")
@@ -1079,10 +1079,10 @@ css--colors-regexp
    (regexp-opt (mapcar #'car css--color-map) 'symbols)
    "\\|"
    ;; Short hex.  css-color-4 adds alpha.
-   "\\(#[0-9a-fA-F]\\{3,4\\}\\b\\)"
+   "\\(#[[:xdigit:]]\\{3,4\\}\\b\\)"
    "\\|"
    ;; Long hex.  css-color-4 adds alpha.
-   "\\(#\\(?:[0-9a-fA-F][0-9a-fA-F]\\)\\{3,4\\}\\b\\)"
+   "\\(#\\(?:[[:xdigit:]][[:xdigit:]]\\)\\{3,4\\}\\b\\)"
    "\\|"
    ;; RGB.
    "\\(\\_<rgba?(\\)"
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 0c5d5e56a69..602effe9afa 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1293,7 +1293,7 @@ sgml-quote
     (if unquotep
 	;; FIXME: We should unquote other named character references as well.
 	(while (re-search-forward
-		"\\(&\\(amp\\|quot\\|lt\\|gt\\|#\\([0-9]+\\|[xX][0-9a-fA-F]+\\)\\)\\)\\([][<>&;\n\t \"%!'(),/=?]\\|$\\)"
+		"\\(&\\(amp\\|quot\\|lt\\|gt\\|#\\([0-9]+\\|[xX][[:xdigit:]]+\\)\\)\\)\\([][<>&;\n\t \"%!'(),/=?]\\|$\\)"
 		nil t)
           (replace-match
            (string
diff --git a/lisp/version.el b/lisp/version.el
index d13d8c31e80..b9e2e50d1f7 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -120,7 +120,7 @@ emacs-repository-version-git
 	       (with-demoted-errors "Error running git rev-parse: %S"
 		 (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
 	   (progn (goto-char (point-min))
-		  (looking-at "[0-9a-fA-F]\\{40\\}"))
+		  (looking-at "[[:xdigit:]]\\{40\\}"))
 	   (match-string 0)))))
 
 (defun emacs-repository-get-version (&optional dir external)
diff --git a/lisp/xml.el b/lisp/xml.el
index 09ec72f792f..833eb8aced2 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -194,13 +194,13 @@ xml-nmtoken-re
 ;; [8] Nmtokens ::= Nmtoken (#x20 Nmtoken)*
 (defconst xml-nmtokens-re (concat xml-nmtoken-re "\\(?: " xml-name-re "\\)*"))
 
-;; [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
-(defconst xml-char-ref-re  "\\(?:&#[0-9]+;\\|&#x[0-9a-fA-F]+;\\)")
+;; [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [[:xdigit:]]+ ';'
+(defconst xml-char-ref-re  "\\(?:&#[0-9]+;\\|&#x[[:xdigit:]]+;\\)")
 
 ;; [68] EntityRef   ::= '&' Name ';'
 (defconst xml-entity-ref (concat "&" xml-name-re ";"))
 
-(defconst xml-entity-or-char-ref-re (concat "&\\(?:#\\(x\\)?\\([0-9a-fA-F]+\\)\\|\\("
+(defconst xml-entity-or-char-ref-re (concat "&\\(?:#\\(x\\)?\\([[:xdigit:]]+\\)\\|\\("
 					    xml-name-re "\\)\\);"))
 
 ;; [69] PEReference ::= '%' Name ';'
@@ -889,7 +889,7 @@ xml--entity-replacement-text
 The replacement text is obtained by replacing character
 references and parameter-entity references."
   (let ((ref-re (eval-when-compile
-		  (concat "\\(?:&#\\([0-9]+\\)\\|&#x\\([0-9a-fA-F]+\\)\\|%\\("
+		  (concat "\\(?:&#\\([0-9]+\\)\\|&#x\\([[:xdigit:]]+\\)\\|%\\("
 			  xml-name-re "\\)\\);")))
 	children)
     (while (string-match ref-re string)
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 5349de055ed..96a604f9824 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -60,7 +60,7 @@ mod-test-sum-test
     (should (eq 0
                 (string-match
                  (concat "#<module function "
-                         "\\(at \\(0x\\)?[0-9a-fA-F]+\\( from .*\\)?"
+                         "\\(at \\(0x\\)?[[:xdigit:]]+\\( from .*\\)?"
                          "\\|Fmod_test_sum from .*\\)>")
                  (prin1-to-string (nth 1 descr)))))
     (should (= (nth 2 descr) 3)))
-- 
2.22.0






  parent reply	other threads:[~2019-06-11 12:29 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-11 11:59 bug#36167: [PATCH] Replace manually crafted hex regexes with [[:xdigit:]] Konstantin Kharlamov
2019-06-11 12:03 ` bug#36167: Acknowledgement ([PATCH] Replace manually crafted hex regexes with [[:xdigit:]]) Konstantin Kharlamov
2019-06-11 12:29 ` Konstantin Kharlamov [this message]
2019-06-11 13:03   ` bug#36167: [PATCH] Replace [0-9a-fA-F] with [[:xdigit:]] Robert Pluim
2019-06-11 13:17     ` Konstantin Kharlamov
2019-06-11 13:30       ` Robert Pluim
2019-06-12  0:29         ` Konstantin Kharlamov
2019-06-12  2:42           ` Eli Zaretskii
2019-06-12  8:21           ` Robert Pluim
2019-06-12 11:19             ` Konstantin Kharlamov
2019-06-12 14:55               ` Eli Zaretskii
2019-06-12 16:39                 ` Konstantin Kharlamov
2019-06-12 16:51                   ` Eli Zaretskii
2019-06-12 17:09                     ` Konstantin Kharlamov
2019-06-12 21:33                       ` Lars Ingebrigtsen
2019-06-12 21:39                         ` Lars Ingebrigtsen
2019-06-12 22:17                         ` Andreas Schwab
2019-06-12 22:22                           ` Lars Ingebrigtsen
2019-06-12 22:48                             ` Konstantin Kharlamov
2019-06-11 13:32     ` npostavs
2019-06-11 14:36       ` Eli Zaretskii
2019-06-11 14:26 ` bug#36167: [PATCH] Replace manually crafted hex regexes " Paul Eggert
2019-06-11 14:37   ` Konstantin Kharlamov
2019-06-11 15:37     ` Paul Eggert
2019-06-11 16:31       ` Mattias Engdegård
2019-06-11 16:50         ` Drew Adams
2019-06-11 17:04           ` Eli Zaretskii
2019-06-11 17:18             ` Paul Eggert
2019-06-11 17:32               ` Eli Zaretskii
2019-06-11 17:19             ` Drew Adams
2019-06-11 17:34               ` Eli Zaretskii
2019-06-11 17:50             ` npostavs
2019-06-11 17:53               ` Eli Zaretskii
2019-06-11 18:14                 ` Eli Zaretskii
2019-06-11 19:56 ` Andy Moreton
2019-06-12  2:30   ` Eli Zaretskii
2019-06-12 11:44 ` Andy Moreton
2019-06-12 16:07   ` Eli Zaretskii
2019-06-13  0:18 ` bug#36167: [PATCH v2] Replace manually crafted hex regexes wth [[:xdigit:]] Konstantin Kharlamov
2019-07-06  8:04   ` Eli Zaretskii
2019-07-08  9:34 ` bug#36167: [PATCH v2] Replace manually crafted hex regexes with [[:xdigit:]] Konstantin Kharlamov
2019-07-08 12:11   ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=20190611122925.12809-1-Hi-Angel@yandex.ru \
    --to=hi-angel@yandex.ru \
    --cc=36167@debbugs.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.