@opensumi/ide-utils 2.21.13 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/lib/arrays.d.ts +3 -3
  2. package/lib/arrays.d.ts.map +1 -1
  3. package/lib/arrays.js.map +1 -1
  4. package/lib/async.d.ts +3 -3
  5. package/lib/async.d.ts.map +1 -1
  6. package/lib/buffer.js +4 -4
  7. package/lib/buffer.js.map +1 -1
  8. package/lib/character-classifier.js +3 -3
  9. package/lib/character-classifier.js.map +1 -1
  10. package/lib/decorators.d.ts +1 -1
  11. package/lib/decorators.d.ts.map +1 -1
  12. package/lib/encoding.d.ts +7 -1
  13. package/lib/encoding.d.ts.map +1 -1
  14. package/lib/encoding.js +15 -2
  15. package/lib/encoding.js.map +1 -1
  16. package/lib/errors.d.ts +2 -2
  17. package/lib/errors.d.ts.map +1 -1
  18. package/lib/event.d.ts +2 -2
  19. package/lib/event.d.ts.map +1 -1
  20. package/lib/filters.d.ts +3 -3
  21. package/lib/filters.d.ts.map +1 -1
  22. package/lib/filters.js +25 -25
  23. package/lib/filters.js.map +1 -1
  24. package/lib/glob.d.ts +2 -2
  25. package/lib/glob.d.ts.map +1 -1
  26. package/lib/glob.js +1 -1
  27. package/lib/glob.js.map +1 -1
  28. package/lib/hash.js +10 -10
  29. package/lib/hash.js.map +1 -1
  30. package/lib/iterator.d.ts +1 -1
  31. package/lib/iterator.d.ts.map +1 -1
  32. package/lib/linked-text.d.ts +1 -1
  33. package/lib/linked-text.d.ts.map +1 -1
  34. package/lib/linked-text.js.map +1 -1
  35. package/lib/map.js +17 -17
  36. package/lib/map.js.map +1 -1
  37. package/lib/objects.d.ts +1 -0
  38. package/lib/objects.d.ts.map +1 -1
  39. package/lib/objects.js +38 -1
  40. package/lib/objects.js.map +1 -1
  41. package/lib/os.d.ts +1 -8
  42. package/lib/os.d.ts.map +1 -1
  43. package/lib/os.js +4 -8
  44. package/lib/os.js.map +1 -1
  45. package/lib/path.d.ts +1 -1
  46. package/lib/path.d.ts.map +1 -1
  47. package/lib/path.js +29 -29
  48. package/lib/path.js.map +1 -1
  49. package/lib/platform.js +8 -8
  50. package/lib/platform.js.map +1 -1
  51. package/lib/process.d.ts.map +1 -1
  52. package/lib/process.js +28 -13
  53. package/lib/process.js.map +1 -1
  54. package/lib/progress.js +3 -3
  55. package/lib/progress.js.map +1 -1
  56. package/lib/strings.js +9 -9
  57. package/lib/strings.js.map +1 -1
  58. package/lib/types.d.ts +5 -1
  59. package/lib/types.d.ts.map +1 -1
  60. package/lib/types.js +8 -1
  61. package/lib/types.js.map +1 -1
  62. package/lib/uint.js +4 -4
  63. package/lib/uint.js.map +1 -1
  64. package/lib/uri.js +8 -8
  65. package/lib/uri.js.map +1 -1
  66. package/lib/uuid.d.ts +1 -1
  67. package/lib/uuid.d.ts.map +1 -1
  68. package/lib/uuid.js +3 -2
  69. package/lib/uuid.js.map +1 -1
  70. package/package.json +8 -6
  71. package/src/ansi.ts +10 -0
  72. package/src/argv.ts +57 -0
  73. package/src/arrays.ts +328 -0
  74. package/src/async.ts +580 -0
  75. package/src/buffer.ts +290 -0
  76. package/src/cache.ts +37 -0
  77. package/src/cancellation.ts +136 -0
  78. package/src/charCode.ts +425 -0
  79. package/src/character-classifier.ts +82 -0
  80. package/src/const/encoding.ts +242 -0
  81. package/src/const/index.ts +1 -0
  82. package/src/date.ts +36 -0
  83. package/src/decorators.ts +166 -0
  84. package/src/disposable.ts +377 -0
  85. package/src/encoding.ts +278 -0
  86. package/src/errors.ts +192 -0
  87. package/src/event.ts +1024 -0
  88. package/src/file-uri.ts +41 -0
  89. package/src/filters.ts +887 -0
  90. package/src/functional.ts +43 -0
  91. package/src/glob.ts +752 -0
  92. package/src/hash.ts +336 -0
  93. package/src/iconLabels.ts +149 -0
  94. package/src/index.ts +40 -0
  95. package/src/iterator.ts +36 -0
  96. package/src/lifecycle.ts +48 -0
  97. package/src/linked-list.ts +144 -0
  98. package/src/linked-text.ts +55 -0
  99. package/src/lru-map.ts +133 -0
  100. package/src/map.ts +934 -0
  101. package/src/marshalling.ts +62 -0
  102. package/src/objects.ts +145 -0
  103. package/src/os.ts +76 -0
  104. package/src/path.ts +1885 -0
  105. package/src/platform.ts +194 -0
  106. package/src/process.ts +43 -0
  107. package/src/progress.ts +83 -0
  108. package/src/promises.ts +23 -0
  109. package/src/sequence.ts +28 -0
  110. package/src/strings.ts +1002 -0
  111. package/src/types.ts +214 -0
  112. package/src/uint.ts +59 -0
  113. package/src/uri.ts +298 -0
  114. package/src/uuid.ts +6 -0
