@getpaseo/highlight 0.4.0 → 0.5.0-beta.2
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.
- package/dist/csharp/highlight.d.ts +2 -0
- package/dist/csharp/highlight.js +22 -0
- package/dist/csharp/language.d.ts +3 -0
- package/dist/csharp/language.js +21 -0
- package/dist/csharp/parser.d.ts +3 -0
- package/dist/csharp/parser.js +150 -0
- package/dist/csharp/terms.d.ts +7 -0
- package/dist/csharp/terms.js +12 -0
- package/dist/csharp/tokens.d.ts +4 -0
- package/dist/csharp/tokens.js +73 -0
- package/dist/nix/highlight.d.ts +2 -0
- package/dist/nix/highlight.js +21 -0
- package/dist/nix/language.d.ts +3 -0
- package/dist/nix/language.js +32 -0
- package/dist/nix/parser.d.ts +3 -0
- package/dist/nix/parser.js +45 -0
- package/dist/nix/terms.d.ts +9 -0
- package/dist/nix/terms.js +14 -0
- package/dist/nix/tokens.d.ts +4 -0
- package/dist/nix/tokens.js +70 -0
- package/dist/parsers.js +8 -1
- package/dist/svelte/highlight.d.ts +2 -0
- package/dist/svelte/highlight.js +54 -0
- package/dist/svelte/nesting.d.ts +9 -0
- package/dist/svelte/nesting.js +97 -0
- package/dist/svelte/parser.d.ts +3 -0
- package/dist/svelte/parser.js +204 -0
- package/dist/svelte/terms.d.ts +24 -0
- package/dist/svelte/terms.js +24 -0
- package/dist/svelte/tokens.d.ts +16 -0
- package/dist/svelte/tokens.js +509 -0
- package/package.json +2 -2
|
@@ -0,0 +1,509 @@
|
|
|
1
|
+
import { ContextTracker, ExternalTokenizer } from "@lezer/lr";
|
|
2
|
+
import { commentContent$1, Element, IncompleteCloseTag, LongExpression, MismatchedStartCloseTag, missingCloseTag, OpenTag, scriptText, ShortExpression, StartCloseScriptTag, StartCloseStyleTag, StartCloseTag, StartCloseTextareaTag, StartScriptTag, StartSelfClosingTag, StartStyleTag, StartTag, StartTextareaTag, styleText, textareaText, } from "./terms.js";
|
|
3
|
+
const selfClosers = {
|
|
4
|
+
area: true,
|
|
5
|
+
base: true,
|
|
6
|
+
br: true,
|
|
7
|
+
col: true,
|
|
8
|
+
command: true,
|
|
9
|
+
embed: true,
|
|
10
|
+
frame: true,
|
|
11
|
+
hr: true,
|
|
12
|
+
img: true,
|
|
13
|
+
input: true,
|
|
14
|
+
keygen: true,
|
|
15
|
+
link: true,
|
|
16
|
+
meta: true,
|
|
17
|
+
param: true,
|
|
18
|
+
source: true,
|
|
19
|
+
track: true,
|
|
20
|
+
wbr: true,
|
|
21
|
+
menuitem: true,
|
|
22
|
+
};
|
|
23
|
+
const implicitlyClosed = {
|
|
24
|
+
dd: true,
|
|
25
|
+
li: true,
|
|
26
|
+
optgroup: true,
|
|
27
|
+
option: true,
|
|
28
|
+
p: true,
|
|
29
|
+
rp: true,
|
|
30
|
+
rt: true,
|
|
31
|
+
tbody: true,
|
|
32
|
+
td: true,
|
|
33
|
+
tfoot: true,
|
|
34
|
+
th: true,
|
|
35
|
+
tr: true,
|
|
36
|
+
};
|
|
37
|
+
const closeOnOpen = {
|
|
38
|
+
dd: { dd: true, dt: true },
|
|
39
|
+
dt: { dd: true, dt: true },
|
|
40
|
+
li: { li: true },
|
|
41
|
+
option: { option: true, optgroup: true },
|
|
42
|
+
optgroup: { optgroup: true },
|
|
43
|
+
p: {
|
|
44
|
+
address: true,
|
|
45
|
+
article: true,
|
|
46
|
+
aside: true,
|
|
47
|
+
blockquote: true,
|
|
48
|
+
dir: true,
|
|
49
|
+
div: true,
|
|
50
|
+
dl: true,
|
|
51
|
+
fieldset: true,
|
|
52
|
+
footer: true,
|
|
53
|
+
form: true,
|
|
54
|
+
h1: true,
|
|
55
|
+
h2: true,
|
|
56
|
+
h3: true,
|
|
57
|
+
h4: true,
|
|
58
|
+
h5: true,
|
|
59
|
+
h6: true,
|
|
60
|
+
header: true,
|
|
61
|
+
hgroup: true,
|
|
62
|
+
hr: true,
|
|
63
|
+
menu: true,
|
|
64
|
+
nav: true,
|
|
65
|
+
ol: true,
|
|
66
|
+
p: true,
|
|
67
|
+
pre: true,
|
|
68
|
+
section: true,
|
|
69
|
+
table: true,
|
|
70
|
+
ul: true,
|
|
71
|
+
},
|
|
72
|
+
rp: { rp: true, rt: true },
|
|
73
|
+
rt: { rp: true, rt: true },
|
|
74
|
+
tbody: { tbody: true, tfoot: true },
|
|
75
|
+
td: { td: true, th: true },
|
|
76
|
+
tfoot: { tbody: true },
|
|
77
|
+
th: { td: true, th: true },
|
|
78
|
+
thead: { tbody: true, tfoot: true },
|
|
79
|
+
tr: { tr: true },
|
|
80
|
+
};
|
|
81
|
+
function nameChar(ch) {
|
|
82
|
+
return (ch === 45 ||
|
|
83
|
+
ch === 46 ||
|
|
84
|
+
ch === 58 ||
|
|
85
|
+
(ch >= 65 && ch <= 90) ||
|
|
86
|
+
ch === 95 ||
|
|
87
|
+
(ch >= 97 && ch <= 122) ||
|
|
88
|
+
ch >= 161);
|
|
89
|
+
}
|
|
90
|
+
function isSpace(ch) {
|
|
91
|
+
return ch === 9 || ch === 10 || ch === 13 || ch === 32;
|
|
92
|
+
}
|
|
93
|
+
const lessThan = 60;
|
|
94
|
+
const greaterThan$1 = 62;
|
|
95
|
+
const slash$1 = 47;
|
|
96
|
+
const question = 63;
|
|
97
|
+
const bang = 33;
|
|
98
|
+
let cachedName = null;
|
|
99
|
+
let cachedInput = null;
|
|
100
|
+
let cachedPos = 0;
|
|
101
|
+
function tagNameAfter(input, offset) {
|
|
102
|
+
const pos = input.pos + offset;
|
|
103
|
+
if (cachedPos === pos && cachedInput === input)
|
|
104
|
+
return cachedName;
|
|
105
|
+
let next = input.peek(offset);
|
|
106
|
+
let curOffset = offset;
|
|
107
|
+
while (isSpace(next)) {
|
|
108
|
+
curOffset++;
|
|
109
|
+
next = input.peek(curOffset);
|
|
110
|
+
}
|
|
111
|
+
let name = "";
|
|
112
|
+
for (;;) {
|
|
113
|
+
if (!nameChar(next))
|
|
114
|
+
break;
|
|
115
|
+
name += String.fromCharCode(next);
|
|
116
|
+
curOffset++;
|
|
117
|
+
next = input.peek(curOffset);
|
|
118
|
+
}
|
|
119
|
+
cachedInput = input;
|
|
120
|
+
cachedPos = pos;
|
|
121
|
+
let result;
|
|
122
|
+
if (name) {
|
|
123
|
+
result = name.toLowerCase();
|
|
124
|
+
}
|
|
125
|
+
else if (next === question || next === bang) {
|
|
126
|
+
result = undefined;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
result = null;
|
|
130
|
+
}
|
|
131
|
+
cachedName = result;
|
|
132
|
+
return result;
|
|
133
|
+
}
|
|
134
|
+
export class ElementContext {
|
|
135
|
+
constructor(name, parent) {
|
|
136
|
+
this.name = name;
|
|
137
|
+
this.parent = parent;
|
|
138
|
+
this.hash = parent ? parent.hash : 0;
|
|
139
|
+
for (let i = 0; i < name.length; i++) {
|
|
140
|
+
this.hash += (this.hash << 4) + name.charCodeAt(i) + (name.charCodeAt(i) << 8);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const startTagTerms = new Set([
|
|
145
|
+
StartTag,
|
|
146
|
+
StartSelfClosingTag,
|
|
147
|
+
StartScriptTag,
|
|
148
|
+
StartStyleTag,
|
|
149
|
+
StartTextareaTag,
|
|
150
|
+
]);
|
|
151
|
+
export const elementContext = new ContextTracker({
|
|
152
|
+
start: null,
|
|
153
|
+
shift(context, term, _stack, input) {
|
|
154
|
+
return startTagTerms.has(term)
|
|
155
|
+
? new ElementContext(tagNameAfter(input, 1) || "", context)
|
|
156
|
+
: context;
|
|
157
|
+
},
|
|
158
|
+
reduce(context, term) {
|
|
159
|
+
return term === Element && context ? context.parent : context;
|
|
160
|
+
},
|
|
161
|
+
reuse(context, node, _stack, input) {
|
|
162
|
+
const type = node.type.id;
|
|
163
|
+
return type === StartTag || type === OpenTag
|
|
164
|
+
? new ElementContext(tagNameAfter(input, 1) || "", context)
|
|
165
|
+
: context;
|
|
166
|
+
},
|
|
167
|
+
hash(context) {
|
|
168
|
+
return context ? context.hash : 0;
|
|
169
|
+
},
|
|
170
|
+
strict: false,
|
|
171
|
+
});
|
|
172
|
+
export const tagStart = new ExternalTokenizer(
|
|
173
|
+
// oxlint-disable-next-line complexity -- vendored Lezer tokenizer
|
|
174
|
+
(input, stack) => {
|
|
175
|
+
if (input.next !== lessThan) {
|
|
176
|
+
if (input.next < 0 && stack.context)
|
|
177
|
+
input.acceptToken(missingCloseTag);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
input.advance();
|
|
181
|
+
const close = input.next === slash$1;
|
|
182
|
+
if (close)
|
|
183
|
+
input.advance();
|
|
184
|
+
const name = tagNameAfter(input, 0);
|
|
185
|
+
if (name === undefined)
|
|
186
|
+
return;
|
|
187
|
+
if (!name) {
|
|
188
|
+
input.acceptToken(close ? IncompleteCloseTag : StartTag);
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
const parent = stack.context ? stack.context.name : null;
|
|
192
|
+
if (close) {
|
|
193
|
+
if (name === parent) {
|
|
194
|
+
input.acceptToken(StartCloseTag);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (parent && implicitlyClosed[parent]) {
|
|
198
|
+
input.acceptToken(missingCloseTag, -2);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
for (let cx = stack.context; cx; cx = cx.parent) {
|
|
202
|
+
if (cx.name === name)
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
input.acceptToken(MismatchedStartCloseTag);
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
if (name === "script") {
|
|
209
|
+
input.acceptToken(StartScriptTag);
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
if (name === "style") {
|
|
213
|
+
input.acceptToken(StartStyleTag);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (name === "textarea") {
|
|
217
|
+
input.acceptToken(StartTextareaTag);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (Object.prototype.hasOwnProperty.call(selfClosers, name)) {
|
|
221
|
+
input.acceptToken(StartSelfClosingTag);
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (parent && closeOnOpen[parent]?.[name]) {
|
|
225
|
+
input.acceptToken(missingCloseTag, -1);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
input.acceptToken(StartTag);
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}, { contextual: true });
|
|
232
|
+
function contentTokenizer(tag, textToken, endToken) {
|
|
233
|
+
const lastState = 2 + tag.length;
|
|
234
|
+
return new ExternalTokenizer((input) => {
|
|
235
|
+
for (let state = 0, matchedLen = 0, i = 0;; i++) {
|
|
236
|
+
if (input.next < 0) {
|
|
237
|
+
if (i)
|
|
238
|
+
input.acceptToken(textToken);
|
|
239
|
+
break;
|
|
240
|
+
}
|
|
241
|
+
if ((state === 0 && input.next === lessThan) ||
|
|
242
|
+
(state === 1 && input.next === slash$1) ||
|
|
243
|
+
(state >= 2 && state < lastState && input.next === tag.charCodeAt(state - 2))) {
|
|
244
|
+
state++;
|
|
245
|
+
matchedLen++;
|
|
246
|
+
}
|
|
247
|
+
else if ((state === 2 || state === lastState) && isSpace(input.next)) {
|
|
248
|
+
matchedLen++;
|
|
249
|
+
}
|
|
250
|
+
else if (state === lastState && input.next === greaterThan$1) {
|
|
251
|
+
if (i > matchedLen)
|
|
252
|
+
input.acceptToken(textToken, -matchedLen);
|
|
253
|
+
else
|
|
254
|
+
input.acceptToken(endToken, -(matchedLen - 2));
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
else if ((input.next === 10 || input.next === 13) && i) {
|
|
258
|
+
input.acceptToken(textToken, 1);
|
|
259
|
+
break;
|
|
260
|
+
}
|
|
261
|
+
else {
|
|
262
|
+
state = 0;
|
|
263
|
+
matchedLen = 0;
|
|
264
|
+
}
|
|
265
|
+
input.advance();
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
export const scriptTokens = contentTokenizer("script", scriptText, StartCloseScriptTag);
|
|
270
|
+
export const styleTokens = contentTokenizer("style", styleText, StartCloseStyleTag);
|
|
271
|
+
export const textareaTokens = contentTokenizer("textarea", textareaText, StartCloseTextareaTag);
|
|
272
|
+
const space = new Set([
|
|
273
|
+
9, 10, 11, 12, 13, 32, 133, 160, 5760, 8192, 8193, 8194, 8195, 8196, 8197, 8198, 8199, 8200, 8201,
|
|
274
|
+
8202, 8232, 8233, 8239, 8287, 12288,
|
|
275
|
+
]);
|
|
276
|
+
const parenOpen = 40;
|
|
277
|
+
const parenClose = 41;
|
|
278
|
+
const squareOpen = 91;
|
|
279
|
+
const squareClose = 93;
|
|
280
|
+
const curlyOpen = 123;
|
|
281
|
+
const curlyClose = 125;
|
|
282
|
+
const comma = 44;
|
|
283
|
+
const colon = 58;
|
|
284
|
+
const hash = 35;
|
|
285
|
+
const at = 64;
|
|
286
|
+
const slash = 47;
|
|
287
|
+
const greaterThan = 62;
|
|
288
|
+
const dash = 45;
|
|
289
|
+
const quoteDouble = 34;
|
|
290
|
+
const quoteSingle = 39;
|
|
291
|
+
const backslash = 92;
|
|
292
|
+
const newline = 10;
|
|
293
|
+
const asterisk = 42;
|
|
294
|
+
const tick = 96;
|
|
295
|
+
const prefixes = new Set([colon, hash, at, slash]);
|
|
296
|
+
export const commentContent = new ExternalTokenizer((input) => {
|
|
297
|
+
for (let dashes = 0, i = 0;; i++) {
|
|
298
|
+
if (input.next < 0) {
|
|
299
|
+
if (i)
|
|
300
|
+
input.acceptToken(commentContent$1);
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
if (input.next === dash) {
|
|
304
|
+
dashes++;
|
|
305
|
+
}
|
|
306
|
+
else if (input.next === greaterThan && dashes >= 2) {
|
|
307
|
+
if (i > 3)
|
|
308
|
+
input.acceptToken(commentContent$1, -2);
|
|
309
|
+
break;
|
|
310
|
+
}
|
|
311
|
+
else {
|
|
312
|
+
dashes = 0;
|
|
313
|
+
}
|
|
314
|
+
input.advance();
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
function createStringHandler(input) {
|
|
318
|
+
let inString = false;
|
|
319
|
+
let inStringType = null;
|
|
320
|
+
let inStringIgnoreNext = false;
|
|
321
|
+
return () => {
|
|
322
|
+
if (inString) {
|
|
323
|
+
if (inStringIgnoreNext) {
|
|
324
|
+
inStringIgnoreNext = false;
|
|
325
|
+
return true;
|
|
326
|
+
}
|
|
327
|
+
if (input.next === backslash) {
|
|
328
|
+
inStringIgnoreNext = true;
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
if (inStringType === "double" && input.next === quoteDouble) {
|
|
332
|
+
inString = false;
|
|
333
|
+
inStringType = null;
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
if (inStringType === "single" && input.next === quoteSingle) {
|
|
337
|
+
inString = false;
|
|
338
|
+
inStringType = null;
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
if (inStringType === "template" && input.next === tick) {
|
|
342
|
+
inString = false;
|
|
343
|
+
inStringType = null;
|
|
344
|
+
return true;
|
|
345
|
+
}
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
if (input.next === quoteDouble) {
|
|
349
|
+
inString = true;
|
|
350
|
+
inStringType = "double";
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
if (input.next === quoteSingle) {
|
|
354
|
+
inString = true;
|
|
355
|
+
inStringType = "single";
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
if (input.next === tick) {
|
|
359
|
+
inString = true;
|
|
360
|
+
inStringType = "template";
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function createCommentHandler(input) {
|
|
367
|
+
let inLineComment = false;
|
|
368
|
+
let inBlockComment = false;
|
|
369
|
+
return () => {
|
|
370
|
+
if (inLineComment) {
|
|
371
|
+
if (input.next === newline) {
|
|
372
|
+
inLineComment = false;
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
if (inBlockComment) {
|
|
378
|
+
if (input.next === asterisk && input.peek(1) === slash) {
|
|
379
|
+
inBlockComment = false;
|
|
380
|
+
return true;
|
|
381
|
+
}
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
if (input.next === slash && input.peek(1) === slash) {
|
|
385
|
+
inLineComment = true;
|
|
386
|
+
return true;
|
|
387
|
+
}
|
|
388
|
+
if (input.next === slash && input.peek(1) === asterisk) {
|
|
389
|
+
inBlockComment = true;
|
|
390
|
+
return true;
|
|
391
|
+
}
|
|
392
|
+
return false;
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
export const longExpression = new ExternalTokenizer((input) => {
|
|
396
|
+
if (prefixes.has(input.next)) {
|
|
397
|
+
return;
|
|
398
|
+
}
|
|
399
|
+
const commentHandler = createCommentHandler(input);
|
|
400
|
+
const stringHandler = createStringHandler(input);
|
|
401
|
+
const stack = [];
|
|
402
|
+
const popIfMatch = (match) => {
|
|
403
|
+
const idx = stack.lastIndexOf(match);
|
|
404
|
+
if (idx !== -1) {
|
|
405
|
+
while (stack.length > idx) {
|
|
406
|
+
stack.pop();
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
};
|
|
410
|
+
for (let pos = 0;; pos++) {
|
|
411
|
+
if (input.next < 0) {
|
|
412
|
+
if (pos > 0)
|
|
413
|
+
input.acceptToken(LongExpression);
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
if (commentHandler() || stringHandler()) {
|
|
417
|
+
input.advance();
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
if (stack.length === 0 &&
|
|
421
|
+
(input.next === curlyClose || input.next === parenClose || input.next === squareClose)) {
|
|
422
|
+
input.acceptToken(LongExpression);
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
switch (input.next) {
|
|
426
|
+
case parenOpen:
|
|
427
|
+
stack.push("(");
|
|
428
|
+
break;
|
|
429
|
+
case parenClose:
|
|
430
|
+
popIfMatch("(");
|
|
431
|
+
break;
|
|
432
|
+
case squareOpen:
|
|
433
|
+
stack.push("[");
|
|
434
|
+
break;
|
|
435
|
+
case squareClose:
|
|
436
|
+
popIfMatch("[");
|
|
437
|
+
break;
|
|
438
|
+
case curlyOpen:
|
|
439
|
+
stack.push("{");
|
|
440
|
+
break;
|
|
441
|
+
case curlyClose:
|
|
442
|
+
popIfMatch("{");
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
input.advance();
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
// oxlint-disable-next-line complexity -- vendored Lezer tokenizer
|
|
449
|
+
export const shortExpression = new ExternalTokenizer((input) => {
|
|
450
|
+
if (prefixes.has(input.peek(0))) {
|
|
451
|
+
return;
|
|
452
|
+
}
|
|
453
|
+
const commentHandler = createCommentHandler(input);
|
|
454
|
+
const stringHandler = createStringHandler(input);
|
|
455
|
+
const stack = [];
|
|
456
|
+
const popIfMatch = (match) => {
|
|
457
|
+
const idx = stack.lastIndexOf(match);
|
|
458
|
+
if (idx !== -1) {
|
|
459
|
+
while (stack.length > idx) {
|
|
460
|
+
stack.pop();
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
for (let pos = 0;; pos++) {
|
|
465
|
+
if (input.next < 0) {
|
|
466
|
+
if (pos > 0)
|
|
467
|
+
input.acceptToken(ShortExpression);
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
if (commentHandler() || stringHandler()) {
|
|
471
|
+
input.advance();
|
|
472
|
+
continue;
|
|
473
|
+
}
|
|
474
|
+
if (stack.length === 0 &&
|
|
475
|
+
(input.next === curlyClose ||
|
|
476
|
+
input.next === parenClose ||
|
|
477
|
+
input.next === squareClose ||
|
|
478
|
+
input.next === comma)) {
|
|
479
|
+
input.acceptToken(ShortExpression);
|
|
480
|
+
break;
|
|
481
|
+
}
|
|
482
|
+
switch (input.next) {
|
|
483
|
+
case parenOpen:
|
|
484
|
+
stack.push("(");
|
|
485
|
+
break;
|
|
486
|
+
case parenClose:
|
|
487
|
+
popIfMatch("(");
|
|
488
|
+
break;
|
|
489
|
+
case squareOpen:
|
|
490
|
+
stack.push("[");
|
|
491
|
+
break;
|
|
492
|
+
case squareClose:
|
|
493
|
+
popIfMatch("[");
|
|
494
|
+
break;
|
|
495
|
+
case curlyOpen:
|
|
496
|
+
stack.push("{");
|
|
497
|
+
break;
|
|
498
|
+
case curlyClose:
|
|
499
|
+
popIfMatch("{");
|
|
500
|
+
break;
|
|
501
|
+
}
|
|
502
|
+
if (pos !== 0 && stack.length === 0 && space.has(input.next)) {
|
|
503
|
+
input.acceptToken(ShortExpression);
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
input.advance();
|
|
507
|
+
}
|
|
508
|
+
});
|
|
509
|
+
//# sourceMappingURL=tokens.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getpaseo/highlight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.2",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist",
|
|
6
6
|
"!dist/**/*.map"
|
|
@@ -38,13 +38,13 @@
|
|
|
38
38
|
"@lezer/java": "^1.1.3",
|
|
39
39
|
"@lezer/javascript": "^1.5.4",
|
|
40
40
|
"@lezer/json": "^1.0.3",
|
|
41
|
+
"@lezer/lr": "^1.4.8",
|
|
41
42
|
"@lezer/markdown": "^1.6.2",
|
|
42
43
|
"@lezer/php": "^1.0.5",
|
|
43
44
|
"@lezer/python": "^1.1.18",
|
|
44
45
|
"@lezer/rust": "^1.0.2",
|
|
45
46
|
"@lezer/xml": "^1.0.6",
|
|
46
47
|
"@lezer/yaml": "^1.0.4",
|
|
47
|
-
"@replit/codemirror-lang-csharp": "^6.2.0",
|
|
48
48
|
"lezer-elixir": "^1.1.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|