securemark 0.296.1 → 0.296.3
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 +162 -124
- package/package.json +1 -1
- package/src/combinator/control/constraint/contract.ts +4 -3
- package/src/combinator/control/manipulation/scope.ts +1 -1
- package/src/combinator/control/manipulation/surround.ts +32 -16
- package/src/combinator/data/delimiter.ts +82 -6
- package/src/combinator/data/parser/context.test.ts +2 -2
- package/src/combinator/data/parser/context.ts +12 -36
- package/src/parser/api/bind.ts +6 -6
- package/src/parser/api/parse.ts +1 -1
- package/src/parser/inline/annotation.ts +3 -3
- package/src/parser/inline/deletion.ts +1 -1
- package/src/parser/inline/emphasis.ts +4 -4
- package/src/parser/inline/emstrong.test.ts +1 -0
- package/src/parser/inline/emstrong.ts +3 -3
- package/src/parser/inline/extension/index.ts +2 -3
- package/src/parser/inline/extension/placeholder.ts +2 -2
- package/src/parser/inline/insertion.ts +1 -1
- package/src/parser/inline/italic.test.ts +1 -0
- package/src/parser/inline/italic.ts +2 -2
- package/src/parser/inline/link.ts +3 -3
- package/src/parser/inline/mark.test.ts +1 -0
- package/src/parser/inline/mark.ts +4 -4
- package/src/parser/inline/reference.ts +3 -3
- package/src/parser/inline/strong.ts +4 -4
- package/src/parser/source/str.ts +4 -4
- package/src/parser/util.ts +7 -4
- package/src/parser/visibility.ts +13 -28
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! securemark v0.296.
|
|
1
|
+
/*! securemark v0.296.3 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"));
|
|
@@ -2603,18 +2603,19 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2603
2603
|
value: true
|
|
2604
2604
|
}));
|
|
2605
2605
|
exports.verify = exports.validate = void 0;
|
|
2606
|
-
const
|
|
2606
|
+
const delimiter_1 = __webpack_require__(385);
|
|
2607
|
+
const bind_1 = __webpack_require__(994);
|
|
2607
2608
|
function validate(pattern, parser) {
|
|
2608
2609
|
if (typeof pattern === 'function') return guard(pattern, parser);
|
|
2609
|
-
const
|
|
2610
|
-
return input =>
|
|
2610
|
+
const test = (0, delimiter_1.tester)(pattern, false);
|
|
2611
|
+
return input => test(input) && parser(input);
|
|
2611
2612
|
}
|
|
2612
2613
|
exports.validate = validate;
|
|
2613
2614
|
function guard(f, parser) {
|
|
2614
2615
|
return input => f(input) ? parser(input) : undefined;
|
|
2615
2616
|
}
|
|
2616
2617
|
function verify(parser, cond) {
|
|
2617
|
-
return (0,
|
|
2618
|
+
return (0, bind_1.bind)(parser, (nodes, context) => cond(nodes, context) ? nodes : undefined);
|
|
2618
2619
|
}
|
|
2619
2620
|
exports.verify = verify;
|
|
2620
2621
|
|
|
@@ -2989,9 +2990,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
2989
2990
|
}));
|
|
2990
2991
|
exports.rewrite = exports.focus = void 0;
|
|
2991
2992
|
const parser_1 = __webpack_require__(605);
|
|
2992
|
-
const
|
|
2993
|
+
const delimiter_1 = __webpack_require__(385);
|
|
2993
2994
|
function focus(scope, parser, slice = true) {
|
|
2994
|
-
const match = (0,
|
|
2995
|
+
const match = (0, delimiter_1.matcher)(scope, false);
|
|
2995
2996
|
return (0, parser_1.failsafe)(arg => {
|
|
2996
2997
|
const {
|
|
2997
2998
|
context
|
|
@@ -3067,22 +3068,22 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
3067
3068
|
}));
|
|
3068
3069
|
exports.setBacktrack = exports.isBacktrack = exports.close = exports.open = exports.surround = void 0;
|
|
3069
3070
|
const parser_1 = __webpack_require__(605);
|
|
3070
|
-
const
|
|
3071
|
+
const delimiter_1 = __webpack_require__(385);
|
|
3071
3072
|
function surround(opener, parser, closer, optional = false, backtracks = [], f, g) {
|
|
3072
3073
|
switch (typeof opener) {
|
|
3073
3074
|
case 'string':
|
|
3074
3075
|
case 'object':
|
|
3075
|
-
opener = (0,
|
|
3076
|
+
opener = (0, delimiter_1.tester)(opener, true);
|
|
3076
3077
|
}
|
|
3077
3078
|
switch (typeof parser) {
|
|
3078
3079
|
case 'string':
|
|
3079
3080
|
case 'object':
|
|
3080
|
-
parser = (0,
|
|
3081
|
+
parser = (0, delimiter_1.tester)(parser, true);
|
|
3081
3082
|
}
|
|
3082
3083
|
switch (typeof closer) {
|
|
3083
3084
|
case 'string':
|
|
3084
3085
|
case 'object':
|
|
3085
|
-
closer = (0,
|
|
3086
|
+
closer = (0, delimiter_1.tester)(closer, true);
|
|
3086
3087
|
}
|
|
3087
3088
|
const [blen, rbs, wbs] = reduce(backtracks);
|
|
3088
3089
|
return (0, parser_1.failsafe)(input => {
|
|
@@ -3099,7 +3100,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3099
3100
|
} = context;
|
|
3100
3101
|
context.linebreak = 0;
|
|
3101
3102
|
const nodesO = opener(input);
|
|
3102
|
-
if (
|
|
3103
|
+
if (nodesO === undefined) {
|
|
3103
3104
|
return void revert(context, linebreak);
|
|
3104
3105
|
}
|
|
3105
3106
|
if (rbs && isBacktrack(context, rbs, position, blen)) {
|
|
@@ -3107,14 +3108,14 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3107
3108
|
}
|
|
3108
3109
|
const nodesM = context.position < source.length ? parser(input) : undefined;
|
|
3109
3110
|
context.range = context.position - position;
|
|
3110
|
-
if (
|
|
3111
|
+
if (nodesM === undefined && !optional) {
|
|
3111
3112
|
wbs && setBacktrack(context, wbs, position);
|
|
3112
3113
|
const result = g?.([nodesO, nodesM], context);
|
|
3113
3114
|
return result || void revert(context, linebreak);
|
|
3114
3115
|
}
|
|
3115
|
-
const nodesC =
|
|
3116
|
+
const nodesC = optional || nodesM ? closer(input) : undefined;
|
|
3116
3117
|
context.range = context.position - position;
|
|
3117
|
-
if (
|
|
3118
|
+
if (nodesC === undefined) {
|
|
3118
3119
|
wbs && setBacktrack(context, wbs, position);
|
|
3119
3120
|
const result = g?.([nodesO, nodesM], context);
|
|
3120
3121
|
return result || void revert(context, linebreak);
|
|
@@ -3123,7 +3124,7 @@ function surround(opener, parser, closer, optional = false, backtracks = [], f,
|
|
|
3123
3124
|
return void revert(context, linebreak);
|
|
3124
3125
|
}
|
|
3125
3126
|
context.range = context.position - position;
|
|
3126
|
-
const result = f ? f([nodesO, nodesM, nodesC], context) : nodesO.import(nodesM
|
|
3127
|
+
const result = f ? f([nodesO, nodesM, nodesC], context) : nodesM ? nodesO.import(nodesM).import(nodesC) : nodesO.import(nodesC);
|
|
3127
3128
|
if (result) {
|
|
3128
3129
|
context.linebreak ||= linebreak;
|
|
3129
3130
|
}
|
|
@@ -3245,8 +3246,9 @@ exports.fmap = fmap;
|
|
|
3245
3246
|
Object.defineProperty(exports, "__esModule", ({
|
|
3246
3247
|
value: true
|
|
3247
3248
|
}));
|
|
3248
|
-
exports.Delimiters = void 0;
|
|
3249
|
-
const
|
|
3249
|
+
exports.tester = exports.matcher = exports.Delimiters = void 0;
|
|
3250
|
+
const parser_1 = __webpack_require__(605);
|
|
3251
|
+
const context_1 = __webpack_require__(5745);
|
|
3250
3252
|
class Delimiters {
|
|
3251
3253
|
constructor() {
|
|
3252
3254
|
this.tree = {};
|
|
@@ -3276,9 +3278,9 @@ class Delimiters {
|
|
|
3276
3278
|
return () => undefined;
|
|
3277
3279
|
case 'string':
|
|
3278
3280
|
case 'object':
|
|
3279
|
-
const
|
|
3280
|
-
const verify = after ? (
|
|
3281
|
-
return verify ? input =>
|
|
3281
|
+
const test = tester(pattern, false);
|
|
3282
|
+
const verify = after ? tester(after, false) : undefined;
|
|
3283
|
+
return verify ? input => test(input) !== undefined && verify(input) !== undefined || undefined : input => test(input) !== undefined || undefined;
|
|
3282
3284
|
}
|
|
3283
3285
|
}
|
|
3284
3286
|
registry(signature) {
|
|
@@ -3390,6 +3392,90 @@ class Delimiters {
|
|
|
3390
3392
|
}
|
|
3391
3393
|
}
|
|
3392
3394
|
exports.Delimiters = Delimiters;
|
|
3395
|
+
function matcher(pattern, advance, after) {
|
|
3396
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3397
|
+
switch (typeof pattern) {
|
|
3398
|
+
case 'string':
|
|
3399
|
+
if (pattern === '') return () => new parser_1.List([new parser_1.Node(pattern)]);
|
|
3400
|
+
return input => {
|
|
3401
|
+
const {
|
|
3402
|
+
context
|
|
3403
|
+
} = input;
|
|
3404
|
+
const {
|
|
3405
|
+
source,
|
|
3406
|
+
position
|
|
3407
|
+
} = context;
|
|
3408
|
+
if (!source.startsWith(pattern, position)) return;
|
|
3409
|
+
if (advance) {
|
|
3410
|
+
context.position += pattern.length;
|
|
3411
|
+
}
|
|
3412
|
+
const next = after?.(input);
|
|
3413
|
+
return after ? next && new parser_1.List([new parser_1.Node(pattern)]).import(next) : new parser_1.List([new parser_1.Node(pattern)]);
|
|
3414
|
+
};
|
|
3415
|
+
case 'object':
|
|
3416
|
+
return input => {
|
|
3417
|
+
const {
|
|
3418
|
+
context
|
|
3419
|
+
} = input;
|
|
3420
|
+
const {
|
|
3421
|
+
source,
|
|
3422
|
+
position
|
|
3423
|
+
} = context;
|
|
3424
|
+
pattern.lastIndex = position;
|
|
3425
|
+
if (!pattern.test(source)) return;
|
|
3426
|
+
const src = source.slice(position, pattern.lastIndex);
|
|
3427
|
+
count && (0, context_1.consume)(src.length, context);
|
|
3428
|
+
if (advance) {
|
|
3429
|
+
context.position += src.length;
|
|
3430
|
+
}
|
|
3431
|
+
const next = after?.(input);
|
|
3432
|
+
return after ? next && new parser_1.List([new parser_1.Node(src)]).import(next) : new parser_1.List([new parser_1.Node(src)]);
|
|
3433
|
+
};
|
|
3434
|
+
}
|
|
3435
|
+
}
|
|
3436
|
+
exports.matcher = matcher;
|
|
3437
|
+
function tester(pattern, advance, after) {
|
|
3438
|
+
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3439
|
+
switch (typeof pattern) {
|
|
3440
|
+
case 'string':
|
|
3441
|
+
if (pattern === '') return () => new parser_1.List();
|
|
3442
|
+
return input => {
|
|
3443
|
+
const {
|
|
3444
|
+
context
|
|
3445
|
+
} = input;
|
|
3446
|
+
const {
|
|
3447
|
+
source,
|
|
3448
|
+
position
|
|
3449
|
+
} = context;
|
|
3450
|
+
if (!source.startsWith(pattern, position)) return;
|
|
3451
|
+
if (advance) {
|
|
3452
|
+
context.position += pattern.length;
|
|
3453
|
+
}
|
|
3454
|
+
if (after && after(input) === undefined) return;
|
|
3455
|
+
return new parser_1.List();
|
|
3456
|
+
};
|
|
3457
|
+
case 'object':
|
|
3458
|
+
return input => {
|
|
3459
|
+
const {
|
|
3460
|
+
context
|
|
3461
|
+
} = input;
|
|
3462
|
+
const {
|
|
3463
|
+
source,
|
|
3464
|
+
position
|
|
3465
|
+
} = context;
|
|
3466
|
+
pattern.lastIndex = position;
|
|
3467
|
+
if (!pattern.test(source)) return;
|
|
3468
|
+
const len = pattern.lastIndex - position;
|
|
3469
|
+
count && (0, context_1.consume)(len, context);
|
|
3470
|
+
if (advance) {
|
|
3471
|
+
context.position += len;
|
|
3472
|
+
}
|
|
3473
|
+
if (after && after(input) === undefined) return;
|
|
3474
|
+
return new parser_1.List();
|
|
3475
|
+
};
|
|
3476
|
+
}
|
|
3477
|
+
}
|
|
3478
|
+
exports.tester = tester;
|
|
3393
3479
|
|
|
3394
3480
|
/***/ },
|
|
3395
3481
|
|
|
@@ -3630,20 +3716,28 @@ exports.failsafe = failsafe;
|
|
|
3630
3716
|
Object.defineProperty(exports, "__esModule", ({
|
|
3631
3717
|
value: true
|
|
3632
3718
|
}));
|
|
3633
|
-
exports.
|
|
3634
|
-
const parser_1 = __webpack_require__(605);
|
|
3719
|
+
exports.constraint = exports.state = exports.precedence = exports.recursion = exports.consume = exports.creation = exports.context = exports.reset = void 0;
|
|
3635
3720
|
const alias_1 = __webpack_require__(5413);
|
|
3636
3721
|
const assign_1 = __webpack_require__(9888);
|
|
3637
3722
|
function reset(base, parser) {
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3723
|
+
return input => {
|
|
3724
|
+
const {
|
|
3725
|
+
context
|
|
3726
|
+
} = input;
|
|
3727
|
+
// @ts-expect-error
|
|
3728
|
+
context.resources ??= {
|
|
3729
|
+
clock: base.resources?.clock,
|
|
3730
|
+
recursions: base.resources?.recursions.slice()
|
|
3731
|
+
};
|
|
3732
|
+
context.backtracks = {};
|
|
3733
|
+
return parser(input);
|
|
3734
|
+
};
|
|
3735
|
+
// removed by dead control flow
|
|
3736
|
+
|
|
3737
|
+
// removed by dead control flow
|
|
3738
|
+
|
|
3739
|
+
// removed by dead control flow
|
|
3740
|
+
|
|
3647
3741
|
}
|
|
3648
3742
|
exports.reset = reset;
|
|
3649
3743
|
function context(base, parser) {
|
|
@@ -3790,45 +3884,6 @@ function constraint(state, positive, parser) {
|
|
|
3790
3884
|
};
|
|
3791
3885
|
}
|
|
3792
3886
|
exports.constraint = constraint;
|
|
3793
|
-
function matcher(pattern, advance, verify) {
|
|
3794
|
-
const count = typeof pattern === 'object' ? /[^^\\*+][*+]/.test(pattern.source) : false;
|
|
3795
|
-
switch (typeof pattern) {
|
|
3796
|
-
case 'string':
|
|
3797
|
-
return ({
|
|
3798
|
-
context
|
|
3799
|
-
}) => {
|
|
3800
|
-
const {
|
|
3801
|
-
source,
|
|
3802
|
-
position
|
|
3803
|
-
} = context;
|
|
3804
|
-
if (!source.startsWith(pattern, position)) return;
|
|
3805
|
-
if (verify?.(source, position, pattern.length) === false) return;
|
|
3806
|
-
if (advance) {
|
|
3807
|
-
context.position += pattern.length;
|
|
3808
|
-
}
|
|
3809
|
-
return new parser_1.List([new parser_1.Node(pattern)]);
|
|
3810
|
-
};
|
|
3811
|
-
case 'object':
|
|
3812
|
-
return ({
|
|
3813
|
-
context
|
|
3814
|
-
}) => {
|
|
3815
|
-
const {
|
|
3816
|
-
source,
|
|
3817
|
-
position
|
|
3818
|
-
} = context;
|
|
3819
|
-
pattern.lastIndex = position;
|
|
3820
|
-
if (!pattern.test(source)) return;
|
|
3821
|
-
const src = source.slice(position, pattern.lastIndex);
|
|
3822
|
-
count && consume(src.length, context);
|
|
3823
|
-
if (verify?.(source, position, src.length) === false) return;
|
|
3824
|
-
if (advance) {
|
|
3825
|
-
context.position += src.length;
|
|
3826
|
-
}
|
|
3827
|
-
return new parser_1.List([new parser_1.Node(src)]);
|
|
3828
|
-
};
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
3831
|
-
exports.matcher = matcher;
|
|
3832
3887
|
|
|
3833
3888
|
/***/ },
|
|
3834
3889
|
|
|
@@ -4182,7 +4237,7 @@ function bind(target, settings) {
|
|
|
4182
4237
|
context.header = true;
|
|
4183
4238
|
for (; index < sourceSegments.length - last; ++index) {
|
|
4184
4239
|
const seg = sourceSegments[index];
|
|
4185
|
-
const es = (0, block_1.block)((0, parser_1.input)(seg, context))?.foldl((acc, {
|
|
4240
|
+
const es = (0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(context)))?.foldl((acc, {
|
|
4186
4241
|
value
|
|
4187
4242
|
}) => void acc.push(value) || acc, []) ?? [];
|
|
4188
4243
|
// @ts-expect-error
|
|
@@ -4191,7 +4246,7 @@ function bind(target, settings) {
|
|
|
4191
4246
|
if (es.length === 0) continue;
|
|
4192
4247
|
// All deletion processes always run after all addition processes have done.
|
|
4193
4248
|
// Therefore any `base` node will never be unavailable by deletions until all the dependent `el` nodes are added.
|
|
4194
|
-
|
|
4249
|
+
adds.push(...es.map(el => [el, base]));
|
|
4195
4250
|
adds.reverse();
|
|
4196
4251
|
for (; adds.length > 0;) {
|
|
4197
4252
|
const [el, base] = adds.pop();
|
|
@@ -4208,7 +4263,7 @@ function bind(target, settings) {
|
|
|
4208
4263
|
for (let refuse = (0, array_1.splice)(blocks, index, blocks.length - sourceSegments.length), i = 0; i < refuse.length; ++i) {
|
|
4209
4264
|
const es = refuse[i][1];
|
|
4210
4265
|
if (es.length === 0) continue;
|
|
4211
|
-
|
|
4266
|
+
dels.push(...es.map(el => [el]));
|
|
4212
4267
|
}
|
|
4213
4268
|
adds.reverse();
|
|
4214
4269
|
for (; adds.length > 0;) {
|
|
@@ -4493,7 +4548,7 @@ function parse(source, options = {}, context) {
|
|
|
4493
4548
|
// @ts-expect-error
|
|
4494
4549
|
context.header = true;
|
|
4495
4550
|
for (const seg of (0, segment_1.segment)(source)) {
|
|
4496
|
-
node.append(...((0, block_1.block)((0, parser_1.input)(seg, context))?.foldl((acc, {
|
|
4551
|
+
node.append(...((0, block_1.block)((0, parser_1.input)(seg, new context_1.Context(context)))?.foldl((acc, {
|
|
4497
4552
|
value
|
|
4498
4553
|
}) => void acc.push(value) || acc, []) ?? []));
|
|
4499
4554
|
// @ts-expect-error
|
|
@@ -6243,7 +6298,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6243
6298
|
const visibility_1 = __webpack_require__(6364);
|
|
6244
6299
|
const util_1 = __webpack_require__(4992);
|
|
6245
6300
|
const dom_1 = __webpack_require__(394);
|
|
6246
|
-
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)('((', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0,
|
|
6301
|
+
exports.annotation = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(128 /* State.annotation */, (0, combinator_1.surround)((0, combinator_1.close)('((', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]]))), '))', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('sup', {
|
|
6247
6302
|
class: 'annotation'
|
|
6248
6303
|
}, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined, (_, context) => {
|
|
6249
6304
|
const {
|
|
@@ -6683,7 +6738,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
6683
6738
|
const visibility_1 = __webpack_require__(6364);
|
|
6684
6739
|
const util_1 = __webpack_require__(4992);
|
|
6685
6740
|
const dom_1 = __webpack_require__(394);
|
|
6686
|
-
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('~~', (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], {
|
|
6741
|
+
exports.deletion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('~~', '', (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], {
|
|
6687
6742
|
buffer
|
|
6688
6743
|
}) => buffer.import(bs), ([, bs], {
|
|
6689
6744
|
buffer
|
|
@@ -6709,7 +6764,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6709
6764
|
const visibility_1 = __webpack_require__(6364);
|
|
6710
6765
|
const util_1 = __webpack_require__(4992);
|
|
6711
6766
|
const dom_1 = __webpack_require__(394);
|
|
6712
|
-
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', (
|
|
6767
|
+
exports.emphasis = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('*', (0, visibility_1.beforeNonblankWith)(/(?!\*)/)), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), strong_1.strong])))), (0, source_1.str)('*'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('em', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
6713
6768
|
|
|
6714
6769
|
/***/ },
|
|
6715
6770
|
|
|
@@ -6737,13 +6792,13 @@ const subemphasis = (0, combinator_1.lazy)(() => (0, combinator_1.some)((0, comb
|
|
|
6737
6792
|
// 開閉が明示的でない構文は開閉の不明確な記号による再帰的適用を行わず
|
|
6738
6793
|
// 可能な限り早く閉じるよう解析しなければならない。
|
|
6739
6794
|
// このため終端記号の後ろを見て終端を中止し同じ構文を再帰的に適用してはならない。
|
|
6740
|
-
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('***', (0, combinator_1.surround)('', (0,
|
|
6795
|
+
exports.emstrong = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('***', visibility_1.beforeNonblank, (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)('*', 3), false, [], ([, bs, cs], context) => {
|
|
6741
6796
|
const {
|
|
6742
6797
|
buffer
|
|
6743
6798
|
} = context;
|
|
6744
6799
|
switch (cs.head.value) {
|
|
6745
6800
|
case '***':
|
|
6746
|
-
return bs;
|
|
6801
|
+
return buffer.import(bs);
|
|
6747
6802
|
case '**':
|
|
6748
6803
|
return (0, combinator_1.bind)(subemphasis, ds => {
|
|
6749
6804
|
const {
|
|
@@ -6893,7 +6948,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
6893
6948
|
const visibility_1 = __webpack_require__(6364);
|
|
6894
6949
|
const util_1 = __webpack_require__(4992);
|
|
6895
6950
|
const dom_1 = __webpack_require__(394);
|
|
6896
|
-
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#'), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0,
|
|
6951
|
+
exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /* State.index */, (0, combinator_1.fmap)((0, indexee_1.indexee)((0, combinator_1.surround)((0, source_1.str)('[#', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]]))), (0, source_1.str)(']'), false, [3 | 4 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Node((0, dom_1.html)('a', {
|
|
6897
6952
|
'data-index': dataindex(bs)
|
|
6898
6953
|
}, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
|
|
6899
6954
|
const el = ns.head.value;
|
|
@@ -7155,7 +7210,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7155
7210
|
// All syntax surrounded by square brackets shouldn't contain line breaks.
|
|
7156
7211
|
exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
|
|
7157
7212
|
// ^はabbrで使用済みだが^:などのようにして分離使用可能
|
|
7158
|
-
(0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0,
|
|
7213
|
+
(0, source_1.str)(/\[[:^|]/y, visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (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', {
|
|
7159
7214
|
class: 'invalid',
|
|
7160
7215
|
...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
|
|
7161
7216
|
}, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
|
|
@@ -7302,7 +7357,7 @@ const inline_1 = __webpack_require__(7973);
|
|
|
7302
7357
|
const visibility_1 = __webpack_require__(6364);
|
|
7303
7358
|
const util_1 = __webpack_require__(4992);
|
|
7304
7359
|
const dom_1 = __webpack_require__(394);
|
|
7305
|
-
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('++', (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], {
|
|
7360
|
+
exports.insertion = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('++', '', (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], {
|
|
7306
7361
|
buffer
|
|
7307
7362
|
}) => buffer.import(bs), ([, bs], {
|
|
7308
7363
|
buffer
|
|
@@ -7329,7 +7384,7 @@ const dom_1 = __webpack_require__(394);
|
|
|
7329
7384
|
// 可読性のため実際にはオブリーク体を指定する。
|
|
7330
7385
|
// 斜体は単語に使うとかえって見づらく読み飛ばしやすくなるため使わないべきであり
|
|
7331
7386
|
// ある程度の長さのある文に使うのが望ましい。
|
|
7332
|
-
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('///', (0, combinator_1.surround)('', (0,
|
|
7387
|
+
exports.italic = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('///', visibility_1.beforeNonblank, (0, combinator_1.surround)('', (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), '///', visibility_1.afterNonblank), '///', false, [], ([, bs], {
|
|
7333
7388
|
buffer
|
|
7334
7389
|
}) => buffer.import(bs), ([, bs], {
|
|
7335
7390
|
buffer
|
|
@@ -7360,7 +7415,7 @@ const optspec = {
|
|
|
7360
7415
|
rel: ['nofollow']
|
|
7361
7416
|
};
|
|
7362
7417
|
Object.setPrototypeOf(optspec, null);
|
|
7363
|
-
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0,
|
|
7418
|
+
exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.dup)((0, combinator_1.surround)((0, combinator_1.close)('[', visibility_1.beforeNonblank), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 4 /* Backtrack.common */ | 64 /* Backtrack.link */, 2 | 32 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
|
|
7364
7419
|
if (context.linebreak !== 0) {
|
|
7365
7420
|
const head = context.position - context.range;
|
|
7366
7421
|
return void (0, combinator_1.setBacktrack)(context, 2 | 64 /* Backtrack.link */ | 32 /* Backtrack.ruby */, head);
|
|
@@ -7510,16 +7565,16 @@ const indexee_1 = __webpack_require__(7610);
|
|
|
7510
7565
|
const visibility_1 = __webpack_require__(6364);
|
|
7511
7566
|
const util_1 = __webpack_require__(4992);
|
|
7512
7567
|
const dom_1 = __webpack_require__(394);
|
|
7513
|
-
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('==', (0, combinator_1.surround)('', (0,
|
|
7568
|
+
exports.mark = (0, combinator_1.lazy)(() => (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, util_1.repeat)('==', visibility_1.beforeNonblank, (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], {
|
|
7514
7569
|
buffer
|
|
7515
7570
|
}) => buffer.import(bs), ([, bs], {
|
|
7516
7571
|
buffer
|
|
7517
7572
|
}) => bs && buffer.import(bs).push(new parser_1.Node("\u0018" /* Command.Cancel */)) && buffer), (nodes, {
|
|
7518
7573
|
id,
|
|
7519
7574
|
state
|
|
7520
|
-
}) => {
|
|
7575
|
+
}, nest) => {
|
|
7521
7576
|
const el = (0, dom_1.html)('mark', (0, dom_1.defrag)((0, util_1.unwrap)(nodes)));
|
|
7522
|
-
if (state & 251 /* State.linkers */) return new parser_1.List([new parser_1.Node(el)]);
|
|
7577
|
+
if (state & 251 /* State.linkers */ || nest) return new parser_1.List([new parser_1.Node(el)]);
|
|
7523
7578
|
(0, dom_1.define)(el, {
|
|
7524
7579
|
id: (0, indexee_1.identity)('mark', id, (0, indexee_1.signature)(el))
|
|
7525
7580
|
});
|
|
@@ -7703,7 +7758,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7703
7758
|
const visibility_1 = __webpack_require__(6364);
|
|
7704
7759
|
const util_1 = __webpack_require__(4992);
|
|
7705
7760
|
const dom_1 = __webpack_require__(394);
|
|
7706
|
-
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)(
|
|
7761
|
+
exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)('[[', (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, combinator_1.open)(visibility_1.beforeNonblank, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [2, 1 | 4 /* Backtrack.common */, 3 | 128 /* Backtrack.doublebracket */], ([, ns], context) => {
|
|
7707
7762
|
const {
|
|
7708
7763
|
position,
|
|
7709
7764
|
range,
|
|
@@ -7948,7 +8003,7 @@ const source_1 = __webpack_require__(8745);
|
|
|
7948
8003
|
const visibility_1 = __webpack_require__(6364);
|
|
7949
8004
|
const util_1 = __webpack_require__(4992);
|
|
7950
8005
|
const dom_1 = __webpack_require__(394);
|
|
7951
|
-
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', (
|
|
8006
|
+
exports.strong = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('**', (0, visibility_1.beforeNonblankWith)(/(?!\*)/)), (0, combinator_1.precedence)(0, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(inline_1.inline, '*', visibility_1.afterNonblank), emphasis_1.emphasis])))), (0, source_1.str)('**'), false, [], ([, bs]) => new parser_1.List([new parser_1.Node((0, dom_1.html)('strong', (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]), ([as, bs]) => bs && as.import(bs)));
|
|
7952
8007
|
|
|
7953
8008
|
/***/ },
|
|
7954
8009
|
|
|
@@ -8583,9 +8638,9 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8583
8638
|
}));
|
|
8584
8639
|
exports.strs = exports.str = void 0;
|
|
8585
8640
|
const parser_1 = __webpack_require__(605);
|
|
8586
|
-
const
|
|
8587
|
-
function str(pattern,
|
|
8588
|
-
return (0,
|
|
8641
|
+
const delimiter_1 = __webpack_require__(385);
|
|
8642
|
+
function str(pattern, after) {
|
|
8643
|
+
return (0, delimiter_1.matcher)(pattern, true, after ? (0, delimiter_1.tester)(after, false) : undefined);
|
|
8589
8644
|
}
|
|
8590
8645
|
exports.str = str;
|
|
8591
8646
|
function strs(pattern, limit = -1) {
|
|
@@ -8908,6 +8963,7 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
8908
8963
|
}));
|
|
8909
8964
|
exports.stringify = exports.unmarkInvalid = exports.markInvalid = exports.invalid = exports.repeat = exports.unwrap = void 0;
|
|
8910
8965
|
const parser_1 = __webpack_require__(605);
|
|
8966
|
+
const delimiter_1 = __webpack_require__(385);
|
|
8911
8967
|
const alias_1 = __webpack_require__(5413);
|
|
8912
8968
|
const dom_1 = __webpack_require__(394);
|
|
8913
8969
|
function* unwrap(nodes) {
|
|
@@ -8917,7 +8973,7 @@ function* unwrap(nodes) {
|
|
|
8917
8973
|
}
|
|
8918
8974
|
}
|
|
8919
8975
|
exports.unwrap = unwrap;
|
|
8920
|
-
function repeat(symbol, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8976
|
+
function repeat(symbol, after, parser, cons, termination = (nodes, context, prefix, postfix) => {
|
|
8921
8977
|
const acc = new parser_1.List();
|
|
8922
8978
|
if (prefix > 0) {
|
|
8923
8979
|
acc.push(new parser_1.Node(symbol[0].repeat(prefix)));
|
|
@@ -8933,6 +8989,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8933
8989
|
}
|
|
8934
8990
|
return acc;
|
|
8935
8991
|
}) {
|
|
8992
|
+
const test = (0, delimiter_1.tester)(after, false);
|
|
8936
8993
|
return (0, parser_1.failsafe)(input => {
|
|
8937
8994
|
const {
|
|
8938
8995
|
context
|
|
@@ -8946,10 +9003,11 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8946
9003
|
let i = symbol.length;
|
|
8947
9004
|
for (; source[context.position + i] === source[context.position];) ++i;
|
|
8948
9005
|
context.position += i;
|
|
9006
|
+
if (test(input) === undefined) return;
|
|
8949
9007
|
let state = false;
|
|
8950
9008
|
for (; i >= symbol.length; i -= symbol.length) {
|
|
8951
9009
|
if (nodes.length > 0 && source.startsWith(symbol, context.position)) {
|
|
8952
|
-
nodes = cons(nodes, context);
|
|
9010
|
+
nodes = cons(nodes, context, i > symbol.length);
|
|
8953
9011
|
context.position += symbol.length;
|
|
8954
9012
|
continue;
|
|
8955
9013
|
}
|
|
@@ -8969,7 +9027,7 @@ function repeat(symbol, parser, cons, termination = (nodes, context, prefix, pos
|
|
|
8969
9027
|
state = true;
|
|
8970
9028
|
continue;
|
|
8971
9029
|
default:
|
|
8972
|
-
nodes = cons(nodes, context);
|
|
9030
|
+
nodes = cons(nodes, context, i > symbol.length);
|
|
8973
9031
|
state = true;
|
|
8974
9032
|
continue;
|
|
8975
9033
|
}
|
|
@@ -9038,7 +9096,7 @@ exports.stringify = stringify;
|
|
|
9038
9096
|
Object.defineProperty(exports, "__esModule", ({
|
|
9039
9097
|
value: true
|
|
9040
9098
|
}));
|
|
9041
|
-
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlank = exports.isNonblankNodeStart = exports.isNonblankFirstLine = exports.
|
|
9099
|
+
exports.trimBlankNodeEnd = exports.trimBlankEnd = exports.trimBlank = exports.isNonblankNodeStart = exports.isNonblankFirstLine = exports.beforeNonblankWith = exports.blankWith = exports.afterNonblank = exports.beforeNonblank = exports.visualize = void 0;
|
|
9042
9100
|
const parser_1 = __webpack_require__(605);
|
|
9043
9101
|
const combinator_1 = __webpack_require__(3484);
|
|
9044
9102
|
const normalize_1 = __webpack_require__(4490);
|
|
@@ -9052,7 +9110,8 @@ function visualize(parser) {
|
|
|
9052
9110
|
return (0, combinator_1.convert)(source => source.replace(blank.line, `$1${"\u001B" /* Command.Escape */}$2`), parser);
|
|
9053
9111
|
}
|
|
9054
9112
|
exports.visualize = visualize;
|
|
9055
|
-
exports.
|
|
9113
|
+
exports.beforeNonblank = beforeNonblankWith('');
|
|
9114
|
+
exports.afterNonblank = afterNonblankWith('');
|
|
9056
9115
|
function blankWith(starts, delimiter) {
|
|
9057
9116
|
return new RegExp([
|
|
9058
9117
|
// 空行除去
|
|
@@ -9060,33 +9119,12 @@ function blankWith(starts, delimiter) {
|
|
|
9060
9119
|
String.raw`(?:${starts}(?:\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)*)?`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
9061
9120
|
}
|
|
9062
9121
|
exports.blankWith = blankWith;
|
|
9063
|
-
function
|
|
9064
|
-
return new RegExp([
|
|
9065
|
-
}
|
|
9066
|
-
function beforeNonblank(parser) {
|
|
9067
|
-
return input => isNonblankStart(input) ? parser(input) : undefined;
|
|
9122
|
+
function beforeNonblankWith(delimiter) {
|
|
9123
|
+
return new RegExp([typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source, String.raw`(?!\\?\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`].join(''), 'y');
|
|
9068
9124
|
}
|
|
9069
|
-
exports.
|
|
9070
|
-
function
|
|
9071
|
-
|
|
9072
|
-
context
|
|
9073
|
-
} = input;
|
|
9074
|
-
const {
|
|
9075
|
-
source,
|
|
9076
|
-
position
|
|
9077
|
-
} = context;
|
|
9078
|
-
if (position === source.length) return true;
|
|
9079
|
-
switch (source[position]) {
|
|
9080
|
-
case ' ':
|
|
9081
|
-
case ' ':
|
|
9082
|
-
case '\t':
|
|
9083
|
-
case '\n':
|
|
9084
|
-
return false;
|
|
9085
|
-
default:
|
|
9086
|
-
const reg = blank.unit;
|
|
9087
|
-
reg.lastIndex = position;
|
|
9088
|
-
return !reg.test(source);
|
|
9089
|
-
}
|
|
9125
|
+
exports.beforeNonblankWith = beforeNonblankWith;
|
|
9126
|
+
function afterNonblankWith(delimiter) {
|
|
9127
|
+
return new RegExp([String.raw`(?<!\s|&(?:${normalize_1.invisibleBlankHTMLEntityNames.join('|')});|<wbr ?>)`, typeof delimiter === 'string' ? delimiter.replace(/[*+()\[\]]/g, '\\$&') : delimiter.source].join(''), 'y');
|
|
9090
9128
|
}
|
|
9091
9129
|
function isNonblankFirstLine(nodes) {
|
|
9092
9130
|
if (nodes.length === 0) return true;
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Parser, Input, List, Node, Context } from '../../data/parser';
|
|
2
|
-
import {
|
|
2
|
+
import { tester } from '../../data/delimiter';
|
|
3
|
+
import { bind } from '../monad/bind';
|
|
3
4
|
|
|
4
5
|
//export function contract<P extends Parser>(patterns: string | RegExp | (string | RegExp)[], parser: P, cond: (nodes: readonly Data<P>[], rest: string) => boolean): P;
|
|
5
6
|
//export function contract<N>(patterns: string | RegExp | (string | RegExp)[], parser: Parser<N>, cond: (nodes: readonly N[], rest: string) => boolean): Parser<N> {
|
|
@@ -10,8 +11,8 @@ export function validate<P extends Parser>(pattern: string | RegExp, parser: P):
|
|
|
10
11
|
export function validate<P extends Parser>(cond: ((input: Input<Parser.Context<P>>) => boolean), parser: P): P;
|
|
11
12
|
export function validate<N>(pattern: string | RegExp | ((input: Input<Context>) => boolean), parser: Parser<N>): Parser<N> {
|
|
12
13
|
if (typeof pattern === 'function') return guard(pattern, parser);
|
|
13
|
-
const
|
|
14
|
-
return input =>
|
|
14
|
+
const test = tester(pattern, false);
|
|
15
|
+
return input => test(input) && parser(input);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
function guard<P extends Parser>(f: (input: Input<Parser.Context<P>>) => boolean, parser: P): P;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Parser, input, failsafe } from '../../data/parser';
|
|
2
|
-
import { matcher } from '
|
|
2
|
+
import { matcher } from '../../data/delimiter';
|
|
3
3
|
|
|
4
4
|
export function focus<P extends Parser>(scope: string | RegExp, parser: P, slice?: boolean): P;
|
|
5
5
|
export function focus<N>(scope: string | RegExp, parser: Parser<N>, slice = true): Parser<N> {
|