[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/js2-mode 29979e5 61/61: Merge branch 'externals/js2-mod
From: |
Dmitry Gutov |
Subject: |
[elpa] externals/js2-mode 29979e5 61/61: Merge branch 'externals/js2-mode' of git+ssh://git.sv.gnu.org/srv/git/emacs/elpa |
Date: |
Sun, 20 Dec 2020 12:20:13 -0500 (EST) |
branch: externals/js2-mode
commit 29979e5f3301796ba606759e39ee0b1b6a2a24f3
Merge: f956476 474c396
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>
Merge branch 'externals/js2-mode' of
git+ssh://git.sv.gnu.org/srv/git/emacs/elpa
---
js2-imenu-extras.el | 2 +-
js2-mode.el | 112 +++++++++++++++++++++++++---------------------------
js2-old-indent.el | 2 +-
3 files changed, 56 insertions(+), 60 deletions(-)
diff --git a/js2-imenu-extras.el b/js2-imenu-extras.el
index 97de16c..4859bef 100644
--- a/js2-imenu-extras.el
+++ b/js2-imenu-extras.el
@@ -268,7 +268,7 @@ For example, for code
{rules: {password: {required: function() {}}}}
when NODE is the inner `js2-object-prop-mode',
-it returns `(\"rules\" \"password\")'."
+it returns (\"rules\" \"password\")."
(let (rlt (n node))
(while (setq n (js2-imenu-parent-prop-node n))
(push (js2-prop-node-name (js2-object-prop-node-left n)) rlt))
diff --git a/js2-mode.el b/js2-mode.el
index a71196b..7df0557 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -285,7 +285,7 @@ If `js2-dynamic-idle-timer-adjust' is 0 or negative,
(defcustom js2-concat-multiline-strings t
"When non-nil, `js2-line-break' in mid-string will make it a
-string concatenation. When `eol', the '+' will be inserted at the
+string concatenation. When `eol', the `+' will be inserted at the
end of the line, otherwise, at the beginning of the next line."
:type '(choice (const t) (const eol) (const nil))
:group 'js2-mode)
@@ -338,10 +338,10 @@ interferes with type inference (in systems that support
it.)"
:group 'js2-mode)
(defcustom js2-strict-cond-assign-warning t
- "Non-nil to warn about expressions like if (a = b).
-This often should have been '==' instead of '='. If the warning
+ "Non-nil to warn about usage like `if (a = b)'.
+This often should have been `==' instead of `='. If the warning
is enabled, you can suppress it on a per-expression basis by
-parenthesizing the expression, e.g. if ((a = b)) ..."
+parenthesizing the expression, e.g., `if ((a = b)) ...'."
:type 'boolean
:group 'js2-mode)
@@ -422,7 +422,7 @@ setting `allowMemberExprAsFunctionName'. The experimental
syntax is:
function <member-expr> ( [ arg-list ] ) { <body> }
-Where member-expr is a non-parenthesized 'member expression', which
+Where member-expr is a non-parenthesized `member expression', which
is anything at the grammar level of a new-expression or lower, meaning
any expression that does not involve infix or unary operators.
@@ -2763,7 +2763,7 @@ It contains a local-name node which is the name of the
value in the
current scope, and extern-name which is the name of the value in the
imported or exported scope. By default these are the same, but if the
name is aliased as in {foo as bar}, it would have an extern-name node
-containing 'foo' and a local-name node containing 'bar'."
+containing `foo' and a local-name node containing `bar'."
local-name ; js2-name-node with the variable name in this scope
extern-name) ; js2-name-node with the value name in the exporting module
@@ -2781,8 +2781,8 @@ different, visit the extern-name."
(js2-visit-ast extern-name v))))
(defun js2-print-extern-binding (n _i)
- "Print a representation of a single extern binding. E.g. 'foo' or
-'foo as bar'."
+ "Print a representation of a single extern binding. E.g. `foo' or
+`foo as bar'."
(let ((local-name (js2-export-binding-node-local-name n))
(extern-name (js2-export-binding-node-extern-name n)))
(insert (js2-name-node-name extern-name))
@@ -2907,9 +2907,9 @@ local context."
len
name)))
"AST node for a complete namespace import.
-E.g. the '* as lib' expression in:
+E.g. the `* as lib' expression in:
-import * as lib from 'src/lib'
+import * as lib from \\='src/lib\\='
It contains a single name node referring to the bound name."
name) ; js2-name-node of the bound name.
@@ -2928,7 +2928,7 @@ It contains a single name node referring to the bound
name."
module-id
metadata-p)))
"AST node for the from clause in an import or export statement.
-E.g. from 'my/module'. It can refere to either an external module, or to the
+E.g. from \\='my/module\\='. It can refere to either an external module, or to
the
modules metadata itself."
module-id ; string containing the module specifier.
metadata-p) ; true if this clause refers to the module's metadata
@@ -3227,7 +3227,7 @@ NODE is a `js2-labels-node'. LABEL is an identifier."
len label target)))
"AST node for a break statement.
The label field is a `js2-name-node', possibly nil, for the named label
-if provided. E.g. in 'break foo', it represents 'foo'. The target field
+if provided. E.g. in `break foo', it represents `foo'. The target field
is the target of the break - a label node or enclosing loop/switch statement.")
(js2--struct-put 'js2-break-node 'js2-visitor 'js2-visit-jump-node)
@@ -4278,7 +4278,7 @@ no explicit target, which is valid in certain expression
contexts such as
company..employee.(@id < 100)
-in this case, the @id is a `js2-xml-ref' that is part of an infix '<'
+in this case, the @id is a `js2-xml-ref' that is part of an infix `<'
expression whose parent is a `js2-xml-dot-query-node'."
namespace
at-pos
@@ -4299,7 +4299,7 @@ expression whose parent is a `js2-xml-dot-query-node'."
"AST node for an E4X XML [expr] property-ref expression.
The JavaScript syntax is an optional @, an optional ns::, and a name.
- [ '@' ] [ name '::' ] name
+ [ `@' ] [ name `::' ] name
Examples include name, ns::name, ns::*, *::name, *::*, @attr, @ns::attr,
@ns::*, @*::attr, @*::*, and @*.
@@ -4337,7 +4337,7 @@ expression."
"AST node for an E4X XML [expr] member-ref expression.
Syntax:
- [ '@' ] [ name '::' ] '[' expr ']'
+ [ `@' ] [ name `::' ] `[' expr `]'
Examples include ns::[expr], @ns::[expr], @[expr], *::[expr] and @*::[expr].
@@ -4502,7 +4502,7 @@ For a simple name, the kids list has exactly one node, a
`js2-name-node'."
(pos js2-ts-cursor)
len name value
eq-pos quote-type)))
- "AST node representing a foo='bar' XML attribute value. Not yet used."
+ "AST node representing a foo=\\='bar\\=' XML attribute value. Not yet used."
name ; a `js2-xml-name-node'
value ; a `js2-xml-name-node'
eq-pos ; buffer position of "=" sign
@@ -5458,7 +5458,7 @@ Returns logical OR of END_* flags"
(defun js2-always-defined-boolean-p (node)
"Check if NODE always evaluates to true or false in boolean context.
-Returns 'ALWAYS_TRUE, 'ALWAYS_FALSE, or nil if it's neither always true
+Returns `ALWAYS_TRUE', `ALWAYS_FALSE', or nil if it's neither always true
nor always false."
(let ((tt (js2-node-type node))
num)
@@ -5513,7 +5513,7 @@ Signals an error if it's not a recognized token."
(error "Invalid token: %s" code)))))
(defsubst js2-tt-sym (tok)
- "Return symbol for TOK given its code, e.g. 'js2-LP for code 86."
+ "Return symbol for TOK given its code, e.g. `js2-LP' for code 86."
(intern (js2-tt-name tok)))
(defconst js2-token-codes
@@ -5528,7 +5528,7 @@ Signals an error if it's not a recognized token."
"Hashtable mapping token type symbols to their bytecodes.")
(defsubst js2-tt-code (sym)
- "Return code for token symbol SYM, e.g. 86 for 'js2-LP."
+ "Return code for token symbol SYM, e.g. 86 for `js2-LP'."
(or (gethash sym js2-token-codes)
(error "Invalid token symbol: %s " sym))) ; signal code bug
@@ -5582,7 +5582,7 @@ Also updates `js2-ts-hit-eof' and `js2-ts-line-start' as
needed."
(defun js2-read-unicode-escape ()
"Read a \\uNNNN sequence from the input.
-Assumes the ?\ and ?u have already been read.
+Assumes the ?\\ and ?u have already been read.
Returns the unicode character, or nil if it wasn't a valid character.
Doesn't change the values of any scanner variables."
;; I really wish I knew a better way to do this, but I can't
@@ -5774,7 +5774,7 @@ The values are default faces to use for highlighting the
keywords.")
do
(puthash (symbol-name k) 'js2-RESERVED table))
table)
- "JavaScript reserved words by name, mapped to 'js2-RESERVED.")
+ "JavaScript reserved words by name, mapped to `js2-RESERVED'.")
(defun js2-collect-string (buf)
"Convert BUF, a list of chars, to a string.
@@ -5785,7 +5785,7 @@ Reverses BUF before converting."
(defun js2-string-to-keyword (s)
"Return token for S, a string, if S is a keyword or reserved word.
-Returns a symbol such as 'js2-BREAK, or nil if not keyword/reserved."
+Returns a symbol such as `js2-BREAK', or nil if not keyword/reserved."
(or (gethash s js2-keyword-names)
(gethash s js2-reserved-word-names)))
@@ -7630,7 +7630,7 @@ When passed arguments of wrong type, does nothing."
(js2-record-object-literal node qname (js2-node-pos node)))))))))
(defun js2-compute-nested-prop-get (node)
- "If NODE is of form foo.bar, foo['bar'], or any nested combination, return
+ "If NODE is of form foo.bar, foo[\\='bar\\='], or any nested combination,
return
component nodes as a list. Otherwise return nil. Element-gets are treated
as property-gets if the index expression is a string, or a positive integer."
(let (left right head)
@@ -7843,19 +7843,19 @@ Recurses through nodes, and for each one whose second
element is a list,
appends the list's flattened elements to the current element. Also
changes the tails into conses. For instance, this pre-flattened trie
-'(a ((b 20)
+ (a ((b 20)
(c ((d 30)
(e 40)))))
becomes
-'(a (b . 20)
+ (a (b . 20)
(c (d . 30)
(e . 40)))
Note that the root of the trie has no key, just a list of chains.
This is also true for the value of any key with multiple children,
-e.g. key 'c' in the example above."
+e.g. key `c' in the example above."
(cond
((listp (car trie))
(mapcar #'js2-flatten-trie trie))
@@ -8139,11 +8139,11 @@ The returned AST root node is given some additional
properties:
so the value is not necessarily reliable.
An optional callback CB can be specified to report parsing
-progress. If `(functionp CB)' returns t, it will be called with
+progress. If (functionp CB) returns t, it will be called with
the current line number once before parsing begins, then again
each time the lexer reaches a new line number.
-CB can also be a list of the form `(symbol cb ...)' to specify
+CB can also be a list of the form (symbol cb ...) to specify
multiple callbacks with different criteria. Each symbol is a
criterion keyword, and the following element is the callback to
call
@@ -8766,11 +8766,11 @@ Return value is a list (EXPR LP RP), with absolute
paren positions."
"Parse the bindings in an import statement.
This can take many forms:
-ImportedDefaultBinding -> 'foo'
-NameSpaceImport -> '* as lib'
-NamedImports -> '{foo as bar, bang}'
-ImportedDefaultBinding , NameSpaceImport -> 'foo, * as lib'
-ImportedDefaultBinding , NamedImports -> 'foo, {bar, baz as bif}'
+ImportedDefaultBinding -> `foo'
+NameSpaceImport -> `* as lib'
+NamedImports -> `{foo as bar, bang}'
+ImportedDefaultBinding , NameSpaceImport -> `foo, * as lib'
+ImportedDefaultBinding , NamedImports -> `foo, {bar, baz as bif}'
Try to match namespace imports and named imports first because nothing can
come after them. If it is an imported default binding, then it could have named
@@ -8829,7 +8829,7 @@ imports or a namespace import that follows it.
clause))
(defun js2-parse-namespace-import ()
- "Parse a namespace import expression such as '* as bar'.
+ "Parse a namespace import expression such as `* as bar'.
The current token must be js2-MUL."
(let ((beg (js2-current-token-beg)))
(cond
@@ -8852,7 +8852,8 @@ The current token must be js2-MUL."
(defun js2-parse-from-clause ()
- "Parse the from clause in an import or export statement. E.g. from 'src/lib'"
+ "Parse the from clause in an import or export statement.
+E.g., \"from \\='src/lib\\='\"."
(if (js2-match-contextual-kwd "from")
(let ((beg (js2-current-token-beg)))
(cond
@@ -8895,8 +8896,8 @@ js2-LC. Return a lisp list of js2-export-binding-node"
(defun js2-maybe-parse-export-binding (&optional import-p)
"Attempt to parse a binding expression found inside an import/export
statement.
-This can take the form of either as single js2-NAME token as in 'foo' or as in
a
-rebinding expression 'bar as foo'. If it matches, it will return an instance of
+This can take the form of either as single js2-NAME token as in `foo' or as in
a
+rebinding expression `bar as foo'. If it matches, it will return an instance of
js2-export-binding-node and consume all the tokens. If it does not match, it
consumes no tokens."
(let ((extern-name (when (js2-match-prop-name) (js2-current-token-string)))
@@ -9055,7 +9056,7 @@ consumes no tokens."
(defun js2-parse-export ()
"Parse an export statement.
-The Last matched token must be js2-EXPORT. Currently, the 'default' and 'expr'
+The Last matched token must be js2-EXPORT. Currently, the `default' and `expr'
expressions should only be either hoistable expressions (function or generator)
or assignment expressions, but there is no checking to enforce that and so it
will parse without error a small subset of
@@ -9687,10 +9688,10 @@ expression and return it wrapped in a
`js2-expr-stmt-node'."
(defun js2-parse-variables (decl-type pos)
"Parse a comma-separated list of variable declarations.
-Could be a 'var', 'const' or 'let' expression, possibly in a for-loop
initializer.
+Could be a `var', `const' or `let' expression, possibly in a for-loop
initializer.
DECL-TYPE is a token value: either VAR, CONST, or LET depending on context.
-For 'var' or 'const', the keyword should be the token last scanned.
+For `var' or `const', the keyword should be the token last scanned.
POS is the position where the node should start. It's sometimes the
var/const/let keyword, and other times the beginning of the first token
@@ -10516,7 +10517,7 @@ This includes expressions of the forms:
@* @*::attr @*::*
@[expr] @*::[expr] @ns::[expr]
-Called if we peeked an '@' token."
+Called if we peeked an `@' token."
(let ((tt (js2-get-prop-name-token))
(at-pos (js2-current-token-beg)))
(cond
@@ -10537,11 +10538,11 @@ Called if we peeked an '@' token."
(defun js2-parse-property-name (at-pos s member-type-flags)
"Check if :: follows name in which case it becomes qualified name.
-AT-POS is a natural number if we just read an '@' token, else nil.
-S is the name or string that was matched: an identifier, 'throw' or '*'.
-MEMBER-TYPE-FLAGS is a bit set tracking whether we're a '.' or '..' child.
+AT-POS is a natural number if we just read an `@' token, else nil.
+S is the name or string that was matched: an identifier, `throw' or `*'.
+MEMBER-TYPE-FLAGS is a bit set tracking whether we're a `.' or `..' child.
-Returns a `js2-xml-ref-node' if it's an attribute access, a child of a '..'
+Returns a `js2-xml-ref-node' if it's an attribute access, a child of a `..'
operator, or the name is followed by ::. For a plain name, returns a
`js2-name-node'. Returns a `js2-error-node' for malformed XML expressions."
(let ((pos (or at-pos (js2-current-token-beg)))
@@ -10797,7 +10798,7 @@ array-literals, array comprehensions and regular
expressions."
"Parse a legacy array comprehension (JavaScript 1.7).
EXPR is the first expression after the opening left-bracket.
POS is the beginning of the LB token preceding EXPR.
-We should have just parsed the 'for' keyword before calling this function."
+We should have just parsed the `for' keyword before calling this function."
(let ((current-scope js2-current-scope)
loops first filter result)
(unwind-protect
@@ -10834,7 +10835,7 @@ We should have just parsed the 'for' keyword before
calling this function."
(defun js2-parse-array-comp (pos)
"Parse an ES6 array comprehension.
POS is the beginning of the LB token.
-We should have just parsed the 'for' keyword before calling this function."
+We should have just parsed the `for' keyword before calling this function."
(let ((pn (js2-parse-comprehension pos 'ARRAY)))
(js2-must-match js2-RB "msg.no.bracket.arg" pos)
pn))
@@ -10875,9 +10876,9 @@ We should have just parsed the 'for' keyword before
calling this function."
result))
(defun js2-parse-comp-loop (pn &optional only-of-p)
- "Parse a 'for [each] (foo [in|of] bar)' expression in an Array comprehension.
+ "Parse a `for [each] (foo [in|of] bar)' expression in an Array comprehension.
The current token should be the initial FOR.
-If ONLY-OF-P is non-nil, only the 'for (foo of bar)' form is allowed."
+If ONLY-OF-P is non-nil, only the `for (foo of bar)' form is allowed."
(let ((pos (js2-comp-loop-node-pos pn))
tt iter obj foreach-p forof-p in-pos each-pos lp rp)
(when (and (not only-of-p) (js2-match-token js2-NAME))
@@ -11740,18 +11741,13 @@ highlighting features of `js2-mode'."
map)
"Keymap used for js2 diagnostics buffers.")
-(defun js2-error-buffer-mode ()
+(define-derived-mode js2-error-buffer-mode special-mode "JS Lint Diagnostics"
"Major mode for js2 diagnostics buffers.
Selecting an error will jump it to the corresponding source-buffer error.
\\{js2-error-buffer-mode-map}"
- (interactive)
- (setq major-mode 'js2-error-buffer-mode
- mode-name "JS Lint Diagnostics")
- (use-local-map js2-error-buffer-mode-map)
(setq truncate-lines t)
(set-buffer-modified-p nil)
- (setq buffer-read-only t)
- (run-hooks 'js2-error-buffer-mode-hook))
+ (setq buffer-read-only t))
(defun js2-error-buffer-next ()
"Move to next error and view it."
@@ -11780,7 +11776,7 @@ Selecting an error will jump it to the corresponding
source-buffer error.
"Scroll source buffer to show error at current line."
(interactive)
(cond
- ((not (eq major-mode 'js2-error-buffer-mode))
+ ((not (derived-mode-p 'js2-error-buffer-mode))
(message "Not in a js2 errors buffer"))
((not (buffer-live-p js2-source-buffer))
(message "Source buffer has been killed"))
@@ -12926,7 +12922,7 @@ it marks the next defun after the ones already marked."
(defun js2-search-object-for-prop (object prop-names)
"Return node in OBJECT that matches PROP-NAMES or nil.
PROP-NAMES is a list of values representing a path to a value in OBJECT.
-i.e. ('name' 'value') = {name : { value: 3}}"
+i.e. (\\='name\\=' \\='value\\=') = {name : { value: 3}}"
(let (node
(temp-object object)
(temp t) ;temporay node
diff --git a/js2-old-indent.el b/js2-old-indent.el
index 693a7d3..3f10a4d 100644
--- a/js2-old-indent.el
+++ b/js2-old-indent.el
@@ -564,7 +564,7 @@ Currently, JSX indentation supports the following styles:
React.render(
<div></div>,
- document.querySelector('.root')
+ document.querySelector(\\='.root\\=')
);"
(let ((current-pos (point))
(current-line (line-number-at-pos))
- [elpa] externals/js2-mode 90e1434 48/61: Merge pull request #558 from phst/edebug, (continued)
- [elpa] externals/js2-mode 90e1434 48/61: Merge pull request #558 from phst/edebug, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode eb3be7e 54/61: Fix misplaced paren, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode c1763ab 52/61: add failing tests, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 0f627a4 57/61: Update README.md, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 6740d34 50/61: fix tokencount + structure, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode f956476 60/61: Release new version, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode f7816bd 59/61: Support logical assignment operators, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 40aab27 56/61: Update NEWS, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode b21e117 36/61: Add WindowOrWorkerGlobalScope symbols to js2-browser-externs, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 394b85e 51/61: Add node creation and basic syntax tests, Dmitry Gutov, 2020/12/20
- [elpa] externals/js2-mode 29979e5 61/61: Merge branch 'externals/js2-mode' of git+ssh://git.sv.gnu.org/srv/git/emacs/elpa,
Dmitry Gutov <=