File: regenerate-unicode-data.patch

package info (click to toggle)
node-regjsparser 0.12.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 488 kB
  • sloc: javascript: 1,196; makefile: 9
file content (49 lines) | stat: -rw-r--r-- 1,422 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Description: regenerate unicode data
Author: Yadd <yadd@debian.org>
Forwarded: no
Last-Update: 2022-09-01

--- a/package.json
+++ b/package.json
@@ -27,6 +27,7 @@
     "LICENSE.BSD",
     "parser.js",
     "parser.d.ts",
+    "unicode-data.js",
     "README.md"
   ],
   "dependencies": {
--- a/parser.js
+++ b/parser.js
@@ -229,6 +229,8 @@
 "use strict";
 (function() {
 
+  const unicodeData = require("./unicode-data.js");
+
   var fromCodePoint = String.fromCodePoint || (function() {
     // Implementation taken from
     // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/fromCodePoint
--- a/tools/generate-identifier-regex.js
+++ b/tools/generate-identifier-regex.js
@@ -34,13 +34,16 @@
 };
 
 var result = generateRegex();
+
+console.log('module.exports = {');
 console.log(
-  '// ECMAScript (Unicode v%s) NonAsciiIdentifierStart:\n\n%s\n',
+  '// ECMAScript (Unicode v%s) NonAsciiIdentifierStart:\n\n  "NonAsciiIdentifierStart": /%s/,\n',
   version,
-  result.NonAsciiIdentifierStart
+  result.NonAsciiIdentifierStart.replace(/^\[/, '[\\$A-Z_a-z')
 );
 console.log(
-  '// ECMAScript (Unicode v%s) NonAsciiIdentifierPartOnly:\n\n%s',
+  '// ECMAScript (Unicode v%s) NonAsciiIdentifierPartOnly:\n\n  "NonAsciiIdentifierPartOnly": /%s/,',
   version,
-  result.NonAsciiIdentifierPartOnly
+  result.NonAsciiIdentifierPartOnly.replace(/^\[/, '[0-9_')
 );
+console.log('}');