[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/js2-mode f16a9ae 1/2: Fix some quoting problems in doc
From: |
Stefan Monnier |
Subject: |
[elpa] externals/js2-mode f16a9ae 1/2: Fix some quoting problems in doc strings |
Date: |
Fri, 27 Nov 2020 19:07:01 -0500 (EST) |
branch: externals/js2-mode
commit f16a9aed96896e8e987cc636d960107e6eecefd2
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>
Fix some quoting problems in doc strings
Most of these are minor issues involving, e.g., quoting `like this'
instead of 'like this'. A few involve escaping ` and ' with a
preceding \= when the characters should not be turned into curved single
quotes.
---
js2-imenu-extras.el | 2 +-
js2-mode.el | 101 ++++++++++++++++++++++++++--------------------------
js2-old-indent.el | 2 +-
3 files changed, 53 insertions(+), 52 deletions(-)
diff --git a/js2-imenu-extras.el b/js2-imenu-extras.el
index dfdedc8..81c6d08 100644
--- a/js2-imenu-extras.el
+++ b/js2-imenu-extras.el
@@ -270,7 +270,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 fb5d6d5..09dd91a 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -268,7 +268,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)
@@ -321,10 +321,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)
@@ -405,7 +405,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.
@@ -2735,7 +2735,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
@@ -2753,8 +2753,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))
@@ -2879,9 +2879,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.
@@ -2900,7 +2900,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
@@ -3199,7 +3199,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)
@@ -4246,7 +4246,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
@@ -4267,7 +4267,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 @*.
@@ -4305,7 +4305,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].
@@ -4470,7 +4470,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
@@ -5422,7 +5422,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)
@@ -5477,7 +5477,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
@@ -5492,7 +5492,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
@@ -5546,7 +5546,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
@@ -5738,7 +5738,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.
@@ -5749,7 +5749,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)))
@@ -7547,7 +7547,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)
@@ -7759,19 +7759,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))
@@ -8055,11 +8055,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
@@ -8682,11 +8682,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
@@ -8745,7 +8745,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
@@ -8768,7 +8768,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
@@ -8811,8 +8812,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)))
@@ -8971,7 +8972,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
@@ -9603,10 +9604,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
@@ -10399,7 +10400,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
@@ -10420,11 +10421,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)))
@@ -10680,7 +10681,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
@@ -10717,7 +10718,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))
@@ -10758,9 +10759,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))
@@ -12789,7 +12790,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 5538736..8711d7d 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))