@@ -0,0 +1,425 @@
1
+ /* ---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/base/common/charCode.ts
6
+
7
+ // Names from https://blog.codinghorror.com/ascii-pronunciation-rules-for-programmers/
8
+
9
+ /**
10
+ * An inlined enum containing useful character codes (to be used with String.charCodeAt).
11
+ * Please leave the const keyword such that it gets inlined when compiled to JavaScript!
12
+ */
13
+ export const enum CharCode {
14
+ Null = 0,
15
+ /**
16
+ * The `\b` character.
17
+ */
18
+ Backspace = 8,
19
+ /**
20
+ * The `\t` character.
21
+ */
22
+ Tab = 9,
23
+ /**
24
+ * The `\n` character.
25
+ */
26
+ LineFeed = 10,
27
+ /**
28
+ * The `\r` character.
29
+ */
30
+ CarriageReturn = 13,
31
+ Space = 32,
32
+ /**
33
+ * The `!` character.
34
+ */
35
+ ExclamationMark = 33,
36
+ /**
37
+ * The `"` character.
38
+ */
39
+ DoubleQuote = 34,
40
+ /**
41
+ * The `#` character.
42
+ */
43
+ Hash = 35,
44
+ /**
45
+ * The `$` character.
46
+ */
47
+ DollarSign = 36,
48
+ /**
49
+ * The `%` character.
50
+ */
51
+ PercentSign = 37,
52
+ /**
53
+ * The `&` character.
54
+ */
55
+ Ampersand = 38,
56
+ /**
57
+ * The `'` character.
58
+ */
59
+ SingleQuote = 39,
60
+ /**
61
+ * The `(` character.
62
+ */
63
+ OpenParen = 40,
64
+ /**
65
+ * The `)` character.
66
+ */
67
+ CloseParen = 41,
68
+ /**
69
+ * The `*` character.
70
+ */
71
+ Asterisk = 42,
72
+ /**
73
+ * The `+` character.
74
+ */
75
+ Plus = 43,
76
+ /**
77
+ * The `,` character.
78
+ */
79
+ Comma = 44,
80
+ /**
81
+ * The `-` character.
82
+ */
83
+ Dash = 45,
84
+ /**
85
+ * The `.` character.
86
+ */
87
+ Period = 46,
88
+ /**
89
+ * The `/` character.
90
+ */
91
+ Slash = 47,
92
+
93
+ Digit0 = 48,
94
+ Digit1 = 49,
95
+ Digit2 = 50,
96
+ Digit3 = 51,
97
+ Digit4 = 52,
98
+ Digit5 = 53,
99
+ Digit6 = 54,
100
+ Digit7 = 55,
101
+ Digit8 = 56,
102
+ Digit9 = 57,
103
+
104
+ /**
105
+ * The `:` character.
106
+ */
107
+ Colon = 58,
108
+ /**
109
+ * The `;` character.
110
+ */
111
+ Semicolon = 59,
112
+ /**
113
+ * The `<` character.
114
+ */
115
+ LessThan = 60,
116
+ /**
117
+ * The `=` character.
118
+ */
119
+ Equals = 61,
120
+ /**
121
+ * The `>` character.
122
+ */
123
+ GreaterThan = 62,
124
+ /**
125
+ * The `?` character.
126
+ */
127
+ QuestionMark = 63,
128
+ /**
129
+ * The `@` character.
130
+ */
131
+ AtSign = 64,
132
+
133
+ A = 65,
134
+ B = 66,
135
+ C = 67,
136
+ D = 68,
137
+ E = 69,
138
+ F = 70,
139
+ G = 71,
140
+ H = 72,
141
+ I = 73,
142
+ J = 74,
143
+ K = 75,
144
+ L = 76,
145
+ M = 77,
146
+ N = 78,
147
+ O = 79,
148
+ P = 80,
149
+ Q = 81,
150
+ R = 82,
151
+ S = 83,
152
+ T = 84,
153
+ U = 85,
154
+ V = 86,
155
+ W = 87,
156
+ X = 88,
157
+ Y = 89,
158
+ Z = 90,
159
+
160
+ /**
161
+ * The `[` character.
162
+ */
163
+ OpenSquareBracket = 91,
164
+ /**
165
+ * The `\` character.
166
+ */
167
+ Backslash = 92,
168
+ /**
169
+ * The `]` character.
170
+ */
171
+ CloseSquareBracket = 93,
172
+ /**
173
+ * The `^` character.
174
+ */
175
+ Caret = 94,
176
+ /**
177
+ * The `_` character.
178
+ */
179
+ Underline = 95,
180
+ /**
181
+ * The ``(`)`` character.
182
+ */
183
+ BackTick = 96,
184
+
185
+ a = 97,
186
+ b = 98,
187
+ c = 99,
188
+ d = 100,
189
+ e = 101,
190
+ f = 102,
191
+ g = 103,
192
+ h = 104,
193
+ i = 105,
194
+ j = 106,
195
+ k = 107,
196
+ l = 108,
197
+ m = 109,
198
+ n = 110,
199
+ o = 111,
200
+ p = 112,
201
+ q = 113,
202
+ r = 114,
203
+ s = 115,
204
+ t = 116,
205
+ u = 117,
206
+ v = 118,
207
+ w = 119,
208
+ x = 120,
209
+ y = 121,
210
+ z = 122,
211
+
212
+ /**
213
+ * The `{` character.
214
+ */
215
+ OpenCurlyBrace = 123,
216
+ /**
217
+ * The `|` character.
218
+ */
219
+ Pipe = 124,
220
+ /**
221
+ * The `}` character.
222
+ */
223
+ CloseCurlyBrace = 125,
224
+ /**
225
+ * The `~` character.
226
+ */
227
+ Tilde = 126,
228
+
229
+ U_Combining_Grave_Accent = 0x0300, // U+0300 Combining Grave Accent
230
+ U_Combining_Acute_Accent = 0x0301, // U+0301 Combining Acute Accent
231
+ U_Combining_Circumflex_Accent = 0x0302, // U+0302 Combining Circumflex Accent
232
+ U_Combining_Tilde = 0x0303, // U+0303 Combining Tilde
233
+ U_Combining_Macron = 0x0304, // U+0304 Combining Macron
234
+ U_Combining_Overline = 0x0305, // U+0305 Combining Overline
235
+ U_Combining_Breve = 0x0306, // U+0306 Combining Breve
236
+ U_Combining_Dot_Above = 0x0307, // U+0307 Combining Dot Above
237
+ U_Combining_Diaeresis = 0x0308, // U+0308 Combining Diaeresis
238
+ U_Combining_Hook_Above = 0x0309, // U+0309 Combining Hook Above
239
+ U_Combining_Ring_Above = 0x030a, // U+030A Combining Ring Above
240
+ U_Combining_Double_Acute_Accent = 0x030b, // U+030B Combining Double Acute Accent
241
+ U_Combining_Caron = 0x030c, // U+030C Combining Caron
242
+ U_Combining_Vertical_Line_Above = 0x030d, // U+030D Combining Vertical Line Above
243
+ U_Combining_Double_Vertical_Line_Above = 0x030e, // U+030E Combining Double Vertical Line Above
244
+ U_Combining_Double_Grave_Accent = 0x030f, // U+030F Combining Double Grave Accent
245
+ U_Combining_Candrabindu = 0x0310, // U+0310 Combining Candrabindu
246
+ U_Combining_Inverted_Breve = 0x0311, // U+0311 Combining Inverted Breve
247
+ U_Combining_Turned_Comma_Above = 0x0312, // U+0312 Combining Turned Comma Above
248
+ U_Combining_Comma_Above = 0x0313, // U+0313 Combining Comma Above
249
+ U_Combining_Reversed_Comma_Above = 0x0314, // U+0314 Combining Reversed Comma Above
250
+ U_Combining_Comma_Above_Right = 0x0315, // U+0315 Combining Comma Above Right
251
+ U_Combining_Grave_Accent_Below = 0x0316, // U+0316 Combining Grave Accent Below
252
+ U_Combining_Acute_Accent_Below = 0x0317, // U+0317 Combining Acute Accent Below
253
+ U_Combining_Left_Tack_Below = 0x0318, // U+0318 Combining Left Tack Below
254
+ U_Combining_Right_Tack_Below = 0x0319, // U+0319 Combining Right Tack Below
255
+ U_Combining_Left_Angle_Above = 0x031a, // U+031A Combining Left Angle Above
256
+ U_Combining_Horn = 0x031b, // U+031B Combining Horn
257
+ U_Combining_Left_Half_Ring_Below = 0x031c, // U+031C Combining Left Half Ring Below
258
+ U_Combining_Up_Tack_Below = 0x031d, // U+031D Combining Up Tack Below
259
+ U_Combining_Down_Tack_Below = 0x031e, // U+031E Combining Down Tack Below
260
+ U_Combining_Plus_Sign_Below = 0x031f, // U+031F Combining Plus Sign Below
261
+ U_Combining_Minus_Sign_Below = 0x0320, // U+0320 Combining Minus Sign Below
262
+ U_Combining_Palatalized_Hook_Below = 0x0321, // U+0321 Combining Palatalized Hook Below
263
+ U_Combining_Retroflex_Hook_Below = 0x0322, // U+0322 Combining Retroflex Hook Below
264
+ U_Combining_Dot_Below = 0x0323, // U+0323 Combining Dot Below
265
+ U_Combining_Diaeresis_Below = 0x0324, // U+0324 Combining Diaeresis Below
266
+ U_Combining_Ring_Below = 0x0325, // U+0325 Combining Ring Below
267
+ U_Combining_Comma_Below = 0x0326, // U+0326 Combining Comma Below
268
+ U_Combining_Cedilla = 0x0327, // U+0327 Combining Cedilla
269
+ U_Combining_Ogonek = 0x0328, // U+0328 Combining Ogonek
270
+ U_Combining_Vertical_Line_Below = 0x0329, // U+0329 Combining Vertical Line Below
271
+ U_Combining_Bridge_Below = 0x032a, // U+032A Combining Bridge Below
272
+ U_Combining_Inverted_Double_Arch_Below = 0x032b, // U+032B Combining Inverted Double Arch Below
273
+ U_Combining_Caron_Below = 0x032c, // U+032C Combining Caron Below
274
+ U_Combining_Circumflex_Accent_Below = 0x032d, // U+032D Combining Circumflex Accent Below
275
+ U_Combining_Breve_Below = 0x032e, // U+032E Combining Breve Below
276
+ U_Combining_Inverted_Breve_Below = 0x032f, // U+032F Combining Inverted Breve Below
277
+ U_Combining_Tilde_Below = 0x0330, // U+0330 Combining Tilde Below
278
+ U_Combining_Macron_Below = 0x0331, // U+0331 Combining Macron Below
279
+ U_Combining_Low_Line = 0x0332, // U+0332 Combining Low Line
280
+ U_Combining_Double_Low_Line = 0x0333, // U+0333 Combining Double Low Line
281
+ U_Combining_Tilde_Overlay = 0x0334, // U+0334 Combining Tilde Overlay
282
+ U_Combining_Short_Stroke_Overlay = 0x0335, // U+0335 Combining Short Stroke Overlay
283
+ U_Combining_Long_Stroke_Overlay = 0x0336, // U+0336 Combining Long Stroke Overlay
284
+ U_Combining_Short_Solidus_Overlay = 0x0337, // U+0337 Combining Short Solidus Overlay
285
+ U_Combining_Long_Solidus_Overlay = 0x0338, // U+0338 Combining Long Solidus Overlay
286
+ U_Combining_Right_Half_Ring_Below = 0x0339, // U+0339 Combining Right Half Ring Below
287
+ U_Combining_Inverted_Bridge_Below = 0x033a, // U+033A Combining Inverted Bridge Below
288
+ U_Combining_Square_Below = 0x033b, // U+033B Combining Square Below
289
+ U_Combining_Seagull_Below = 0x033c, // U+033C Combining Seagull Below
290
+ U_Combining_X_Above = 0x033d, // U+033D Combining X Above
291
+ U_Combining_Vertical_Tilde = 0x033e, // U+033E Combining Vertical Tilde
292
+ U_Combining_Double_Overline = 0x033f, // U+033F Combining Double Overline
293
+ U_Combining_Grave_Tone_Mark = 0x0340, // U+0340 Combining Grave Tone Mark
294
+ U_Combining_Acute_Tone_Mark = 0x0341, // U+0341 Combining Acute Tone Mark
295
+ U_Combining_Greek_Perispomeni = 0x0342, // U+0342 Combining Greek Perispomeni
296
+ U_Combining_Greek_Koronis = 0x0343, // U+0343 Combining Greek Koronis
297
+ U_Combining_Greek_Dialytika_Tonos = 0x0344, // U+0344 Combining Greek Dialytika Tonos
298
+ U_Combining_Greek_Ypogegrammeni = 0x0345, // U+0345 Combining Greek Ypogegrammeni
299
+ U_Combining_Bridge_Above = 0x0346, // U+0346 Combining Bridge Above
300
+ U_Combining_Equals_Sign_Below = 0x0347, // U+0347 Combining Equals Sign Below
301
+ U_Combining_Double_Vertical_Line_Below = 0x0348, // U+0348 Combining Double Vertical Line Below
302
+ U_Combining_Left_Angle_Below = 0x0349, // U+0349 Combining Left Angle Below
303
+ U_Combining_Not_Tilde_Above = 0x034a, // U+034A Combining Not Tilde Above
304
+ U_Combining_Homothetic_Above = 0x034b, // U+034B Combining Homothetic Above
305
+ U_Combining_Almost_Equal_To_Above = 0x034c, // U+034C Combining Almost Equal To Above
306
+ U_Combining_Left_Right_Arrow_Below = 0x034d, // U+034D Combining Left Right Arrow Below
307
+ U_Combining_Upwards_Arrow_Below = 0x034e, // U+034E Combining Upwards Arrow Below
308
+ U_Combining_Grapheme_Joiner = 0x034f, // U+034F Combining Grapheme Joiner
309
+ U_Combining_Right_Arrowhead_Above = 0x0350, // U+0350 Combining Right Arrowhead Above
310
+ U_Combining_Left_Half_Ring_Above = 0x0351, // U+0351 Combining Left Half Ring Above
311
+ U_Combining_Fermata = 0x0352, // U+0352 Combining Fermata
312
+ U_Combining_X_Below = 0x0353, // U+0353 Combining X Below
313
+ U_Combining_Left_Arrowhead_Below = 0x0354, // U+0354 Combining Left Arrowhead Below
314
+ U_Combining_Right_Arrowhead_Below = 0x0355, // U+0355 Combining Right Arrowhead Below
315
+ U_Combining_Right_Arrowhead_And_Up_Arrowhead_Below = 0x0356, // U+0356 Combining Right Arrowhead And Up Arrowhead Below
316
+ U_Combining_Right_Half_Ring_Above = 0x0357, // U+0357 Combining Right Half Ring Above
317
+ U_Combining_Dot_Above_Right = 0x0358, // U+0358 Combining Dot Above Right
318
+ U_Combining_Asterisk_Below = 0x0359, // U+0359 Combining Asterisk Below
319
+ U_Combining_Double_Ring_Below = 0x035a, // U+035A Combining Double Ring Below
320
+ U_Combining_Zigzag_Above = 0x035b, // U+035B Combining Zigzag Above
321
+ U_Combining_Double_Breve_Below = 0x035c, // U+035C Combining Double Breve Below
322
+ U_Combining_Double_Breve = 0x035d, // U+035D Combining Double Breve
323
+ U_Combining_Double_Macron = 0x035e, // U+035E Combining Double Macron
324
+ U_Combining_Double_Macron_Below = 0x035f, // U+035F Combining Double Macron Below
325
+ U_Combining_Double_Tilde = 0x0360, // U+0360 Combining Double Tilde
326
+ U_Combining_Double_Inverted_Breve = 0x0361, // U+0361 Combining Double Inverted Breve
327
+ U_Combining_Double_Rightwards_Arrow_Below = 0x0362, // U+0362 Combining Double Rightwards Arrow Below
328
+ U_Combining_Latin_Small_Letter_A = 0x0363, // U+0363 Combining Latin Small Letter A
329
+ U_Combining_Latin_Small_Letter_E = 0x0364, // U+0364 Combining Latin Small Letter E
330
+ U_Combining_Latin_Small_Letter_I = 0x0365, // U+0365 Combining Latin Small Letter I
331
+ U_Combining_Latin_Small_Letter_O = 0x0366, // U+0366 Combining Latin Small Letter O
332
+ U_Combining_Latin_Small_Letter_U = 0x0367, // U+0367 Combining Latin Small Letter U
333
+ U_Combining_Latin_Small_Letter_C = 0x0368, // U+0368 Combining Latin Small Letter C
334
+ U_Combining_Latin_Small_Letter_D = 0x0369, // U+0369 Combining Latin Small Letter D
335
+ U_Combining_Latin_Small_Letter_H = 0x036a, // U+036A Combining Latin Small Letter H
336
+ U_Combining_Latin_Small_Letter_M = 0x036b, // U+036B Combining Latin Small Letter M
337
+ U_Combining_Latin_Small_Letter_R = 0x036c, // U+036C Combining Latin Small Letter R
338
+ U_Combining_Latin_Small_Letter_T = 0x036d, // U+036D Combining Latin Small Letter T
339
+ U_Combining_Latin_Small_Letter_V = 0x036e, // U+036E Combining Latin Small Letter V
340
+ U_Combining_Latin_Small_Letter_X = 0x036f, // U+036F Combining Latin Small Letter X
341
+
342
+ /**
343
+ * Unicode Character 'LINE SEPARATOR' (U+2028)
344
+ * http://www.fileformat.info/info/unicode/char/2028/index.htm
345
+ */
346
+ LINE_SEPARATOR_2028 = 8232,
347
+
348
+ // http://www.fileformat.info/info/unicode/category/Sk/list.htm
349
+ U_CIRCUMFLEX = 0x005e, // U+005E CIRCUMFLEX
350
+ U_GRAVE_ACCENT = 0x0060, // U+0060 GRAVE ACCENT
351
+ U_DIAERESIS = 0x00a8, // U+00A8 DIAERESIS
352
+ U_MACRON = 0x00af, // U+00AF MACRON
353
+ U_ACUTE_ACCENT = 0x00b4, // U+00B4 ACUTE ACCENT
354
+ U_CEDILLA = 0x00b8, // U+00B8 CEDILLA
355
+ U_MODIFIER_LETTER_LEFT_ARROWHEAD = 0x02c2, // U+02C2 MODIFIER LETTER LEFT ARROWHEAD
356
+ U_MODIFIER_LETTER_RIGHT_ARROWHEAD = 0x02c3, // U+02C3 MODIFIER LETTER RIGHT ARROWHEAD
357
+ U_MODIFIER_LETTER_UP_ARROWHEAD = 0x02c4, // U+02C4 MODIFIER LETTER UP ARROWHEAD
358
+ U_MODIFIER_LETTER_DOWN_ARROWHEAD = 0x02c5, // U+02C5 MODIFIER LETTER DOWN ARROWHEAD
359
+ U_MODIFIER_LETTER_CENTRED_RIGHT_HALF_RING = 0x02d2, // U+02D2 MODIFIER LETTER CENTRED RIGHT HALF RING
360
+ U_MODIFIER_LETTER_CENTRED_LEFT_HALF_RING = 0x02d3, // U+02D3 MODIFIER LETTER CENTRED LEFT HALF RING
361
+ U_MODIFIER_LETTER_UP_TACK = 0x02d4, // U+02D4 MODIFIER LETTER UP TACK
362
+ U_MODIFIER_LETTER_DOWN_TACK = 0x02d5, // U+02D5 MODIFIER LETTER DOWN TACK
363
+ U_MODIFIER_LETTER_PLUS_SIGN = 0x02d6, // U+02D6 MODIFIER LETTER PLUS SIGN
364
+ U_MODIFIER_LETTER_MINUS_SIGN = 0x02d7, // U+02D7 MODIFIER LETTER MINUS SIGN
365
+ U_BREVE = 0x02d8, // U+02D8 BREVE
366
+ U_DOT_ABOVE = 0x02d9, // U+02D9 DOT ABOVE
367
+ U_RING_ABOVE = 0x02da, // U+02DA RING ABOVE
368
+ U_OGONEK = 0x02db, // U+02DB OGONEK
369
+ U_SMALL_TILDE = 0x02dc, // U+02DC SMALL TILDE
370
+ U_DOUBLE_ACUTE_ACCENT = 0x02dd, // U+02DD DOUBLE ACUTE ACCENT
371
+ U_MODIFIER_LETTER_RHOTIC_HOOK = 0x02de, // U+02DE MODIFIER LETTER RHOTIC HOOK
372
+ U_MODIFIER_LETTER_CROSS_ACCENT = 0x02df, // U+02DF MODIFIER LETTER CROSS ACCENT
373
+ U_MODIFIER_LETTER_EXTRA_HIGH_TONE_BAR = 0x02e5, // U+02E5 MODIFIER LETTER EXTRA-HIGH TONE BAR
374
+ U_MODIFIER_LETTER_HIGH_TONE_BAR = 0x02e6, // U+02E6 MODIFIER LETTER HIGH TONE BAR
375
+ U_MODIFIER_LETTER_MID_TONE_BAR = 0x02e7, // U+02E7 MODIFIER LETTER MID TONE BAR
376
+ U_MODIFIER_LETTER_LOW_TONE_BAR = 0x02e8, // U+02E8 MODIFIER LETTER LOW TONE BAR
377
+ U_MODIFIER_LETTER_EXTRA_LOW_TONE_BAR = 0x02e9, // U+02E9 MODIFIER LETTER EXTRA-LOW TONE BAR
378
+ U_MODIFIER_LETTER_YIN_DEPARTING_TONE_MARK = 0x02ea, // U+02EA MODIFIER LETTER YIN DEPARTING TONE MARK
379
+ U_MODIFIER_LETTER_YANG_DEPARTING_TONE_MARK = 0x02eb, // U+02EB MODIFIER LETTER YANG DEPARTING TONE MARK
380
+ U_MODIFIER_LETTER_UNASPIRATED = 0x02ed, // U+02ED MODIFIER LETTER UNASPIRATED
381
+ U_MODIFIER_LETTER_LOW_DOWN_ARROWHEAD = 0x02ef, // U+02EF MODIFIER LETTER LOW DOWN ARROWHEAD
382
+ U_MODIFIER_LETTER_LOW_UP_ARROWHEAD = 0x02f0, // U+02F0 MODIFIER LETTER LOW UP ARROWHEAD
383
+ U_MODIFIER_LETTER_LOW_LEFT_ARROWHEAD = 0x02f1, // U+02F1 MODIFIER LETTER LOW LEFT ARROWHEAD
384
+ U_MODIFIER_LETTER_LOW_RIGHT_ARROWHEAD = 0x02f2, // U+02F2 MODIFIER LETTER LOW RIGHT ARROWHEAD
385
+ U_MODIFIER_LETTER_LOW_RING = 0x02f3, // U+02F3 MODIFIER LETTER LOW RING
386
+ U_MODIFIER_LETTER_MIDDLE_GRAVE_ACCENT = 0x02f4, // U+02F4 MODIFIER LETTER MIDDLE GRAVE ACCENT
387
+ U_MODIFIER_LETTER_MIDDLE_DOUBLE_GRAVE_ACCENT = 0x02f5, // U+02F5 MODIFIER LETTER MIDDLE DOUBLE GRAVE ACCENT
388
+ U_MODIFIER_LETTER_MIDDLE_DOUBLE_ACUTE_ACCENT = 0x02f6, // U+02F6 MODIFIER LETTER MIDDLE DOUBLE ACUTE ACCENT
389
+ U_MODIFIER_LETTER_LOW_TILDE = 0x02f7, // U+02F7 MODIFIER LETTER LOW TILDE
390
+ U_MODIFIER_LETTER_RAISED_COLON = 0x02f8, // U+02F8 MODIFIER LETTER RAISED COLON
391
+ U_MODIFIER_LETTER_BEGIN_HIGH_TONE = 0x02f9, // U+02F9 MODIFIER LETTER BEGIN HIGH TONE
392
+ U_MODIFIER_LETTER_END_HIGH_TONE = 0x02fa, // U+02FA MODIFIER LETTER END HIGH TONE
393
+ U_MODIFIER_LETTER_BEGIN_LOW_TONE = 0x02fb, // U+02FB MODIFIER LETTER BEGIN LOW TONE
394
+ U_MODIFIER_LETTER_END_LOW_TONE = 0x02fc, // U+02FC MODIFIER LETTER END LOW TONE
395
+ U_MODIFIER_LETTER_SHELF = 0x02fd, // U+02FD MODIFIER LETTER SHELF
396
+ U_MODIFIER_LETTER_OPEN_SHELF = 0x02fe, // U+02FE MODIFIER LETTER OPEN SHELF
397
+ U_MODIFIER_LETTER_LOW_LEFT_ARROW = 0x02ff, // U+02FF MODIFIER LETTER LOW LEFT ARROW
398
+ U_GREEK_LOWER_NUMERAL_SIGN = 0x0375, // U+0375 GREEK LOWER NUMERAL SIGN
399
+ U_GREEK_TONOS = 0x0384, // U+0384 GREEK TONOS
400
+ U_GREEK_DIALYTIKA_TONOS = 0x0385, // U+0385 GREEK DIALYTIKA TONOS
401
+ U_GREEK_KORONIS = 0x1fbd, // U+1FBD GREEK KORONIS
402
+ U_GREEK_PSILI = 0x1fbf, // U+1FBF GREEK PSILI
403
+ U_GREEK_PERISPOMENI = 0x1fc0, // U+1FC0 GREEK PERISPOMENI
404
+ U_GREEK_DIALYTIKA_AND_PERISPOMENI = 0x1fc1, // U+1FC1 GREEK DIALYTIKA AND PERISPOMENI
405
+ U_GREEK_PSILI_AND_VARIA = 0x1fcd, // U+1FCD GREEK PSILI AND VARIA
406
+ U_GREEK_PSILI_AND_OXIA = 0x1fce, // U+1FCE GREEK PSILI AND OXIA
407
+ U_GREEK_PSILI_AND_PERISPOMENI = 0x1fcf, // U+1FCF GREEK PSILI AND PERISPOMENI
408
+ U_GREEK_DASIA_AND_VARIA = 0x1fdd, // U+1FDD GREEK DASIA AND VARIA
409
+ U_GREEK_DASIA_AND_OXIA = 0x1fde, // U+1FDE GREEK DASIA AND OXIA
410
+ U_GREEK_DASIA_AND_PERISPOMENI = 0x1fdf, // U+1FDF GREEK DASIA AND PERISPOMENI
411
+ U_GREEK_DIALYTIKA_AND_VARIA = 0x1fed, // U+1FED GREEK DIALYTIKA AND VARIA
412
+ U_GREEK_DIALYTIKA_AND_OXIA = 0x1fee, // U+1FEE GREEK DIALYTIKA AND OXIA
413
+ U_GREEK_VARIA = 0x1fef, // U+1FEF GREEK VARIA
414
+ U_GREEK_OXIA = 0x1ffd, // U+1FFD GREEK OXIA
415
+ U_GREEK_DASIA = 0x1ffe, // U+1FFE GREEK DASIA
416
+
417
+ U_OVERLINE = 0x203e, // Unicode Character 'OVERLINE'
418
+
419
+ /**
420
+ * UTF-8 BOM
421
+ * Unicode Character 'ZERO WIDTH NO-BREAK SPACE' (U+FEFF)
422
+ * http://www.fileformat.info/info/unicode/char/feff/index.htm
423
+ */
424
+ UTF8_BOM = 65279,
425
+ }
@@ -0,0 +1,82 @@
1
+ /* ---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ // Some code copied and modified from https://github.com/microsoft/vscode/blob/1.44.0/src/vs/editor/common/core/characterClassifier.ts
6
+
7
+ import { toUint8 } from './uint';
8
+
9
+ /**
10
+ * A fast character classifier that uses a compact array for ASCII values.
11
+ */
12
+ export class CharacterClassifier<T extends number> {
13
+ /**
14
+ * Maintain a compact (fully initialized ASCII map for quickly classifying ASCII characters - used more often in code).
15
+ */
16
+ protected _asciiMap: Uint8Array;
17
+
18
+ /**
19
+ * The entire map (sparse array).
20
+ */
21
+ protected _map: Map<number, number>;
22
+
23
+ protected _defaultValue: number;
24
+
25
+ constructor(_defaultValue: T) {
26
+ const defaultValue = toUint8(_defaultValue);
27
+
28
+ this._defaultValue = defaultValue;
29
+ this._asciiMap = CharacterClassifier._createAsciiMap(defaultValue);
30
+ this._map = new Map<number, number>();
31
+ }
32
+
33
+ private static _createAsciiMap(defaultValue: number): Uint8Array {
34
+ const asciiMap: Uint8Array = new Uint8Array(256);
35
+ for (let i = 0; i < 256; i++) {
36
+ asciiMap[i] = defaultValue;
37
+ }
38
+ return asciiMap;
39
+ }
40
+
41
+ public set(charCode: number, _value: T): void {
42
+ const value = toUint8(_value);
43
+
44
+ if (charCode >= 0 && charCode < 256) {
45
+ this._asciiMap[charCode] = value;
46
+ } else {
47
+ this._map.set(charCode, value);
48
+ }
49
+ }
50
+
51
+ public get(charCode: number): T {
52
+ if (charCode >= 0 && charCode < 256) {
53
+ return this._asciiMap[charCode] as T;
54
+ } else {
55
+ return (this._map.get(charCode) || this._defaultValue) as T;
56
+ }
57
+ }
58
+ }
59
+
60
+ const enum EBoolean {
61
+ False = 0,
62
+ True = 1,
63
+ }
64
+
65
+ export class CharacterSet {
66
+ // "Boolean" is not that "Boolean" primitive type in TypeScript.
67
+ // eslint-disable-next-line @typescript-eslint/ban-types
68
+ private readonly _actual: CharacterClassifier<EBoolean>;
69
+
70
+ constructor() {
71
+ // eslint-disable-next-line @typescript-eslint/ban-types
72
+ this._actual = new CharacterClassifier<EBoolean>(EBoolean.False);
73
+ }
74
+
75
+ public add(charCode: number): void {
76
+ this._actual.set(charCode, EBoolean.True);
77
+ }
78
+
79
+ public has(charCode: number): boolean {
80
+ return this._actual.get(charCode) === EBoolean.True;
81
+ }
82
+ }