[Pkg-javascript-commits] [node-acorn-jsx] 34/484: Add funky newlines to nonASCIIwhitespace

Bastien Roucariès rouca at moszumanska.debian.org
Sat Aug 19 14:20:00 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-acorn-jsx.

commit e3514627a429053395a98044465cb6c421183657
Author: Marijn Haverbeke <marijnh at gmail.com>
Date:   Wed Oct 17 22:59:34 2012 +0200

    Add funky newlines to nonASCIIwhitespace
---
 acorn.js      |  2 +-
 index.html    |  2 +-
 test/tests.js | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/acorn.js b/acorn.js
index 0799736..552eee7 100644
--- a/acorn.js
+++ b/acorn.js
@@ -345,7 +345,7 @@
   // are only applied when a character is found to actually have a
   // code point above 128.
 
-  var nonASCIIwhitespace = /[\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFEFF]/;
+  var nonASCIIwhitespace = /[\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/;
   var nonASCIIidentifierStartChars = "\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u [...]
   var nonASCIIidentifierChars = "\u0371-\u0374\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u0620-\u0649\u0672-\u06d3\u06e7-\u06e8\u06fb-\u06fc\u0730-\u074a\u0800-\u0814\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0840-\u0857\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09d7\u09df-\u09e0\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a8 [...]
   var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
diff --git a/index.html b/index.html
index 7d30bcb..bba0ab3 100644
--- a/index.html
+++ b/index.html
@@ -194,7 +194,7 @@ switch first dispatches on the lengths, to save on comparisons.</p>
   <span class="p">}</span></pre></div>             </td>           </tr>                               <tr id="section-38">             <td class="docs">               <div class="pilwrap">                 <a class="pilcrow" href="#section-38">¶</a>               </div>               <p>The ECMAScript 3 reserved word list.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="kd">var</span> <span class="nx">isReservedWord3</span [...]
 whitespace, identifier, and identifier-start categories. These
 are only applied when a character is found to actually have a
-code point above 128.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="kd">var</span> <span class="nx">nonASCIIwhitespace</span> <span class="o">=</span> <span class="sr">/[\u1680\u180E\u2000-\u200A\u202F\u205F\u3000\uFEFF]/</span><span class="p">;</span>
+code point above 128.</p>             </td>             <td class="code">               <div class="highlight"><pre>  <span class="kd">var</span> <span class="nx">nonASCIIwhitespace</span> <span class="o">=</span> <span class="sr">/[\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/</span><span class="p">;</span>
   <span class="kd">var</span> <span class="nx">nonASCIIidentifierStartChars</span> <span class="o">=</span> <span class="s2">"\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u0 [...]
   <span class="kd">var</span> <span class="nx">nonASCIIidentifierChars</span> <span class="o">=</span> <span class="s2">"\u0371-\u0374\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u0620-\u0649\u0672-\u06d3\u06e7-\u06e8\u06fb-\u06fc\u0730-\u074a\u0800-\u0814\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0840-\u0857\u08e4-\u08fe\u0900-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962-\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09d7\u09df- [...]
   <span class="kd">var</span> <span class="nx">nonASCIIidentifierStart</span> <span class="o">=</span> <span class="k">new</span> <span class="nb">RegExp</span><span class="p">(</span><span class="s2">"["</span> <span class="o">+</span> <span class="nx">nonASCIIidentifierStartChars</span> <span class="o">+</span> <span class="s2">"]"</span><span class="p">);</span>
diff --git a/test/tests.js b/test/tests.js
index 5ca91c9..d9c4670 100644
--- a/test/tests.js
+++ b/test/tests.js
@@ -26025,6 +26025,36 @@ test("123..toString(10)", {
   ]
 });
 
+test("a\u2028b", {
+  type: "Program",
+  start: 0,
+  end: 3,
+  body: [
+    {
+      type: "ExpressionStatement",
+      start: 0,
+      end: 1,
+      expression: {
+        type: "Identifier",
+        start: 0,
+        end: 1,
+        name: "a"
+      }
+    },
+    {
+      type: "ExpressionStatement",
+      start: 2,
+      end: 3,
+      expression: {
+        type: "Identifier",
+        start: 2,
+        end: 3,
+        name: "b"
+      }
+    }
+  ]
+});
+
 // Failure tests
 
 testFail("{",
@@ -26584,3 +26614,5 @@ testFail("(function a(eval) { \"use strict\"; })",
 
 testFail("(function a(package) { \"use strict\"; })",
          "Defining 'package' in strict mode (1:12)");
+
+testFail("var this = 10;", "Unexpected token (1:4)");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-acorn-jsx.git



More information about the Pkg-javascript-commits mailing list