Files
emacsd/elpa/json-reformat-20160212.853/json-reformat.elc

36 lines
4.9 KiB
Plaintext
Raw Normal View History

2019-10-27 19:05:34 +01:00
;ELC
;;; Compiled
;;; in Emacs version 26.3
;;; with all optimizations.
;;; This file contains utf-8 non-ASCII characters,
;;; and so cannot be loaded into Emacs 22 or earlier.
(and (boundp 'emacs-version)
(< (aref emacs-version (1- (length emacs-version))) ?A)
(string-lessp emacs-version "23")
(error "`%s' was compiled for Emacs 23 or later" #$))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(byte-code "\300\301!\210\300\302\303\304#\204\305\306\307\"\210\310\306\311\312#\210\310\313\314\315#\210\310\313\316\317#\207" [require json subr-x nil t defalias hash-table-keys #[(hash-table) "\302\303\304 \"\210)\207" [keys hash-table nil maphash #[(k _v) " B\211\207" [k keys] 2]] 3 "Return a list of keys in HASH-TABLE."] put byte-optimizer byte-compile-inline-expand json-reformat-error error-message "JSON Reformat error" error-conditions (json-reformat-error error)] 4)
(defconst json-reformat:special-chars-as-pretty-string '((34 . 34) (92 . 92)))
(byte-code "\300\301\302\303\304\305\306\307\310\311& \210\300\312\313\314\304\315\306\316\310\311& \207" [custom-declare-variable json-reformat:indent-width 4 "How much indentation `json-reformat-region' should do at each level." :type integer :safe integerp :group json-reformat json-reformat:pretty-string\? nil "Whether to decode the string.\n\nExample:\n\n{\"name\":\"foobar\",\"nick\":\"foo \\u00e4 bar\",\"description\":\"<pre>\\nbaz\\n</pre>\"}\n\nIf nil:\n\n {\n \"name\": \"foobar\",\n \"nick\": \"foo \\u00e4 bar\",\n \"description\": \"<pre>\\nbaz\\n<\\/pre>\"\n }\n\nElse t:\n\n {\n \"name\": \"foobar\",\n \"nick\": \"foo ä bar\",\n \"description\": \"<pre>\n baz\n </pre>\"\n }" boolean booleanp] 10)
(defalias 'json-reformat:indent #[(level) "\302 _\303\"\207" [level json-reformat:indent-width make-string 32] 3])
(defalias 'json-reformat:number-to-string #[(val) "\301!\207" [val number-to-string] 2])
(defalias 'json-reformat:symbol-to-string #[(val) "\302\232\203\303\207 \232\203\304\207\305!\207" [val json-false t "true" "false" symbol-name] 2])
(defalias 'json-reformat:encode-char-as-pretty #[(char) "\303\304\"\305 \"@\211\203\306\307\n\"\202\306\310\")\207" [char json-reformat:special-chars-as-pretty-string special-char encode-char ucs rassoc format "\\%c" "%c"] 4])
(defalias 'json-reformat:string-to-string #[(val) "\203 \302\303\304\305 \306#\"\207\307 !\207" [json-reformat:pretty-string\? val format "\"%s\"" mapconcat json-reformat:encode-char-as-pretty "" json-encode-string] 6])
(defalias 'json-reformat:vector-to-string #[(val level) "G\306U\203 \307\207\310\311\312\313\314\211\nT\211 GW\2032 \nH\315 T!\316 T\"P\fB\202\f\237,\317#\320\315 !\321\260\207" [val #1=#:--cl-vec-- #2=#:--cl-idx-- v #3=#:--cl-var-- level 0 "[]" "[\n" mapconcat identity -1 nil json-reformat:indent json-reformat:print-node ",\n" "\n" "]"] 8])
(defalias 'json-reformat:print-node #[(val level) "\302!\203 \303\304! \"\207\247\203\305!\207\306!\203!\307 \"\207\204'\310\2079\2030\311!\207\312!\207" [val level hash-table-p json-reformat:tree-to-string json-reformat:tree-sibling-to-plist json-reformat:number-to-string vectorp json-reformat:vector-to-string "null" json-reformat:symbol-to-string json-reformat:string-to-string] 3])
(defalias 'json-reformat:tree-sibling-to-plist #[(root) "\304\305\306 !!\304\211\203! @\307\n\310\n \"# A\211\204\304+\207" [pl root key --dolist-tail-- nil reverse hash-table-keys plist-put gethash] 7])
(defalias 'json-reformat:tree-to-string #[(root level) "\305\306\211\211 \2030 @ A@ AA\307\fT!\310\n\310\311\312 \fT\" \205)\313\314\260 \202+\307\f!\315R\207" [str val key root level "{\n" nil json-reformat:indent "\"" ": " json-reformat:print-node "," "\n" "}"] 10])
(defalias 'json-reformat-from-string #[(string) "\306\307!rq\210\310\216 c\210eb\210\3111&\301\312\313\314 \315\n\316\"+0\2023\317\320\321 !\322`!`E\")+\207" [#1=#:temp-buffer string json-tree json-object-type json-key-type errvar generate-new-buffer " *temp*" #[nil "\301!\205 \302!\207" [#1# buffer-name kill-buffer] 2] (json-error) hash-table nil json-read json-reformat:print-node 0 signal json-reformat-error error-message-string line-number-at-pos] 5])
#@187 Reformat the JSON in the specified region.
If you want to customize the reformat style,
please see the documentation of `json-reformat:indent-width'
and `json-reformat:pretty-string?'.
(defalias 'json-reformat-region #[(begin end) "\306!\212\214 }\210eb\210\307\3101&\311\312ed\"!ed|\210\fc0\202H\211A@\313 8\314 8\315\316\317\n\320#\317 \320#$,-\207" [begin start-pos start-line end reformatted errvar line-number-at-pos nil (json-reformat-error) json-reformat-from-string buffer-substring-no-properties 2 3 message "JSON parse error [Reason] %s [Position] In buffer, line %d (char %d)" + -1 position line reason] 9 (#$ . 4302) "*r"])
(provide 'json-reformat)