diff options
| author | Mark Oteiza | 2017-02-18 20:25:50 -0500 |
|---|---|---|
| committer | Mark Oteiza | 2017-02-18 20:25:50 -0500 |
| commit | 7f89c208bf4bb256c67cc59351f4171c7a6b63aa (patch) | |
| tree | 79514b61a1b6041cb0b10998d5ffc2bca3012bba | |
| parent | 861ff2ba2cfc19065b13bf9b9670b44e1496c64e (diff) | |
| download | emacs-7f89c208bf4bb256c67cc59351f4171c7a6b63aa.tar.gz emacs-7f89c208bf4bb256c67cc59351f4171c7a6b63aa.zip | |
More json.el changes
* lisp/json.el (json-read-keyword, json-read-number, json-read-object):
(json-read-array): Just use = for char comparison.
| -rw-r--r-- | lisp/json.el | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lisp/json.el b/lisp/json.el index 59942dbed8f..049c9b1951a 100644 --- a/lisp/json.el +++ b/lisp/json.el | |||
| @@ -293,7 +293,7 @@ KEYWORD is the keyword expected." | |||
| 293 | (unless (member keyword json-keywords) | 293 | (unless (member keyword json-keywords) |
| 294 | (signal 'json-unknown-keyword (list keyword))) | 294 | (signal 'json-unknown-keyword (list keyword))) |
| 295 | (mapc (lambda (char) | 295 | (mapc (lambda (char) |
| 296 | (unless (char-equal char (json-peek)) | 296 | (when (/= char (json-peek)) |
| 297 | (signal 'json-unknown-keyword | 297 | (signal 'json-unknown-keyword |
| 298 | (list (save-excursion | 298 | (list (save-excursion |
| 299 | (backward-word-strictly 1) | 299 | (backward-word-strictly 1) |
| @@ -330,10 +330,10 @@ representation will be parsed correctly." | |||
| 330 | ;; If SIGN is non-nil, the number is explicitly signed. | 330 | ;; If SIGN is non-nil, the number is explicitly signed. |
| 331 | (let ((number-regexp | 331 | (let ((number-regexp |
| 332 | "\\([0-9]+\\)?\\(\\.[0-9]+\\)?\\([Ee][+-]?[0-9]+\\)?")) | 332 | "\\([0-9]+\\)?\\(\\.[0-9]+\\)?\\([Ee][+-]?[0-9]+\\)?")) |
| 333 | (cond ((and (null sign) (char-equal (json-peek) ?-)) | 333 | (cond ((and (null sign) (= (json-peek) ?-)) |
| 334 | (json-advance) | 334 | (json-advance) |
| 335 | (- (json-read-number t))) | 335 | (- (json-read-number t))) |
| 336 | ((and (null sign) (char-equal (json-peek) ?+)) | 336 | ((and (null sign) (= (json-peek) ?+)) |
| 337 | (json-advance) | 337 | (json-advance) |
| 338 | (json-read-number t)) | 338 | (json-read-number t)) |
| 339 | ((and (looking-at number-regexp) | 339 | ((and (looking-at number-regexp) |
| @@ -495,11 +495,11 @@ Please see the documentation of `json-object-type' and `json-key-type'." | |||
| 495 | ;; read key/value pairs until "}" | 495 | ;; read key/value pairs until "}" |
| 496 | (let ((elements (json-new-object)) | 496 | (let ((elements (json-new-object)) |
| 497 | key value) | 497 | key value) |
| 498 | (while (not (char-equal (json-peek) ?})) | 498 | (while (not (= (json-peek) ?})) |
| 499 | (json-skip-whitespace) | 499 | (json-skip-whitespace) |
| 500 | (setq key (json-read-string)) | 500 | (setq key (json-read-string)) |
| 501 | (json-skip-whitespace) | 501 | (json-skip-whitespace) |
| 502 | (if (char-equal (json-peek) ?:) | 502 | (if (= (json-peek) ?:) |
| 503 | (json-advance) | 503 | (json-advance) |
| 504 | (signal 'json-object-format (list ":" (json-peek)))) | 504 | (signal 'json-object-format (list ":" (json-peek)))) |
| 505 | (json-skip-whitespace) | 505 | (json-skip-whitespace) |
| @@ -510,8 +510,8 @@ Please see the documentation of `json-object-type' and `json-key-type'." | |||
| 510 | (funcall json-post-element-read-function)) | 510 | (funcall json-post-element-read-function)) |
| 511 | (setq elements (json-add-to-object elements key value)) | 511 | (setq elements (json-add-to-object elements key value)) |
| 512 | (json-skip-whitespace) | 512 | (json-skip-whitespace) |
| 513 | (unless (char-equal (json-peek) ?}) | 513 | (when (/= (json-peek) ?}) |
| 514 | (if (char-equal (json-peek) ?,) | 514 | (if (= (json-peek) ?,) |
| 515 | (json-advance) | 515 | (json-advance) |
| 516 | (signal 'json-object-format (list "," (json-peek)))))) | 516 | (signal 'json-object-format (list "," (json-peek)))))) |
| 517 | ;; Skip over the "}" | 517 | ;; Skip over the "}" |
| @@ -621,7 +621,7 @@ become JSON objects." | |||
| 621 | (json-skip-whitespace) | 621 | (json-skip-whitespace) |
| 622 | ;; read values until "]" | 622 | ;; read values until "]" |
| 623 | (let (elements) | 623 | (let (elements) |
| 624 | (while (not (char-equal (json-peek) ?\])) | 624 | (while (not (= (json-peek) ?\])) |
| 625 | (json-skip-whitespace) | 625 | (json-skip-whitespace) |
| 626 | (when json-pre-element-read-function | 626 | (when json-pre-element-read-function |
| 627 | (funcall json-pre-element-read-function (length elements))) | 627 | (funcall json-pre-element-read-function (length elements))) |
| @@ -629,8 +629,8 @@ become JSON objects." | |||
| 629 | (when json-post-element-read-function | 629 | (when json-post-element-read-function |
| 630 | (funcall json-post-element-read-function)) | 630 | (funcall json-post-element-read-function)) |
| 631 | (json-skip-whitespace) | 631 | (json-skip-whitespace) |
| 632 | (unless (char-equal (json-peek) ?\]) | 632 | (when (/= (json-peek) ?\]) |
| 633 | (if (char-equal (json-peek) ?,) | 633 | (if (= (json-peek) ?,) |
| 634 | (json-advance) | 634 | (json-advance) |
| 635 | (signal 'json-error (list 'bleah))))) | 635 | (signal 'json-error (list 'bleah))))) |
| 636 | ;; Skip over the "]" | 636 | ;; Skip over the "]" |