;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\302\303\304\305\306DD\307\310\311\312\313\314\315& \210\302\316\304\305\317DD\320\310\311\312\321\314\322& \210\302\323\304\305\324DD\325\314\326\312\327\310\311& \207" [require sgml-mode custom-declare-variable js2-basic-offset funcall function #[0 "\301\300!\203 \247\203 \207\302\207" [c-basic-offset boundp 4] 2] "Number of spaces to indent nested statements.\nSimilar to `c-basic-offset'." :group js2-mode :safe integerp :type integer js2-pretty-multiline-declarations #[0 "\300\207" [t] 1] "Non-nil to line up multiline declarations vertically:\n\n var a = 10,\n b = 20,\n c = 30;\n\nIf the value is t, and the first assigned value in the\ndeclaration is a function/array/object literal spanning several\nlines, it won't be indented additionally:\n\n var o = { var bar = 2,\n foo: 3 vs. o = {\n }, foo: 3\n bar = 2; };\n\nIf the value is `all', it will always be indented additionally:\n\n var o = {\n foo: 3\n };\n\n var o = {\n foo: 3\n },\n bar = 2;\n\nIf the value is `dynamic', it will be indented additionally only\nif the declaration contains more than one variable:\n\n var o = {\n foo: 3\n };\n\n var o = {\n foo: 3\n },\n bar = 2;" symbolp symbol js2-indent-switch-body #[0 "\300\207" [nil] 1] "When nil, case labels are indented on the same level as the\ncontaining switch statement. Otherwise, all lines inside\nswitch statement body are indented one additional level." boolean booleanp] 10) #@88 Regular expression matching keywords that are optionally followed by an opening brace. (defconst js2-possibly-braceless-keywords-re "else[ ]+if\\|for[ ]+each\\|\\(?:catch\\|do\\|else\\|f\\(?:inally\\|or\\)\\|if\\|let\\|try\\|w\\(?:hile\\|ith\\)\\)" (#$ . 2011)) #@89 Regular expression matching operators that affect indentation of continued expressions. (defconst js2-indent-operator-re "[-+*/%<>&^|?:.]\\([^-+*/.]\\|$\\)\\|!?=\\|\\_<\\(in\\(?:stanceof\\)?\\)\\_>" (#$ . 2281)) #@60 Regular expression matching variable declaration keywords. (defconst js2-declaration-keyword-re "\\_<\\(const\\|let\\|var\\)\\_>" (#$ . 2499)) #@84 Auxiliary function for `js2-re-search-forward'. (fn REGEXP &optional BOUND COUNT) (defalias 'js2-re-search-forward-inner #[769 "\300\211\301V\203i\302\"\210\211\203\303`\"\202\304`!\262\3058\2037\302\306\307\3058!P\212\300\210`)\310#\210\202c\3118\203C\300y\210\202c\3128\204X`Sf\313=\203_\300f\314=\203_\302\315!\210\202cS\262`\262\202\266`\207" [nil 0 re-search-forward parse-partial-sexp syntax-ppss 3 "\\(\\=\\|[^\\]\\|^\\)" string t 7 4 47 42 "\\*/"] 10 (#$ . 2648)]) #@188 Search forward but ignore strings and comments. Invokes `re-search-forward' but treats the buffer as if strings and comments have been removed. (fn REGEXP &optional BOUND NOERROR COUNT) (defalias 'js2-re-search-forward #[1025 "`\3001/\204\301\302#\202+\303W\203 \304[#\202+\303V\205+\301#0\202>b\210?\205<\305\306!!\262\207" [(search-failed) js2-re-search-forward-inner 1 0 js2-re-search-backward-inner error error-message-string] 9 (#$ . 3158)]) #@85 Auxiliary function for `js2-re-search-backward'. (fn REGEXP &optional BOUND COUNT) (defalias 'js2-re-search-backward-inner #[769 "\300\301V\203X\302\"\210\303`!\262\3048\203'\302\305\306\3048!P\307 \310#\210\202\3118\2035\3128b\210\202\3138\204J`Sf\314=\203Q\300f\315=\203Q\302\316!\210\202S\262\202\210`\207" [nil 0 re-search-backward syntax-ppss 3 "\\([^\\]\\|^\\)" string line-beginning-position t 7 8 4 47 42 "/\\*"] 9 (#$ . 3636)]) #@190 Search backward but ignore strings and comments. Invokes `re-search-backward' but treats the buffer as if strings and comments have been removed. (fn REGEXP &optional BOUND NOERROR COUNT) (defalias 'js2-re-search-backward #[1025 "`\3001/\204\301\302#\202+\303W\203 \304[#\202+\303V\205+\301#0\202>b\210?\205<\305\306!!\262\207" [(search-failed) js2-re-search-backward-inner 1 0 js2-re-search-forward-inner error error-message-string] 9 (#$ . 4106)]) #@61 Return non-nil if text after point is a non-comma operator. (defalias 'js2-looking-at-operator-p #[0 "\302!\205L\303f\304=\203\212\305\306\303\307#\205\303f\310=)\205L\303f\311=\205-\212\312\313 8)\311=?\205L\303f\314=\205K\302\315 \316Q!\205K\212\317 \210`Sf\320>)?\207" [js2-indent-operator-re js2-mode-identifier-re looking-at nil 58 js2-re-search-backward "[?:{]\\|\\_" t 63 47 3 syntax-ppss 42 "\\* *\\(?:\\[\\|" " *(\\)" js2-backward-sws (44 125 123)] 4 (#$ . 4587)]) #@61 Return non-nil if the current line continues an expression. (defalias 'js2-continued-expression-p #[0 "\212\300 \210\301 \203\302f\303>?\2067\304`[!\210`Sf\305>?\2027\304`[!\210o\204+\306u\210\301 \2057\306u\210\307\310!?)\207" [back-to-indentation js2-looking-at-operator-p nil (45 43) forward-comment (44 91 40) -1 looking-at "\\*\\|\\+\\+\\|--\\|/[/*]"] 2 (#$ . 5087)]) #@232 Return non-nil if word after point is `while' of a do-while statement, else returns nil. A braceless do-while statement spanning several lines requires that the start of the loop is indented to the same column as the current line. (defalias 'js2-end-of-do-while-loop-p #[0 "\212\300\301!\205U\212\302\303x\210\300\302!)\203!\212\304 \210\305v\210\300\306!)\202U\307\306\310 \311#\210\300\306!\206U\312 \307\313\303\311#\203?\312 U\2030\300\314!\205S\315\316\317 \311#?\205S\312 U\262)\207" [looking-at "\\s-*\\_" "[ \n]*}" nil backward-list -1 "\\_" js2-re-search-backward point-at-bol t current-indentation "^[ ]*\\_<" "[ ]*\\_" js2-re-search-forward "\\_" point-at-eol] 5 (#$ . 5473) nil]) #@151 Return the declaration indentation column if the current line belongs to a multiline declaration statement. See `js2-pretty-multiline-declarations'. (defalias 'js2-multiline-decl-indentation #[0 "\303\211\212\304 \210\305 !?\205u\305\n!\203\306\225b\210\211\204io\204i`\212\307 \210`Sf\310=\206O`Sf\311=\204L\312\313!\210\305\n!\307 \210\203L`Sf\311=?\206O\314!)\262\203i\3151_\316 0\202e\317\211\262\262\210\202\305 !\205u\306\225b\210iT*\207" [forward-sexp-function js2-declaration-keyword-re js2-indent-operator-re nil back-to-indentation looking-at 0 js2-backward-sws 44 59 skip-syntax-backward "." js2-same-line (scan-error) backward-sexp t] 5 (#$ . 6220)]) #@186 Return the proper indentation of current line if it is a control statement. Returns an indentation if this line starts the body of a control statement without braces, else returns nil. (defalias 'js2-ctrl-statement-indentation #[0 "\303\212\304 \210\305e!?\205i\306\307!?\205i\310\311\303\312#\205i\306\313!?\205i\303u\210`Sf\314U\203B\31518\316 0\202<\210\202=\210\317\320 x\210`\304 \210\306\321!\203P\322\225b\210\306 !\205`\322\225U\205`\323 ?\262\205i\324 \n\\*\207" [forward-sexp-function js2-possibly-braceless-keywords-re js2-basic-offset nil back-to-indentation js2-same-line looking-at "{" js2-re-search-backward "[[:graph:]]" t "[{([]" 41 (error) backward-sexp " " point-at-bol "}[ ]*" 0 js2-end-of-do-while-loop-p current-indentation] 4 (#$ . 6912)]) #@146 Return non-nil if we think we're in an array comprehension. In particular, return the buffer position of the first `for' kwd. (fn PARSE-STATUS) (defalias 'js2-indent-in-array-comp #[257 "\211A@`\205_\212b\210\301\302!\205^\303u\210\304 \210\301\305!\203:\306\307 \210\304 \210\306f\310U?\2056\301\311!\2056\312\224)\202^\211`V\205^\313\314\315#\205^\316`\"\211@\303U\205W\3178?\262\205^\303\224)\207" [forward-sexp-function looking-at "\\[" 1 js2-forward-sws "[[{]" nil forward-sexp 44 "for" 0 re-search-forward "[^,]]* \\(for\\) " t parse-partial-sexp 8] 7 (#$ . 7699)]) #@29 (fn PARSE-STATUS FOR-KWD) (defalias 'js2-array-comp-indentation #[514 "\300!\203\212A@b\210\301u\210\302\303w\210i)\207\212\211b\210i)\207" [js2-same-line 1 " " nil] 4 (#$ . 8295)]) #@227 Helper function for `js2-proper-indentation'. Depending on the value of `js2-pretty-multiline-declarations', move point to the end of a variable declaration keyword so that indentation is aligned to that column. (fn BRACKET) (defalias 'js2-maybe-goto-declaration-keyword-end #[257 "\304=\203\305 !\205W\306\225Tb\207\307=\205W\310\211\211\305 !\205U\306\225\262\212b\210\31117\310\312 \210)\3130\2029\210\310\262\203M\314 \210\315\313\305!)\262\262)\211\205UTb\266\203\207" [js2-pretty-multiline-declarations js2-declaration-keyword-re forward-sexp-function inhibit-changing-match-data all looking-at 0 dynamic nil (error) forward-sexp t js2-forward-sws ","] 7 (#$ . 8491)]) #@72 Return the proper indentation for the current line. (fn PARSE-STATUS) (defalias 'js2-proper-indentation #[257 "\3042\366\212\305 \210\3068\203\307\304\310!\"\210\311\312!\211\2063\311\313!\2063\311\314!\2053\212\315 \210`Sf\316>)?\317 \205;\320 A@\321\211\203n \322Y\203n\323!\204n\324!\211\262\203n`\212b\210\325 )Y\203n\326\"\202\362\327 \206\362\203\201\203\201\n\\\202\362\206\362\203\351b\210\311\330!\203\332\212\331\321x\210\311\332!)\203\241\333 \210\305 \210\334!\210\203\260i\202\277\203\274i\n\335_\\\202\277i\n\\\262 \203\326\204\326\311\336!\203\326\211\n\\\202\362\211\202\362\204\345\321u\210\337\321w\210i\202\362\203\361\n\202\362\340\266\207)0\207" [js2-pretty-multiline-declarations js2-language-version js2-basic-offset js2-indent-switch-body --cl-block-js2-proper-indentation-- back-to-indentation 4 throw js2--comment-indent looking-at "[]})]" "\\_[^:]" "\\_" " " 0] 11 (#$ . 9194)]) #@85 Indentation inside a multi-line block comment continuation line. (fn PARSE-STATUS) (defalias 'js2--comment-indent #[257 "\212\3008b\210\301\302!\203iT\202\303)\207" [8 looking-at "/\\*" 0] 3 (#$ . 10501)]) #@85 Indent the current line as JavaScript source text. (fn &optional BOUNCE-BACKWARDS) (defalias 'js2-indent-line #[256 "\301\211\302\212\303\304 !)\262`\212\305 \210`)Z\262\3068?\205.\307\310!!\210\211\211\311V\262\205.\211u)\207" [inhibit-point-motion-hooks nil t syntax-ppss point-at-bol back-to-indentation 3 indent-line-to js2-proper-indentation 0] 6 (#$ . 10719) nil]) #@509 Find where JSX starts. Assume JSX appears in the following instances: - Inside parentheses, when returned or as the first argument to a function, and after a newline - When assigned to variables or object properties, but only on a single line - As the N+1th argument to a function This is an optimized version of (re-search-backward "[(,] " nil t), except set point to the end of the match. This logic executes up to the number of lines in the file, so it should be really fast to reduce that impact. (defalias 'js2--jsx-find-before-tag #[0 "\300`eV\203\"\301\210`Sf\302=\204`Sf\303=\203`S\211\262\203\211\207" [nil 0 40 44] 3 (#$ . 11106)]) (put 'js2--jsx-find-before-tag 'byte-optimizer 'byte-compile-inline-expand) #@32 Find the end of a JSX element. (defconst js2--jsx-end-tag-re (concat "\\|/>") (#$ . 11846)) #@116 Find where JSX ends. This complements the assumption of where JSX appears from `js--jsx-before-tag-re', which see. (defconst js2--jsx-after-tag-re "[),]" (#$ . 11964)) #@688 Determine if/how the current line should be indented as JSX. Return `first' for the first JSXElement on its own line. Return `nth' for subsequent lines of the first JSXElement. Return `expression' for an embedded JS expression. Return `after' for anything after the last JSXElement. Return nil for non-JSX lines. Currently, JSX indentation supports the following styles: - Single-line elements (indented like normal JS): var element =
; - Multi-line elements (enclosed in parentheses): function () { return (
); } - Function arguments: React.render(
, document.querySelector('.root') ); (defalias 'js2--jsx-indented-element-p #[0 "`\303 \304\211\211\211\211\211\211\211\211\211\211\212\304\210\204]\304`eV\2039\305\210`Sf\306=\2041`Sf\307=\203`S\211\262\203\211\262\211\262\f\203]\310\311!\204B\304f\312U\203V\n\262\n`\262\nb\210\202\205K\303\n!\262 \303!\262  V\205K Y\205K\204\240\313\304\314#\211\262\f\203\240\310\311!\204\215\315 !\203~\n\262\202~\203\322\303!\262\303!\262 X\203\275 X\204\326 V\205K W\205K\316\211\262\202\323\314\205K\211\204:\fb\210\304\210\317\320 8\262\203:\211\204:@\262Y\2033f\321U\2033 \303!V\2033b\210\3221\304\323 )0\202\210\202)\203) \303 W\202*\314\2033\324\262\202\347A\262\202\347\211\206K U\203J\325\202K\326)\207" [js2--jsx-end-tag-re js2--jsx-after-tag-re forward-sexp-function line-number-at-pos nil 0 40 44 forward-comment 1 60 re-search-forward t looking-at after 9 syntax-ppss 123 (error) forward-sexp expression first nth] 17 (#$ . 12139)]) #@51 Execute BODY as if in sgml-mode. (fn &rest BODY) (defalias 'js2--as-sgml '(macro . #[128 "\300\301\302\303BBE\207" [with-syntax-table sgml-mode-syntax-table let (forward-sexp-function parse-sexp-lookup-properties)] 6 (#$ . 13836)])) #@71 Indent the current line as JavaScript or SGML (whichever is farther). (defalias 'js2--expression-in-sgml-indent-line #[0 "\305`\306\212\307\310 !)\3118?\205`\212\312 \210`Y\203\305\262\313 p\314\315\316\317\320\"\321\"\322$\216\323 !\210\305\211\324 +\266\202)\262\204H\325\202`\326!\f\\]\262\203]\212\327!)\202`\327!)\207" [inhibit-point-motion-hooks sgml-mode-syntax-table parse-sexp-lookup-properties forward-sexp-function js2-basic-offset nil t syntax-ppss point-at-bol 3 back-to-indentation syntax-table make-byte-code 0 "r\301q\210\302\300!)\207" vconcat vector [set-syntax-table] 2 set-syntax-table sgml-calculate-indent noindent js2-proper-indentation indent-line-to] 12 (#$ . 14077)]) #@125 Indent the current line as JSX (with SGML offsets). i.e., customize JSX element indentation with `sgml-basic-offset' et al. (defalias 'js2-jsx-indent-line #[0 "\303 \211\304=\203 \305 \202]\211\306=\204\211\307=\2033\310K\311\312\313\314\315!\316\"\317$\216\310\320M\210\321 )\262\202]\211\322=\203[\323 p\311\312\324\314\315\"\325\"\317$\216\326!\210\327\211\330 +\266\202\202]\321 \207" [sgml-mode-syntax-table parse-sexp-lookup-properties forward-sexp-function js2--jsx-indented-element-p expression js2--expression-in-sgml-indent-line first after js2-continued-expression-p make-byte-code 0 "\301\300M\207" vconcat vector [js2-continued-expression-p] 2 ignore js2-indent-line nth syntax-table "r\301q\210\302\300!)\207" [set-syntax-table] set-syntax-table nil sgml-indent-line] 10 (#$ . 14803) nil]) (provide 'js2-old-indent)