Function: json-read-escaped-char
json-read-escaped-char is a byte-compiled function defined in
json.el.gz.
Signature
(json-read-escaped-char)
Documentation
Read the JSON string escaped character at point.
Source Code
;; Defined in /usr/src/emacs/lisp/json.el.gz
(defun json-read-escaped-char ()
"Read the JSON string escaped character at point."
;; Skip over the '\'.
(json-advance)
(let ((char (json-pop)))
(cond
((cdr (assq char json-special-chars)))
((/= char ?u) char)
;; Special-case UTF-16 surrogate pairs,
;; cf. <https://tools.ietf.org/html/rfc7159#section-7>. Note that
;; this clause overlaps with the next one and therefore has to
;; come first.
((looking-at
(rx (group (any "Dd") (any "89ABab") (= 2 xdigit))
"\\u" (group (any "Dd") (any "C-Fc-f") (= 2 xdigit))))
(json-advance 10)
(json--decode-utf-16-surrogates
(string-to-number (match-string 1) 16)
(string-to-number (match-string 2) 16)))
((looking-at (rx (= 4 xdigit)))
(json-advance 4)
(string-to-number (match-string 0) 16))
(t
(signal 'json-string-escape (list (point)))))))