aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJackson Ray Hamilton2019-04-07 14:36:47 -0700
committerJackson Ray Hamilton2019-04-08 22:48:24 -0700
commit7a9dac5c944432cc2329473bb1dd9db9c0bfdd99 (patch)
treeb331864efe2500c8e73423398fb5197152028802 /test
parent98e36a3e31da10bf230743d285544305f730b60d (diff)
downloademacs-7a9dac5c944432cc2329473bb1dd9db9c0bfdd99.tar.gz
emacs-7a9dac5c944432cc2329473bb1dd9db9c0bfdd99.zip
Improve whitespace and unary keyword parsing
* lisp/progmodes/js.el (js--name-start-chars): Remove, adding these chars back to js--name-start-re. (js--name-start-re): Add chars back from js--name-start-chars. (js-jsx--tag-start-re): Improve regexp to capture the tag name (so it can be disambiguated from a unary keyword), to match newlines (which are common in this spot), and to require at least one whitespace character before the attribute name. (js-jsx--matched-tag-type): Ensure the “tag name” isn’t possibly a unary keyword. (js-jsx--self-closing-re, js-jsx--matching-close-tag-pos): Allow whitespace around “<” and “>”. * test/manual/indent/jsx-unclosed-2.jsx: Add tests for unary keyword and whitespace parsing.
Diffstat (limited to 'test')
-rw-r--r--test/manual/indent/jsx-unclosed-2.jsx16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/manual/indent/jsx-unclosed-2.jsx b/test/manual/indent/jsx-unclosed-2.jsx
index 9d80a2e9ae2..be0a605503f 100644
--- a/test/manual/indent/jsx-unclosed-2.jsx
+++ b/test/manual/indent/jsx-unclosed-2.jsx
@@ -19,6 +19,10 @@ if (foo > bar) void 0
19if (foo < await bar) void 0 19if (foo < await bar) void 0
20while (await foo > bar) void 0 20while (await foo > bar) void 0
21 21
22<div>
23 {foo < await bar}
24</div>
25
22// Allow unary keyword names as null-valued JSX attributes. 26// Allow unary keyword names as null-valued JSX attributes.
23// (As if this will EVER happen…) 27// (As if this will EVER happen…)
24<Foo yield> 28<Foo yield>
@@ -40,3 +44,15 @@ while (await foo > bar) void 0
40// “-” may be used in a JSXAttribute’s name. 44// “-” may be used in a JSXAttribute’s name.
41<Foo a-b-c="" 45<Foo a-b-c=""
42 x-y-z="" /> 46 x-y-z="" />
47
48// Weird spaces should be tolerated.
49< div >
50 < div >
51 < div
52 attr=""
53 / >
54 < div
55 attr=""
56 / >
57 < / div>
58< / div >