securemark 0.298.5 → 0.298.7
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/CHANGELOG.md +8 -0
- package/dist/index.js +246 -215
- package/package.json +1 -1
- package/src/combinator/data/delimiter.ts +40 -14
- package/src/combinator/data/parser/context.ts +5 -3
- package/src/combinator/data/parser/some.ts +2 -0
- package/src/combinator/data/parser/union.ts +1 -4
- package/src/combinator/data/parser.ts +7 -0
- package/src/parser/api/parse.test.ts +3 -21
- package/src/parser/context.ts +0 -2
- package/src/parser/inline/annotation.test.ts +6 -10
- package/src/parser/inline/annotation.ts +31 -113
- package/src/parser/inline/autolink/url.test.ts +1 -0
- package/src/parser/inline/deletion.ts +5 -4
- package/src/parser/inline/emstrong.ts +11 -4
- package/src/parser/inline/extension/placeholder.ts +1 -1
- package/src/parser/inline/insertion.ts +5 -4
- package/src/parser/inline/italic.ts +5 -4
- package/src/parser/inline/mark.ts +7 -6
- package/src/parser/inline.test.ts +2 -2
- package/src/parser/repeat.ts +133 -0
- package/src/parser/util.ts +1 -70
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.298.
|
|
1
|
+
/*! securemark v0.298.7 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
|
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
4
4
|
module.exports = factory(require("Prism"), require("DOMPurify"));
|
|
@@ -3376,16 +3376,24 @@ class Delimiters {
|
|
|
3376
3376
|
exports.Delimiters = Delimiters;
|
|
3377
3377
|
function matcher(pattern, advance, after) {
|
|
3378
3378
|
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3379
|
+
let sid = 0,
|
|
3380
|
+
pos = 0,
|
|
3381
|
+
index = -1;
|
|
3379
3382
|
switch (typeof pattern) {
|
|
3380
3383
|
case 'string':
|
|
3381
3384
|
if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
|
|
3382
3385
|
return input => {
|
|
3383
3386
|
const context = input;
|
|
3384
3387
|
const {
|
|
3388
|
+
SID,
|
|
3385
3389
|
source,
|
|
3386
3390
|
position
|
|
3387
3391
|
} = context;
|
|
3388
|
-
|
|
3392
|
+
const hit = SID === sid && position === pos;
|
|
3393
|
+
index = hit ? index : source.startsWith(pattern, position) ? position : -1;
|
|
3394
|
+
sid = SID;
|
|
3395
|
+
pos = position;
|
|
3396
|
+
if (index === -1) return;
|
|
3389
3397
|
if (advance) {
|
|
3390
3398
|
context.position += pattern.length;
|
|
3391
3399
|
}
|
|
@@ -3396,15 +3404,20 @@ function matcher(pattern, advance, after) {
|
|
|
3396
3404
|
return input => {
|
|
3397
3405
|
const context = input;
|
|
3398
3406
|
const {
|
|
3407
|
+
SID,
|
|
3399
3408
|
source,
|
|
3400
3409
|
position
|
|
3401
3410
|
} = context;
|
|
3411
|
+
const hit = SID === sid && position === pos;
|
|
3402
3412
|
pattern.lastIndex = position;
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3413
|
+
index = hit ? index : pattern.test(source) ? pattern.lastIndex : -1;
|
|
3414
|
+
sid = SID;
|
|
3415
|
+
pos = position;
|
|
3416
|
+
if (index === -1) return;
|
|
3417
|
+
const src = source.slice(position, index);
|
|
3418
|
+
count && !hit && (0, context_1.consume)(src.length, context);
|
|
3406
3419
|
if (advance) {
|
|
3407
|
-
context.position
|
|
3420
|
+
context.position = index;
|
|
3408
3421
|
}
|
|
3409
3422
|
const next = after?.(input);
|
|
3410
3423
|
return after ? next && new parser_1.List([new parser_1.Node(src)]).import(next) : new parser_1.List([new parser_1.Node(src)]);
|
|
@@ -3414,16 +3427,24 @@ function matcher(pattern, advance, after) {
|
|
|
3414
3427
|
exports.matcher = matcher;
|
|
3415
3428
|
function tester(pattern, advance, after) {
|
|
3416
3429
|
const count = typeof pattern === 'object' ? /[^^\\*+][*+]|{\d+,}/.test(pattern.source) : false;
|
|
3430
|
+
let sid = 0,
|
|
3431
|
+
pos = 0,
|
|
3432
|
+
index = -1;
|
|
3417
3433
|
switch (typeof pattern) {
|
|
3418
3434
|
case 'string':
|
|
3419
3435
|
if (pattern === '') return () => new parser_1.List();
|
|
3420
3436
|
return input => {
|
|
3421
3437
|
const context = input;
|
|
3422
3438
|
const {
|
|
3439
|
+
SID,
|
|
3423
3440
|
source,
|
|
3424
3441
|
position
|
|
3425
3442
|
} = context;
|
|
3426
|
-
|
|
3443
|
+
const hit = SID === sid && position === pos;
|
|
3444
|
+
index = hit ? index : source.startsWith(pattern, position) ? position : -1;
|
|
3445
|
+
sid = SID;
|
|
3446
|
+
pos = position;
|
|
3447
|
+
if (index === -1) return;
|
|
3427
3448
|
if (advance) {
|
|
3428
3449
|
context.position += pattern.length;
|
|
3429
3450
|
}
|
|
@@ -3434,15 +3455,20 @@ function tester(pattern, advance, after) {
|
|
|
3434
3455
|
return input => {
|
|
3435
3456
|
const context = input;
|
|
3436
3457
|
const {
|
|
3458
|
+
SID,
|
|
3437
3459
|
source,
|
|
3438
3460
|
position
|
|
3439
3461
|
} = context;
|
|
3462
|
+
const hit = SID === sid && position === pos;
|
|
3440
3463
|
pattern.lastIndex = position;
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3464
|
+
index = hit ? index : pattern.test(source) ? pattern.lastIndex : -1;
|
|
3465
|
+
sid = SID;
|
|
3466
|
+
pos = position;
|
|
3467
|
+
if (index === -1) return;
|
|
3468
|
+
const len = index - position;
|
|
3469
|
+
count && !hit && (0, context_1.consume)(len, context);
|
|
3444
3470
|
if (advance) {
|
|
3445
|
-
context.position
|
|
3471
|
+
context.position = index;
|
|
3446
3472
|
}
|
|
3447
3473
|
if (after && after(input) === undefined) return;
|
|
3448
3474
|
return new parser_1.List();
|
|
@@ -3625,6 +3651,10 @@ class Node {
|
|
|
3625
3651
|
}
|
|
3626
3652
|
}
|
|
3627
3653
|
exports.Node = Node;
|
|
3654
|
+
let SID = 0;
|
|
3655
|
+
function sid() {
|
|
3656
|
+
return SID = ++SID >>> 0 || 1;
|
|
3657
|
+
}
|
|
3628
3658
|
class Context {
|
|
3629
3659
|
constructor({
|
|
3630
3660
|
source,
|
|
@@ -3639,6 +3669,7 @@ class Context {
|
|
|
3639
3669
|
offset,
|
|
3640
3670
|
backtracks
|
|
3641
3671
|
} = {}) {
|
|
3672
|
+
this.SID = sid();
|
|
3642
3673
|
this.source = source ?? '';
|
|
3643
3674
|
this.position = position ?? 0;
|
|
3644
3675
|
this.segment = segment ?? 0;
|
|
@@ -3654,6 +3685,7 @@ class Context {
|
|
|
3654
3685
|
}
|
|
3655
3686
|
exports.Context = Context;
|
|
3656
3687
|
function input(source, context) {
|
|
3688
|
+
context.SID = sid();
|
|
3657
3689
|
context.source = source;
|
|
3658
3690
|
context.position = 0;
|
|
3659
3691
|
return context;
|
|
@@ -3662,6 +3694,7 @@ exports.input = input;
|
|
|
3662
3694
|
function subinput(source, context) {
|
|
3663
3695
|
return {
|
|
3664
3696
|
...context,
|
|
3697
|
+
SID: sid(),
|
|
3665
3698
|
source,
|
|
3666
3699
|
position: 0,
|
|
3667
3700
|
offset: 0,
|
|
@@ -3808,13 +3841,15 @@ function recursions(rs, parser) {
|
|
|
3808
3841
|
} = resources;
|
|
3809
3842
|
for (const recursion of rs) {
|
|
3810
3843
|
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
3811
|
-
if (rec
|
|
3812
|
-
rec
|
|
3844
|
+
if (rec === -1) continue;
|
|
3845
|
+
if (recursions[rec] < 1) throw new Error('Too much recursion');
|
|
3846
|
+
--recursions[rec];
|
|
3813
3847
|
}
|
|
3814
3848
|
const result = parser(input);
|
|
3815
3849
|
for (const recursion of rs) {
|
|
3816
3850
|
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
3817
|
-
rec
|
|
3851
|
+
if (rec === -1) continue;
|
|
3852
|
+
++recursions[rec];
|
|
3818
3853
|
}
|
|
3819
3854
|
return result;
|
|
3820
3855
|
};
|
|
@@ -3975,8 +4010,10 @@ function some(parser, delimiter, after, delimiters, limit = -1) {
|
|
|
3975
4010
|
for (const len = source.length; context.position < len;) {
|
|
3976
4011
|
if (match(input)) break;
|
|
3977
4012
|
if (context.delimiters.test(input)) break;
|
|
4013
|
+
const pos = context.position;
|
|
3978
4014
|
const result = parser(input);
|
|
3979
4015
|
if (result === undefined) break;
|
|
4016
|
+
if (context.position === pos) break;
|
|
3980
4017
|
nodes = nodes?.import(result) ?? result;
|
|
3981
4018
|
if (limit >= 0 && context.position - position > limit) break;
|
|
3982
4019
|
}
|
|
@@ -4043,7 +4080,7 @@ function union(parsers) {
|
|
|
4043
4080
|
case 1:
|
|
4044
4081
|
return parsers[0];
|
|
4045
4082
|
default:
|
|
4046
|
-
return eval(['(
|
|
4083
|
+
return eval(['(', parsers.map((_, i) => `parser${i},`).join(''), ') =>', 'input =>', parsers.map((_, i) => `|| parser${i}(input)`).join('').slice(2)].join(''))(...parsers);
|
|
4047
4084
|
}
|
|
4048
4085
|
}
|
|
4049
4086
|
exports.union = union;
|
|
@@ -6026,7 +6063,7 @@ class Context extends parser_1.Context {
|
|
|
6026
6063
|
this.resources ??= {
|
|
6027
6064
|
// バックトラックのせいで文字数制限を受けないようにする。
|
|
6028
6065
|
clock: exports.MAX_SEGMENT_SIZE * (6 + 1),
|
|
6029
|
-
recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.
|
|
6066
|
+
recursions: [5 || 0 /* Recursion.block */, 20 || 0 /* Recursion.blockquote */, 40 || 0 /* Recursion.listitem */, 20 || 0 /* Recursion.inline */, 20 || 0 /* Recursion.bracket */, 20 || 0 /* Recursion.terminal */]
|
|
6030
6067
|
};
|
|
6031
6068
|
this.segment = segment ?? 0 /* Segment.unknown */;
|
|
6032
6069
|
this.local = local ?? false;
|
|
@@ -6275,6 +6312,7 @@ const parser_1 = __webpack_require__(605);
|
|
|
6275
6312
|
const combinator_1 = __webpack_require__(3484);
|
|
6276
6313
|
const inline_1 = __webpack_require__(7973);
|
|
6277
6314
|
const bracket_1 = __webpack_require__(4526);
|
|
6315
|
+
const repeat_1 = __webpack_require__(8019);
|
|
6278
6316
|
const visibility_1 = __webpack_require__(6364);
|
|
6279
6317
|
const util_1 = __webpack_require__(4992);
|
|
6280
6318
|
const dom_1 = __webpack_require__(394);
|
|
@@ -6293,121 +6331,38 @@ const dom_1 = __webpack_require__(394);
|
|
|
6293
6331
|
// 修正する必要があるためほぼ完全な二重処理が必要になり三重以上の注釈という不適切な使用のために
|
|
6294
6332
|
// 常に非常に非効率な処理を行い常時低速化するより三重以上の注釈を禁止して効率性を維持するのが妥当である。
|
|
6295
6333
|
const MAX_DEPTH = 20;
|
|
6296
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0,
|
|
6334
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, repeat_1.repeat)('(', visibility_1.beforeNonblank, ')', [4 /* Recursion.bracket */], (0, combinator_1.precedence)(1, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]), ')', false, [], ([, bs], {
|
|
6335
|
+
buffer
|
|
6336
|
+
}) => buffer.import(bs), ([, bs], {
|
|
6337
|
+
buffer
|
|
6338
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), (nodes, context, lead, follow) => {
|
|
6297
6339
|
const {
|
|
6298
6340
|
linebreak,
|
|
6299
6341
|
recursion,
|
|
6300
6342
|
resources
|
|
6301
6343
|
} = context;
|
|
6302
|
-
if (linebreak !== 0) {
|
|
6303
|
-
|
|
6304
|
-
|
|
6344
|
+
if (linebreak !== 0 || nodes.length === 0 || lead === 0 || follow % 2 === 0) {
|
|
6345
|
+
nodes.unshift(new parser_1.Node('('));
|
|
6346
|
+
nodes.push(new parser_1.Node(')'));
|
|
6305
6347
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6306
6348
|
class: (0, bracket_1.bracketname)(context, 1, 1)
|
|
6307
|
-
},
|
|
6308
|
-
class: (0, bracket_1.bracketname)(context, 2, 2)
|
|
6309
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(ns))), ')']))]);
|
|
6349
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
|
|
6310
6350
|
}
|
|
6311
|
-
|
|
6312
|
-
|
|
6351
|
+
recursion.add(MAX_DEPTH - (resources?.recursions[4 /* Recursion.bracket */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH));
|
|
6352
|
+
context.position += 1;
|
|
6313
6353
|
return new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', {
|
|
6314
6354
|
class: 'annotation'
|
|
6315
|
-
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(
|
|
6316
|
-
}, (
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
resources
|
|
6323
|
-
} = context;
|
|
6324
|
-
const depth = MAX_DEPTH - (resources?.recursions[4 /* Recursion.annotation */] ?? resources?.recursions.at(-1) ?? MAX_DEPTH);
|
|
6325
|
-
if (linebreak === 0 && bs && bs.length === 1 && source[position] === ')' && typeof bs.head?.value === 'object') {
|
|
6326
|
-
const {
|
|
6327
|
-
className
|
|
6328
|
-
} = bs.head.value;
|
|
6329
|
-
if (className === 'paren' || className === 'bracket') {
|
|
6330
|
-
const {
|
|
6331
|
-
firstChild,
|
|
6332
|
-
lastChild
|
|
6333
|
-
} = bs.head.value;
|
|
6334
|
-
if (firstChild.nodeValue.length === 1) {
|
|
6335
|
-
firstChild.remove();
|
|
6336
|
-
} else {
|
|
6337
|
-
firstChild.nodeValue = firstChild.nodeValue.slice(1);
|
|
6338
|
-
}
|
|
6339
|
-
if (lastChild.nodeValue.length === 1) {
|
|
6340
|
-
lastChild.remove();
|
|
6341
|
-
} else {
|
|
6342
|
-
lastChild.nodeValue = lastChild.nodeValue.slice(0, -1);
|
|
6343
|
-
}
|
|
6344
|
-
context.position += 1;
|
|
6345
|
-
recursion.add(depth);
|
|
6346
|
-
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6347
|
-
class: 'paren'
|
|
6348
|
-
}, ['(', (0, dom_1.html)('sup', {
|
|
6349
|
-
class: 'annotation'
|
|
6350
|
-
}, [(0, dom_1.html)('span', bs.head.value.childNodes)])]))]);
|
|
6351
|
-
}
|
|
6352
|
-
if (className === 'annotation' && deepunwrap(bs)) {
|
|
6353
|
-
context.position += 1;
|
|
6354
|
-
recursion.add(depth);
|
|
6355
|
-
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6356
|
-
class: 'paren'
|
|
6357
|
-
}, ['(', (0, dom_1.html)('sup', {
|
|
6358
|
-
class: 'annotation'
|
|
6359
|
-
}, [(0, dom_1.html)('span', [bs.head.value])])]))]);
|
|
6360
|
-
}
|
|
6361
|
-
}
|
|
6362
|
-
bs ??= new parser_1.List();
|
|
6363
|
-
bs.unshift(new parser_1.Node('('));
|
|
6364
|
-
if (source[context.position] === ')') {
|
|
6365
|
-
bs.push(new parser_1.Node(')'));
|
|
6366
|
-
context.position += 1;
|
|
6355
|
+
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(nodes))))]))]);
|
|
6356
|
+
}, (nodes, context, prefix, postfix) => {
|
|
6357
|
+
for (let i = 0; i < prefix; ++i) {
|
|
6358
|
+
nodes.unshift(new parser_1.Node('('));
|
|
6359
|
+
nodes = new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6360
|
+
class: (0, bracket_1.bracketname)(context, 1, 0)
|
|
6361
|
+
}, (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))]);
|
|
6367
6362
|
context.range += 1;
|
|
6368
6363
|
}
|
|
6369
|
-
|
|
6370
|
-
class: (0, bracket_1.bracketname)(context, 2, context.position - position)
|
|
6371
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
|
|
6372
|
-
bs.unshift(new parser_1.Node('('));
|
|
6373
|
-
const cs = parser(context);
|
|
6374
|
-
if (source[context.position] === ')') {
|
|
6375
|
-
cs && bs.import(cs);
|
|
6376
|
-
bs.push(new parser_1.Node(')'));
|
|
6377
|
-
context.position += 1;
|
|
6378
|
-
context.range += 1;
|
|
6379
|
-
}
|
|
6380
|
-
return new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6381
|
-
class: (0, bracket_1.bracketname)(context, 1, context.position - position)
|
|
6382
|
-
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]);
|
|
6364
|
+
return nodes;
|
|
6383
6365
|
})));
|
|
6384
|
-
const parser = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(1, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]])));
|
|
6385
|
-
function deepunwrap(list) {
|
|
6386
|
-
let bottom = list.head.value;
|
|
6387
|
-
for (; bottom;) {
|
|
6388
|
-
const el = bottom.firstChild.firstChild;
|
|
6389
|
-
if (el !== el?.parentNode?.lastChild) break;
|
|
6390
|
-
if (el instanceof HTMLElement === false) break;
|
|
6391
|
-
if (el?.className !== 'annotation') break;
|
|
6392
|
-
bottom = el;
|
|
6393
|
-
}
|
|
6394
|
-
const el = bottom.firstChild.firstChild;
|
|
6395
|
-
if (el instanceof Element === false) return false;
|
|
6396
|
-
if (el === el?.parentNode?.lastChild) {
|
|
6397
|
-
const {
|
|
6398
|
-
className,
|
|
6399
|
-
firstChild,
|
|
6400
|
-
lastChild
|
|
6401
|
-
} = el;
|
|
6402
|
-
if (className === 'paren' || className === 'bracket') {
|
|
6403
|
-
firstChild.nodeValue.length === 1 ? firstChild.remove() : firstChild.nodeValue = firstChild.nodeValue.slice(1);
|
|
6404
|
-
lastChild.nodeValue.length === 1 ? lastChild.remove() : lastChild.nodeValue = lastChild.nodeValue.slice(0, -1);
|
|
6405
|
-
el.replaceWith(...el.childNodes);
|
|
6406
|
-
return true;
|
|
6407
|
-
}
|
|
6408
|
-
}
|
|
6409
|
-
return false;
|
|
6410
|
-
}
|
|
6411
6366
|
|
|
6412
6367
|
/***/ },
|
|
6413
6368
|
|
|
@@ -6652,7 +6607,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
|
|
|
6652
6607
|
context.position -= source[0] === '!' ? 1 : 0;
|
|
6653
6608
|
return new parser_1.List([new parser_1.Node((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Node(source.slice(position))]), context))]);
|
|
6654
6609
|
})), (0, source_1.str)(/[^:]+/y)])])));
|
|
6655
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(
|
|
6610
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.unescapable */]), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.unescapable */])]));
|
|
6656
6611
|
|
|
6657
6612
|
/***/ },
|
|
6658
6613
|
|
|
@@ -6703,17 +6658,17 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
|
|
|
6703
6658
|
return d1(input);
|
|
6704
6659
|
}
|
|
6705
6660
|
}]));
|
|
6706
|
-
const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(
|
|
6661
|
+
const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6707
6662
|
class: bracketname(context, 1, 1)
|
|
6708
6663
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6709
6664
|
class: bracketname(context, 1, 0)
|
|
6710
6665
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
|
|
6711
|
-
const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(
|
|
6666
|
+
const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [], ([as, bs = new parser_1.List(), cs], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6712
6667
|
class: bracketname(context, 1, 1)
|
|
6713
6668
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([as, bs = new parser_1.List()], context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
6714
6669
|
class: bracketname(context, 1, 0)
|
|
6715
6670
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs)))))])));
|
|
6716
|
-
const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(
|
|
6671
|
+
const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 4 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
|
|
6717
6672
|
const {
|
|
6718
6673
|
source,
|
|
6719
6674
|
position,
|
|
@@ -6739,12 +6694,12 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
|
|
|
6739
6694
|
}
|
|
6740
6695
|
return as.import(bs).import(cs);
|
|
6741
6696
|
}, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6742
|
-
const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(
|
|
6743
|
-
const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(
|
|
6744
|
-
const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(
|
|
6697
|
+
const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6698
|
+
const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6699
|
+
const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6745
6700
|
const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
|
|
6746
6701
|
// 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
|
|
6747
|
-
(0, combinator_1.precedence)(2, (0, combinator_1.recursion)(
|
|
6702
|
+
(0, combinator_1.precedence)(2, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
|
|
6748
6703
|
|
|
6749
6704
|
/***/ },
|
|
6750
6705
|
|
|
@@ -6787,14 +6742,15 @@ exports.deletion = void 0;
|
|
|
6787
6742
|
const parser_1 = __webpack_require__(605);
|
|
6788
6743
|
const combinator_1 = __webpack_require__(3484);
|
|
6789
6744
|
const inline_1 = __webpack_require__(7973);
|
|
6745
|
+
const repeat_1 = __webpack_require__(8019);
|
|
6790
6746
|
const visibility_1 = __webpack_require__(6364);
|
|
6791
6747
|
const util_1 = __webpack_require__(4992);
|
|
6792
6748
|
const dom_1 = __webpack_require__(394);
|
|
6793
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0,
|
|
6749
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('~~', '', '~~', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '~~')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '~'), true)])), '~~', false, [], ([, bs], {
|
|
6794
6750
|
buffer
|
|
6795
6751
|
}) => buffer.import(bs), ([, bs], {
|
|
6796
6752
|
buffer
|
|
6797
|
-
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))
|
|
6753
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('del', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
|
|
6798
6754
|
|
|
6799
6755
|
/***/ },
|
|
6800
6756
|
|
|
@@ -6836,6 +6792,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6836
6792
|
const strong_1 = __webpack_require__(6591);
|
|
6837
6793
|
const emphasis_1 = __webpack_require__(1354);
|
|
6838
6794
|
const source_1 = __webpack_require__(8745);
|
|
6795
|
+
const repeat_1 = __webpack_require__(8019);
|
|
6839
6796
|
const visibility_1 = __webpack_require__(6364);
|
|
6840
6797
|
const util_1 = __webpack_require__(4992);
|
|
6841
6798
|
const dom_1 = __webpack_require__(394);
|
|
@@ -6844,7 +6801,7 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
|
|
|
6844
6801
|
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
|
|
6845
6802
|
// 可能な限り早く閉じるよう解析しなければならない。
|
|
6846
6803
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6847
|
-
exports.emstrong = (0, combinator_1.lazy)(() => (0,
|
|
6804
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('***', visibility_1.beforeNonblank, '***', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank)])), (0, source_1.strs)('*', 1, 3), false, [], ([, bs, cs], context) => {
|
|
6848
6805
|
const {
|
|
6849
6806
|
buffer
|
|
6850
6807
|
} = context;
|
|
@@ -6892,6 +6849,7 @@ exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0,
|
|
|
6892
6849
|
// 3以上の`*`に対してemの適用を保証する
|
|
6893
6850
|
nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)))]))]), (nodes, context, prefix, postfix, state) => {
|
|
6894
6851
|
context.position += postfix;
|
|
6852
|
+
context.range += postfix;
|
|
6895
6853
|
if (state) {
|
|
6896
6854
|
switch (postfix) {
|
|
6897
6855
|
case 0:
|
|
@@ -6906,6 +6864,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6906
6864
|
}
|
|
6907
6865
|
prefix -= postfix;
|
|
6908
6866
|
postfix -= postfix;
|
|
6867
|
+
context.range += postfix;
|
|
6909
6868
|
switch (prefix) {
|
|
6910
6869
|
case 0:
|
|
6911
6870
|
break;
|
|
@@ -6922,6 +6881,7 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6922
6881
|
}
|
|
6923
6882
|
})(context) ?? prepend('*', nodes);
|
|
6924
6883
|
prefix -= 1;
|
|
6884
|
+
context.range += 1;
|
|
6925
6885
|
break;
|
|
6926
6886
|
case 2:
|
|
6927
6887
|
nodes = (0, combinator_1.bind)(substrong, ds => {
|
|
@@ -6936,14 +6896,17 @@ nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', [(0, dom_1.h
|
|
|
6936
6896
|
}
|
|
6937
6897
|
})(context) ?? prepend('**', nodes);
|
|
6938
6898
|
prefix -= 2;
|
|
6899
|
+
context.range += 2;
|
|
6939
6900
|
break;
|
|
6940
6901
|
}
|
|
6941
6902
|
}
|
|
6942
6903
|
if (prefix > postfix) {
|
|
6943
6904
|
nodes = prepend('*'.repeat(prefix - postfix), nodes);
|
|
6905
|
+
prefix = 0;
|
|
6906
|
+
context.range += prefix - postfix;
|
|
6944
6907
|
}
|
|
6945
6908
|
return nodes;
|
|
6946
|
-
}))
|
|
6909
|
+
}));
|
|
6947
6910
|
function prepend(prefix, nodes) {
|
|
6948
6911
|
if (typeof nodes.head?.value === 'string') {
|
|
6949
6912
|
nodes.head.value = prefix + nodes.head.value;
|
|
@@ -7268,7 +7231,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7268
7231
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
7269
7232
|
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
7270
7233
|
// ^はabbrで使用済みだが^:などのようにして分離使用可能
|
|
7271
|
-
(0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(
|
|
7234
|
+
(0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.bracket */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]]))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Node((0, dom_1.html)('span', {
|
|
7272
7235
|
class: 'invalid',
|
|
7273
7236
|
...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
|
|
7274
7237
|
}, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
|
|
@@ -7413,14 +7376,15 @@ exports.insertion = void 0;
|
|
|
7413
7376
|
const parser_1 = __webpack_require__(605);
|
|
7414
7377
|
const combinator_1 = __webpack_require__(3484);
|
|
7415
7378
|
const inline_1 = __webpack_require__(7973);
|
|
7379
|
+
const repeat_1 = __webpack_require__(8019);
|
|
7416
7380
|
const visibility_1 = __webpack_require__(6364);
|
|
7417
7381
|
const util_1 = __webpack_require__(4992);
|
|
7418
7382
|
const dom_1 = __webpack_require__(394);
|
|
7419
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0,
|
|
7383
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('++', '', '++', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, (0, visibility_1.blankWith)('\n', '++')), (0, combinator_1.open)('\n', (0, combinator_1.some)(inline_1.inline, '+'), true)])), '++', false, [], ([, bs], {
|
|
7420
7384
|
buffer
|
|
7421
7385
|
}) => buffer.import(bs), ([, bs], {
|
|
7422
7386
|
buffer
|
|
7423
|
-
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))
|
|
7387
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('ins', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
|
|
7424
7388
|
|
|
7425
7389
|
/***/ },
|
|
7426
7390
|
|
|
@@ -7437,17 +7401,18 @@ exports.italic = void 0;
|
|
|
7437
7401
|
const parser_1 = __webpack_require__(605);
|
|
7438
7402
|
const combinator_1 = __webpack_require__(3484);
|
|
7439
7403
|
const inline_1 = __webpack_require__(7973);
|
|
7404
|
+
const repeat_1 = __webpack_require__(8019);
|
|
7440
7405
|
const visibility_1 = __webpack_require__(6364);
|
|
7441
7406
|
const util_1 = __webpack_require__(4992);
|
|
7442
7407
|
const dom_1 = __webpack_require__(394);
|
|
7443
7408
|
// 可読性のため実際にはオブリーク体を指定する。
|
|
7444
7409
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
7445
7410
|
// ある程度の長さのある文に使うのが望ましい。
|
|
7446
|
-
exports.italic = (0, combinator_1.lazy)(() => (0,
|
|
7411
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('///', visibility_1.beforeNonblank, '///', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
|
|
7447
7412
|
buffer
|
|
7448
7413
|
}) => buffer.import(bs), ([, bs], {
|
|
7449
7414
|
buffer
|
|
7450
|
-
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])))
|
|
7415
|
+
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), nodes => new parser_1.List([new parser_1.Node((0, dom_1.html)('i', (0, dom_1.defrag)((0, util_1.unwrap)(nodes))))])));
|
|
7451
7416
|
|
|
7452
7417
|
/***/ },
|
|
7453
7418
|
|
|
@@ -7621,26 +7586,27 @@ const parser_1 = __webpack_require__(605);
|
|
|
7621
7586
|
const combinator_1 = __webpack_require__(3484);
|
|
7622
7587
|
const inline_1 = __webpack_require__(7973);
|
|
7623
7588
|
const indexee_1 = __webpack_require__(7610);
|
|
7589
|
+
const repeat_1 = __webpack_require__(8019);
|
|
7624
7590
|
const visibility_1 = __webpack_require__(6364);
|
|
7625
7591
|
const util_1 = __webpack_require__(4992);
|
|
7626
7592
|
const dom_1 = __webpack_require__(394);
|
|
7627
|
-
exports.mark = (0, combinator_1.lazy)(() => (0,
|
|
7593
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, repeat_1.repeat)('==', visibility_1.beforeNonblank, '==', [3 /* Recursion.inline */], (0, combinator_1.precedence)(0, (0, combinator_1.surround)('', (0, combinator_1.state)(2 /* State.mark */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '==', visibility_1.afterNonblank)), '==', false, [], ([, bs], {
|
|
7628
7594
|
buffer
|
|
7629
7595
|
}) => buffer.import(bs), ([, bs], {
|
|
7630
7596
|
buffer
|
|
7631
7597
|
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer)), (nodes, {
|
|
7632
7598
|
id,
|
|
7633
7599
|
state
|
|
7634
|
-
},
|
|
7600
|
+
}, lead) => {
|
|
7635
7601
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
|
|
7636
|
-
if (state & 251 /* State.linkers */ ||
|
|
7602
|
+
if (state & 251 /* State.linkers */ || lead >= 2) return new parser_1.List([new parser_1.Node(el)]);
|
|
7637
7603
|
(0, dom_1.define)(el, {
|
|
7638
7604
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el.cloneNode(true)))
|
|
7639
7605
|
});
|
|
7640
7606
|
return el.id ? new parser_1.List([new parser_1.Node(el), new parser_1.Node((0, dom_1.html)('a', {
|
|
7641
7607
|
href: `#${el.id}`
|
|
7642
7608
|
}))]) : new parser_1.List([new parser_1.Node(el)]);
|
|
7643
|
-
}))
|
|
7609
|
+
}));
|
|
7644
7610
|
|
|
7645
7611
|
/***/ },
|
|
7646
7612
|
|
|
@@ -7674,7 +7640,7 @@ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combin
|
|
|
7674
7640
|
translate: 'no',
|
|
7675
7641
|
...(0, util_1.invalid)('math', 'content', `"${source.match(forbiddenCommand)[0]}" command is forbidden`)
|
|
7676
7642
|
}, source))])));
|
|
7677
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(
|
|
7643
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, (0, combinator_1.some)(source_1.escsource, /[{}$\n]/y)]))), (0, source_1.str)('}'), true));
|
|
7678
7644
|
|
|
7679
7645
|
/***/ },
|
|
7680
7646
|
|
|
@@ -7761,7 +7727,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
|
|
|
7761
7727
|
target: '_blank'
|
|
7762
7728
|
}, [el]))]);
|
|
7763
7729
|
}))));
|
|
7764
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(
|
|
7730
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')')), (0, source_1.str)(')'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), (0, source_1.str)(']'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}')), (0, source_1.str)('}'), true, [], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"'))), (0, source_1.str)('"'), true, [], undefined, () => new parser_1.List())]));
|
|
7765
7731
|
const option = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, combinator_1.open)(/ /y, (0, source_1.str)(/[1-9][0-9]*/y)), (0, source_1.str)(/[x:]/y), (0, source_1.str)(/[1-9][0-9]*(?=[ }])/y), false, [], ([[{
|
|
7766
7732
|
value: a
|
|
7767
7733
|
}], [{
|
|
@@ -8079,7 +8045,7 @@ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, s
|
|
|
8079
8045
|
class: 'invalid',
|
|
8080
8046
|
...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
|
|
8081
8047
|
}, context.source.slice(context.position - context.range, context.position)))])));
|
|
8082
|
-
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(
|
|
8048
|
+
const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [], undefined, ([as, bs]) => bs && as.import(bs)), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [], undefined, ([as, bs]) => bs && as.import(bs))]));
|
|
8083
8049
|
|
|
8084
8050
|
/***/ },
|
|
8085
8051
|
|
|
@@ -8406,6 +8372,143 @@ function* proc(note, defs) {
|
|
|
8406
8372
|
|
|
8407
8373
|
/***/ },
|
|
8408
8374
|
|
|
8375
|
+
/***/ 8019
|
|
8376
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
8377
|
+
|
|
8378
|
+
"use strict";
|
|
8379
|
+
|
|
8380
|
+
|
|
8381
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
8382
|
+
value: true
|
|
8383
|
+
}));
|
|
8384
|
+
exports.repeat = void 0;
|
|
8385
|
+
const parser_1 = __webpack_require__(605);
|
|
8386
|
+
const delimiter_1 = __webpack_require__(385);
|
|
8387
|
+
const alias_1 = __webpack_require__(5413);
|
|
8388
|
+
function repeat(opener, after, closer, rs, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8389
|
+
const acc = new parser_1.List();
|
|
8390
|
+
if (prefix > 0) {
|
|
8391
|
+
acc.push(new parser_1.Node(opener[0].repeat(prefix)));
|
|
8392
|
+
context.range += prefix;
|
|
8393
|
+
}
|
|
8394
|
+
acc.import(nodes);
|
|
8395
|
+
if (postfix > 0) {
|
|
8396
|
+
const {
|
|
8397
|
+
source,
|
|
8398
|
+
position
|
|
8399
|
+
} = context;
|
|
8400
|
+
acc.push(new parser_1.Node(source.slice(position, position + postfix)));
|
|
8401
|
+
context.position += postfix;
|
|
8402
|
+
context.range += postfix;
|
|
8403
|
+
}
|
|
8404
|
+
return acc;
|
|
8405
|
+
}) {
|
|
8406
|
+
const test = (0, delimiter_1.tester)(after, false);
|
|
8407
|
+
return (0, parser_1.failsafe)(input => {
|
|
8408
|
+
const context = input;
|
|
8409
|
+
const {
|
|
8410
|
+
source,
|
|
8411
|
+
position,
|
|
8412
|
+
resources: {
|
|
8413
|
+
recursions
|
|
8414
|
+
} = {}
|
|
8415
|
+
} = context;
|
|
8416
|
+
if (!source.startsWith(opener, context.position)) return;
|
|
8417
|
+
let nodes = new parser_1.List();
|
|
8418
|
+
let i = opener.length;
|
|
8419
|
+
for (; source[context.position + i] === source[context.position];) ++i;
|
|
8420
|
+
context.position += i;
|
|
8421
|
+
if (test(input) === undefined) return;
|
|
8422
|
+
let depth = i / opener.length + 1 | 0;
|
|
8423
|
+
if (recursions) for (const recursion of rs) {
|
|
8424
|
+
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
8425
|
+
if (rec === -1) continue;
|
|
8426
|
+
if (recursions[rec] < depth - 1) throw new Error('Too much recursion');
|
|
8427
|
+
recursions[rec] -= depth;
|
|
8428
|
+
}
|
|
8429
|
+
let state = false;
|
|
8430
|
+
let follow = 0;
|
|
8431
|
+
for (; i >= opener.length; i -= opener.length, follow -= closer.length) {
|
|
8432
|
+
if (recursions) for (const recursion of rs) {
|
|
8433
|
+
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
8434
|
+
if (rec === -1) continue;
|
|
8435
|
+
recursions[rec] += 1;
|
|
8436
|
+
}
|
|
8437
|
+
depth -= 1;
|
|
8438
|
+
const lead = i - opener.length;
|
|
8439
|
+
if (source.startsWith(closer, context.position)) {
|
|
8440
|
+
context.position += closer.length;
|
|
8441
|
+
const pos = context.position;
|
|
8442
|
+
follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
|
|
8443
|
+
nodes = cons(nodes, context, lead, follow);
|
|
8444
|
+
if (context.position > pos) {
|
|
8445
|
+
const advance = opener.length * (context.position - pos) / closer.length | 0;
|
|
8446
|
+
i -= advance;
|
|
8447
|
+
follow -= advance;
|
|
8448
|
+
depth -= advance;
|
|
8449
|
+
}
|
|
8450
|
+
continue;
|
|
8451
|
+
}
|
|
8452
|
+
const buf = context.buffer;
|
|
8453
|
+
context.buffer = nodes;
|
|
8454
|
+
const result = parser(input);
|
|
8455
|
+
context.buffer = buf;
|
|
8456
|
+
context.range = context.position - position - i + opener.length;
|
|
8457
|
+
if (result === undefined) break;
|
|
8458
|
+
const pos = context.position;
|
|
8459
|
+
nodes = result;
|
|
8460
|
+
switch (nodes.last?.value) {
|
|
8461
|
+
case "\u0018" /* Command.Cancel */:
|
|
8462
|
+
nodes.pop();
|
|
8463
|
+
state = false;
|
|
8464
|
+
break;
|
|
8465
|
+
case "\u001F" /* Command.Separator */:
|
|
8466
|
+
follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
|
|
8467
|
+
nodes.pop();
|
|
8468
|
+
state = true;
|
|
8469
|
+
continue;
|
|
8470
|
+
default:
|
|
8471
|
+
follow = follow > 0 ? follow : countFollows(source, pos, closer, lead / opener.length | 0);
|
|
8472
|
+
nodes = cons(nodes, context, lead, follow);
|
|
8473
|
+
state = true;
|
|
8474
|
+
if (context.position > pos) {
|
|
8475
|
+
const advance = opener.length * (context.position - pos) / closer.length | 0;
|
|
8476
|
+
i -= advance;
|
|
8477
|
+
follow -= advance;
|
|
8478
|
+
depth -= advance;
|
|
8479
|
+
}
|
|
8480
|
+
continue;
|
|
8481
|
+
}
|
|
8482
|
+
break;
|
|
8483
|
+
}
|
|
8484
|
+
if (recursions) for (let i = 0; i < depth; ++i) for (const recursion of rs) {
|
|
8485
|
+
const rec = (0, alias_1.min)(recursion, recursions.length - 1);
|
|
8486
|
+
if (rec === -1) continue;
|
|
8487
|
+
recursions[rec] += depth;
|
|
8488
|
+
}
|
|
8489
|
+
depth = 0;
|
|
8490
|
+
const prefix = i;
|
|
8491
|
+
i = 0;
|
|
8492
|
+
for (let len = (0, alias_1.min)(prefix, source.length - context.position); i < len && source[context.position + i] === closer[0];) {
|
|
8493
|
+
++i;
|
|
8494
|
+
}
|
|
8495
|
+
const postfix = i;
|
|
8496
|
+
context.range = context.position - position - prefix - postfix;
|
|
8497
|
+
return termination(nodes, context, prefix, postfix, state);
|
|
8498
|
+
});
|
|
8499
|
+
}
|
|
8500
|
+
exports.repeat = repeat;
|
|
8501
|
+
function countFollows(source, position, closer, limit) {
|
|
8502
|
+
if (closer.length === 0) return 0;
|
|
8503
|
+
let pos = position;
|
|
8504
|
+
for (let i = 0; i < limit && pos < source.length; ++i, pos += closer.length) {
|
|
8505
|
+
if (!source.startsWith(closer, pos)) break;
|
|
8506
|
+
}
|
|
8507
|
+
return pos - position;
|
|
8508
|
+
}
|
|
8509
|
+
|
|
8510
|
+
/***/ },
|
|
8511
|
+
|
|
8409
8512
|
/***/ 3967
|
|
8410
8513
|
(__unused_webpack_module, exports, __webpack_require__) {
|
|
8411
8514
|
|
|
@@ -9020,10 +9123,7 @@ exports.unescsource = unescsource;
|
|
|
9020
9123
|
Object.defineProperty(exports, "__esModule", ({
|
|
9021
9124
|
value: true
|
|
9022
9125
|
}));
|
|
9023
|
-
exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.
|
|
9024
|
-
const parser_1 = __webpack_require__(605);
|
|
9025
|
-
const delimiter_1 = __webpack_require__(385);
|
|
9026
|
-
const alias_1 = __webpack_require__(5413);
|
|
9126
|
+
exports.randomID = exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.unwrap = void 0;
|
|
9027
9127
|
const random_1 = __webpack_require__(3158);
|
|
9028
9128
|
const dom_1 = __webpack_require__(394);
|
|
9029
9129
|
function* unwrap(nodes) {
|
|
@@ -9033,75 +9133,6 @@ function* unwrap(nodes) {
|
|
|
9033
9133
|
}
|
|
9034
9134
|
}
|
|
9035
9135
|
exports.unwrap = unwrap;
|
|
9036
|
-
function repeat(symbol, after, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
9037
|
-
const acc = new parser_1.List();
|
|
9038
|
-
if (prefix > 0) {
|
|
9039
|
-
acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
|
|
9040
|
-
}
|
|
9041
|
-
acc.import(nodes);
|
|
9042
|
-
if (postfix > 0) {
|
|
9043
|
-
const {
|
|
9044
|
-
source,
|
|
9045
|
-
position
|
|
9046
|
-
} = context;
|
|
9047
|
-
acc.push(new parser_1.Node(source.slice(position, position + postfix)));
|
|
9048
|
-
context.position += postfix;
|
|
9049
|
-
}
|
|
9050
|
-
return acc;
|
|
9051
|
-
}) {
|
|
9052
|
-
const test = (0, delimiter_1.tester)(after, false);
|
|
9053
|
-
return (0, parser_1.failsafe)(input => {
|
|
9054
|
-
const context = input;
|
|
9055
|
-
const {
|
|
9056
|
-
source,
|
|
9057
|
-
position
|
|
9058
|
-
} = context;
|
|
9059
|
-
if (!source.startsWith(symbol, context.position)) return;
|
|
9060
|
-
let nodes = new parser_1.List();
|
|
9061
|
-
let i = symbol.length;
|
|
9062
|
-
for (; source[context.position + i] === source[context.position];) ++i;
|
|
9063
|
-
context.position += i;
|
|
9064
|
-
if (test(input) === undefined) return;
|
|
9065
|
-
let state = false;
|
|
9066
|
-
for (; i >= symbol.length; i -= symbol.length) {
|
|
9067
|
-
if (nodes.length > 0 && source.startsWith(symbol, context.position)) {
|
|
9068
|
-
nodes = cons(nodes, context, i > symbol.length);
|
|
9069
|
-
context.position += symbol.length;
|
|
9070
|
-
continue;
|
|
9071
|
-
}
|
|
9072
|
-
const buf = context.buffer;
|
|
9073
|
-
context.buffer = nodes;
|
|
9074
|
-
const result = parser(input);
|
|
9075
|
-
context.buffer = buf;
|
|
9076
|
-
if (result === undefined) break;
|
|
9077
|
-
nodes = result;
|
|
9078
|
-
switch (nodes.last?.value) {
|
|
9079
|
-
case "\u0018" /* Command.Cancel */:
|
|
9080
|
-
nodes.pop();
|
|
9081
|
-
state = false;
|
|
9082
|
-
break;
|
|
9083
|
-
case "\u001F" /* Command.Separator */:
|
|
9084
|
-
nodes.pop();
|
|
9085
|
-
state = true;
|
|
9086
|
-
continue;
|
|
9087
|
-
default:
|
|
9088
|
-
nodes = cons(nodes, context, i > symbol.length);
|
|
9089
|
-
state = true;
|
|
9090
|
-
continue;
|
|
9091
|
-
}
|
|
9092
|
-
break;
|
|
9093
|
-
}
|
|
9094
|
-
const prefix = i;
|
|
9095
|
-
i = 0;
|
|
9096
|
-
for (let len = (0, alias_1.min)(prefix, source.length - context.position); i < len && source[context.position + i] === symbol[0];) {
|
|
9097
|
-
++i;
|
|
9098
|
-
}
|
|
9099
|
-
const postfix = i;
|
|
9100
|
-
context.range = context.position - position;
|
|
9101
|
-
return termination(nodes, context, prefix, postfix, state);
|
|
9102
|
-
});
|
|
9103
|
-
}
|
|
9104
|
-
exports.repeat = repeat;
|
|
9105
9136
|
function invalid(syntax, type, message) {
|
|
9106
9137
|
return {
|
|
9107
9138
|
'data-invalid-syntax': syntax,
|