mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-16 17:24:23 +00:00
More json.el changes
* lisp/json.el (json-read-keyword, json-read-number, json-read-object): (json-read-array): Just use = for char comparison.
This commit is contained in:
parent
861ff2ba2c
commit
7f89c208bf
1 changed files with 10 additions and 10 deletions
20
lisp/json.el
20
lisp/json.el
|
|
@ -293,7 +293,7 @@ KEYWORD is the keyword expected."
|
|||
(unless (member keyword json-keywords)
|
||||
(signal 'json-unknown-keyword (list keyword)))
|
||||
(mapc (lambda (char)
|
||||
(unless (char-equal char (json-peek))
|
||||
(when (/= char (json-peek))
|
||||
(signal 'json-unknown-keyword
|
||||
(list (save-excursion
|
||||
(backward-word-strictly 1)
|
||||
|
|
@ -330,10 +330,10 @@ representation will be parsed correctly."
|
|||
;; If SIGN is non-nil, the number is explicitly signed.
|
||||
(let ((number-regexp
|
||||
"\\([0-9]+\\)?\\(\\.[0-9]+\\)?\\([Ee][+-]?[0-9]+\\)?"))
|
||||
(cond ((and (null sign) (char-equal (json-peek) ?-))
|
||||
(cond ((and (null sign) (= (json-peek) ?-))
|
||||
(json-advance)
|
||||
(- (json-read-number t)))
|
||||
((and (null sign) (char-equal (json-peek) ?+))
|
||||
((and (null sign) (= (json-peek) ?+))
|
||||
(json-advance)
|
||||
(json-read-number t))
|
||||
((and (looking-at number-regexp)
|
||||
|
|
@ -495,11 +495,11 @@ Please see the documentation of `json-object-type' and `json-key-type'."
|
|||
;; read key/value pairs until "}"
|
||||
(let ((elements (json-new-object))
|
||||
key value)
|
||||
(while (not (char-equal (json-peek) ?}))
|
||||
(while (not (= (json-peek) ?}))
|
||||
(json-skip-whitespace)
|
||||
(setq key (json-read-string))
|
||||
(json-skip-whitespace)
|
||||
(if (char-equal (json-peek) ?:)
|
||||
(if (= (json-peek) ?:)
|
||||
(json-advance)
|
||||
(signal 'json-object-format (list ":" (json-peek))))
|
||||
(json-skip-whitespace)
|
||||
|
|
@ -510,8 +510,8 @@ Please see the documentation of `json-object-type' and `json-key-type'."
|
|||
(funcall json-post-element-read-function))
|
||||
(setq elements (json-add-to-object elements key value))
|
||||
(json-skip-whitespace)
|
||||
(unless (char-equal (json-peek) ?})
|
||||
(if (char-equal (json-peek) ?,)
|
||||
(when (/= (json-peek) ?})
|
||||
(if (= (json-peek) ?,)
|
||||
(json-advance)
|
||||
(signal 'json-object-format (list "," (json-peek))))))
|
||||
;; Skip over the "}"
|
||||
|
|
@ -621,7 +621,7 @@ become JSON objects."
|
|||
(json-skip-whitespace)
|
||||
;; read values until "]"
|
||||
(let (elements)
|
||||
(while (not (char-equal (json-peek) ?\]))
|
||||
(while (not (= (json-peek) ?\]))
|
||||
(json-skip-whitespace)
|
||||
(when json-pre-element-read-function
|
||||
(funcall json-pre-element-read-function (length elements)))
|
||||
|
|
@ -629,8 +629,8 @@ become JSON objects."
|
|||
(when json-post-element-read-function
|
||||
(funcall json-post-element-read-function))
|
||||
(json-skip-whitespace)
|
||||
(unless (char-equal (json-peek) ?\])
|
||||
(if (char-equal (json-peek) ?,)
|
||||
(when (/= (json-peek) ?\])
|
||||
(if (= (json-peek) ?,)
|
||||
(json-advance)
|
||||
(signal 'json-error (list 'bleah)))))
|
||||
;; Skip over the "]"
|
||||
|
|
|
|||
Loading…
Reference in a new issue