MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / run

Method run

xs/tools/unicode/properties.js:43–114  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

41 this.report("};");
42 }
43 run() {
44 let once = true;
45 let tool = this;
46 let categories = [];
47 let category;
48 let property;
49
50 function assert() {
51 }
52 function buildString(symbols) {
53 if (once) {
54 let ranges = [];
55 for (let codePoint of symbols.loneCodePoints) {
56 ranges.push([codePoint, codePoint + 1]);
57 }
58 for (let range of symbols.ranges) {
59 ranges.push([range[0], range[1] + 1]);
60 }
61 ranges.sort((a, b) => a[0] - b[0]);
62 property.ranges = ranges;
63 once = false;
64 }
65 }
66 function testPropertyEscapes(regexp, symbols, string) {
67 if (string[1] == "p") {
68 let aliasName = string.slice(3, -1);
69 const parts = aliasName.split("=");
70 if (parts.length == 2) {
71 aliasName = parts[1];
72 }
73 let alias = category.aliases.find(item => item.name == aliasName);
74 if (!alias)
75 category.aliases.push({ name:aliasName, property });
76 }
77 }
78 const directory = this.resolveDirectoryPath("../../../../test262/test/built-ins/RegExp/property-escapes/generated");
79 const names = this.enumerateDirectory(directory);
80 for (let name of names) {
81 const path = this.joinPath({directory, name});
82 if (this.isDirectoryOrFile(path) != 1)
83 continue;
84 let categoryName = "Binary_Property";
85 let propertyName = name;
86 const parts = name.split("_-_");
87 if (parts.length == 2) {
88 categoryName = parts[0];
89 propertyName = parts[1];
90 }
91 category = categories.find(item => item.name == categoryName);
92 if (!category) {
93 category = { name:categoryName, properties:[], aliases:[] };
94 categories.push(category);
95 }
96 property = { name:propertyName.slice(0, -3) };
97 category.properties.push(property);
98
99 let buffer = this.readFileString(path);
100 buffer = buffer.replaceAll("/^\\p", "'");

Callers

nothing calls this directly

Calls 5

findMethod · 0.80
reportCategorySetsMethod · 0.80
sliceMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected