securemark 0.294.10 → 0.294.11

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.294.11
4
+
5
+ - Refactoring.
6
+
3
7
  ## 0.294.10
4
8
 
5
9
  - Refactoring.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! securemark v0.294.10 https://github.com/falsandtru/securemark | (c) 2017, falsandtru | UNLICENSED License */
1
+ /*! securemark v0.294.11 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"));
@@ -4402,7 +4402,7 @@ function normalize(source) {
4402
4402
  }
4403
4403
  exports.normalize = normalize;
4404
4404
  function format(source) {
4405
- return source.replace(/\r\n?/g, '\n');
4405
+ return source.replace(/\r\n?|[\u2028\u2029]/g, '\n');
4406
4406
  }
4407
4407
  const invalid = new RegExp([/(?![\t\r\n])[\x00-\x1F\x7F]/g.source, /(?!\u200D)[\u2006\u200B-\u200F\u202A-\u202F\u2060\uFEFF]/g.source
4408
4408
  // 後読みが重い
@@ -6001,9 +6001,9 @@ const source_1 = __webpack_require__(8745);
6001
6001
  const util_1 = __webpack_require__(4992);
6002
6002
  const normalize_1 = __webpack_require__(4490);
6003
6003
  const dom_1 = __webpack_require__(394);
6004
- exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\r?\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
6004
+ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *\n(?=\S)/y, (0, combinator_1.inits)([(0, combinator_1.block)((0, combinator_1.union)([(0, combinator_1.validate)(({
6005
6005
  context
6006
- }) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1 *(?:$|\r?\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
6006
+ }) => context.header ?? true, (0, combinator_1.focus)(/(---+) *\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1 *(?:$|\n)/y, (0, combinator_1.convert)(source => (0, normalize_1.normalize)(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))), (0, combinator_1.fmap)((0, combinator_1.some)((0, combinator_1.union)([field])), ns => new parser_1.List([new parser_1.Data((0, dom_1.html)('aside', {
6007
6007
  class: 'header'
6008
6008
  }, [(0, dom_1.html)('details', {
6009
6009
  open: ''
@@ -6020,7 +6020,7 @@ exports.header = (0, combinator_1.lazy)(() => (0, combinator_1.validate)(/---+ *
6020
6020
  translate: 'no',
6021
6021
  ...(0, util_1.invalid)('header', 'syntax', 'Invalid syntax')
6022
6022
  }, (0, normalize_1.normalize)(source.slice(position))))]);
6023
- }])), (0, combinator_1.clear)((0, source_1.str)(/ *\r?\n/y))])));
6023
+ }])), (0, combinator_1.clear)((0, source_1.str)(/ *\n/y))])));
6024
6024
  const field = (0, combinator_1.line)(({
6025
6025
  context: {
6026
6026
  source,
@@ -6202,7 +6202,7 @@ const inline_1 = __webpack_require__(7973);
6202
6202
  const visibility_1 = __webpack_require__(6364);
6203
6203
  const util_1 = __webpack_require__(4992);
6204
6204
  const dom_1 = __webpack_require__(394);
6205
- 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, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6205
+ 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, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ')', [[')', 1]])))), '))', false, [1 | 0 /* Backtrack.common */, 3 | 64 /* Backtrack.doublebracket */], ([, ns], context) => context.linebreak === 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', {
6206
6206
  class: 'annotation'
6207
6207
  }, [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]) : undefined)));
6208
6208
 
@@ -6285,9 +6285,9 @@ const source_1 = __webpack_require__(8745);
6285
6285
  const dom_1 = __webpack_require__(394);
6286
6286
  // https://example/@user must be a user page or a redirect page going there.
6287
6287
  // https://example/@user?ch=a+b must be a user channel page or a redirect page going there.
6288
- exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6288
+ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)((0, combinator_1.surround)(/(?<![0-9a-z])@/yi, (0, source_1.str)(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi), (0, source_1.str)(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi), false, [3 | 4 /* Backtrack.unescapable */]), (0, combinator_1.some)((0, combinator_1.surround)('#', (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), ([{
6289
6289
  value
6290
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */])), '', false, [], ([[{
6290
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), false, [3 | 4 /* Backtrack.unescapable */])), '', false, [], ([[{
6291
6291
  value: host
6292
6292
  }, {
6293
6293
  value: account
@@ -6307,7 +6307,7 @@ exports.account = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /*
6307
6307
  value: account
6308
6308
  }]], context) => {
6309
6309
  if (context.source[context.position] === '#') {
6310
- return void (0, combinator_1.setBacktrack)(context, [2 | 0 /* Backtrack.autolink */], context.position - context.range);
6310
+ return void (0, combinator_1.setBacktrack)(context, [2 | 4 /* Backtrack.unescapable */], context.position - context.range);
6311
6311
  }
6312
6312
  return new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`@${host}${account}`)]), new parser_1.List([new parser_1.Data(host ? `https://${host}@${account}` : `/@${account}`)]), context), {
6313
6313
  class: 'account'
@@ -6338,7 +6338,7 @@ const dom_1 = __webpack_require__(394);
6338
6338
  // cid: YYYY-MMDD-HHMM-SSmmm
6339
6339
  // 内部表現はUnixTimeに統一する(時系列順)
6340
6340
  // 外部表現は投稿ごとに投稿者の投稿時のタイムゾーンに統一する(非時系列順)
6341
- exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 0 /* Backtrack.autolink */], ([, [{
6341
+ exports.anchor = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z])>>/yi, (0, source_1.str)(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi), '', false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6342
6342
  value
6343
6343
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`>>${value}`)]), new parser_1.List([new parser_1.Data(`?at=${value}`)]), context), {
6344
6344
  class: 'anchor'
@@ -6363,7 +6363,7 @@ const dom_1 = __webpack_require__(394);
6363
6363
  // https://html.spec.whatwg.org/multipage/input.html
6364
6364
  exports.email = (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(/(?<![0-9a-z][_.+-]?|[@#])(?=[0-9a-z])/yi, (0, combinator_1.verify)((0, source_1.str)(/[0-9a-z](?:[_.+-](?=[0-9a-z])|[0-9a-z]){0,63}@[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}(?![.-]?[0-9a-z@#]|>>|:\S)/yi), ([{
6365
6365
  value
6366
- }]) => value.length <= 254), '', false, [3 | 0 /* Backtrack.autolink */], ([, [{
6366
+ }]) => value.length <= 254), '', false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6367
6367
  value
6368
6368
  }]]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6369
6369
  class: 'email',
@@ -6388,7 +6388,7 @@ const link_1 = __webpack_require__(3628);
6388
6388
  const hashtag_1 = __webpack_require__(5764);
6389
6389
  const source_1 = __webpack_require__(8745);
6390
6390
  const dom_1 = __webpack_require__(394);
6391
- exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false, [1 | 0 /* Backtrack.autolink */], ([, [{
6391
+ exports.hashnum = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu'), (0, source_1.str)(new RegExp([/[0-9]{1,9}(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, hashtag_1.emoji.source), 'yu')), '', false, [1 | 4 /* Backtrack.unescapable */], ([, [{
6392
6392
  value
6393
6393
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(value)]), context), {
6394
6394
  class: 'hashnum',
@@ -6417,7 +6417,7 @@ const dom_1 = __webpack_require__(394);
6417
6417
  exports.emoji = /\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F|\u200D/u;
6418
6418
  exports.hashtag = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, (0, combinator_1.surround)(new RegExp([/(?<![^\p{C}\p{S}\p{P}\s]|emoji)#/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), (0, combinator_1.verify)((0, source_1.str)(new RegExp([/(?!['_])(?:[^\p{C}\p{S}\p{P}\s]|emoji|'(?=[0-9A-Za-z])|_(?=[^\p{C}\p{S}\p{P}\s]|emoji))+/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu')), ([{
6419
6419
  value
6420
- }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 0 /* Backtrack.autolink */], ([, [{
6420
+ }]) => /^[0-9]{0,4}[^0-9]/.test(value)), new RegExp([/(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source].join('|').replace(/emoji/g, exports.emoji.source), 'yu'), false, [3 | 4 /* Backtrack.unescapable */], ([, [{
6421
6421
  value
6422
6422
  }]], context) => new parser_1.List([new parser_1.Data((0, dom_1.define)((0, link_1.parse)(new parser_1.List([new parser_1.Data(`#${value}`)]), new parser_1.List([new parser_1.Data(`/hashtags/${value}`)]), context), {
6423
6423
  class: 'hashtag'
@@ -6440,7 +6440,7 @@ const combinator_1 = __webpack_require__(3484);
6440
6440
  const inline_1 = __webpack_require__(7973);
6441
6441
  const link_1 = __webpack_require__(3628);
6442
6442
  const source_1 = __webpack_require__(8745);
6443
- exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 0 /* Backtrack.autolink */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6443
+ exports.url = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.open)(/(?<![0-9A-Za-z][.+-]?|[@#])https?:\/\/(?=[\x21-\x7E])/y, (0, combinator_1.precedence)(0, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.unescsource, /(?<![-+*=~^_,.;:!?]|\/{3})(?:[-+*=~^_,.;:!?]|\/{3,}(?!\/))*(?=[\\$"`\[\](){}<>()[]{}|]|[^\x21-\x7E]|$)/y), (0, combinator_1.precedence)(1, (0, combinator_1.verify)(bracket, ns => ns.length > 0))]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])), false, [3 | 4 /* Backtrack.unescapable */]), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
6444
6444
  context
6445
6445
  }) => new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(context.source)]), context))]))), (0, combinator_1.open)((0, source_1.str)(/[^:]+/y), (0, combinator_1.some)(inline_1.inline))])));
6446
6446
  exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\r\n])!?https?:\/\/\S+(?=[^\S\n]*(?=$|\n))/y, (0, combinator_1.tails)([(0, source_1.str)('!'), (0, combinator_1.union)([(0, combinator_1.constraint)(1 /* State.autolink */, (0, combinator_1.state)(1 /* State.autolink */, ({
@@ -6455,7 +6455,7 @@ exports.lineurl = (0, combinator_1.lazy)(() => (0, combinator_1.focus)(/(?<=^|[\
6455
6455
  context.position += range;
6456
6456
  return new parser_1.List([new parser_1.Data((0, link_1.parse)(new parser_1.List(), new parser_1.List([new parser_1.Data(source.slice(position, context.position))]), context))]);
6457
6457
  })), (0, source_1.str)(/[^:]+/y)])]), false));
6458
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 0 /* Backtrack.autolink */], undefined, () => new parser_1.List())]));
6458
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ')')), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), ']')), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.unescsource]), '}')), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.unescsource, '"'))), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.unescapable */], undefined, () => new parser_1.List())]));
6459
6459
 
6460
6460
  /***/ },
6461
6461
 
@@ -6502,7 +6502,7 @@ exports.bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([input =>
6502
6502
  return d1(input);
6503
6503
  }
6504
6504
  }]));
6505
- const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = new parser_1.List(), cs], {
6505
+ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 0 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], {
6506
6506
  source,
6507
6507
  position,
6508
6508
  range = 0
@@ -6512,7 +6512,7 @@ const p1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6512
6512
  class: 'paren'
6513
6513
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6514
6514
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6515
- const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = [], cs], {
6515
+ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ')', [[')', 1]]))), (0, source_1.str)(')'), true, [2 | 0 /* Backtrack.common */], ([as, bs = [], cs], {
6516
6516
  source,
6517
6517
  position,
6518
6518
  range = 0
@@ -6522,7 +6522,7 @@ const p2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6522
6522
  class: 'paren'
6523
6523
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]);
6524
6524
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6525
- const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 64 /* Backtrack.bracket */], ([as, bs = new parser_1.List(), cs], context) => {
6525
+ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 0 /* Backtrack.common */], ([as, bs = new parser_1.List(), cs], context) => {
6526
6526
  if (context.state & 8 /* State.link */) {
6527
6527
  const {
6528
6528
  source,
@@ -6530,16 +6530,18 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6530
6530
  range = 0
6531
6531
  } = context;
6532
6532
  const head = position - range;
6533
- if (context.linebreak !== 0 || source[position] !== '{') {
6534
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
6533
+ if (context.linebreak !== 0) {
6534
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
6535
+ } else if (source[position] !== '{') {
6536
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6535
6537
  } else {
6536
6538
  context.state ^= 8 /* State.link */;
6537
- const result = !(0, combinator_1.isBacktrack)(context, [1 | 16 /* Backtrack.link */]) ? (0, link_1.textlink)({
6539
+ const result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
6538
6540
  context
6539
6541
  }) : undefined;
6540
6542
  context.position = position;
6541
6543
  if (!result) {
6542
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
6544
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
6543
6545
  }
6544
6546
  context.state ^= 8 /* State.link */;
6545
6547
  context.range = range;
@@ -6547,12 +6549,12 @@ const s1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.
6547
6549
  }
6548
6550
  return as.import(bs).import(cs);
6549
6551
  }, ([as, bs = new parser_1.List()]) => as.import(bs)));
6550
- const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6551
- const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6552
- const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6552
+ const s2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))), (0, source_1.str)(']'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6553
+ const c1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6554
+ const c2 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, '}', [['}', 1]]))), (0, source_1.str)('}'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6553
6555
  const d1 = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('"'),
6554
6556
  // 改行の優先度を構文ごとに変える場合シグネチャの優先度対応が必要
6555
- (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [2 | 64 /* Backtrack.bracket */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6557
+ (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(5 /* Recursion.bracket */, (0, combinator_1.some)(inline_1.inline, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [2 | 0 /* Backtrack.common */], undefined, ([as, bs = new parser_1.List()]) => as.import(bs)));
6556
6558
 
6557
6559
  /***/ },
6558
6560
 
@@ -6808,7 +6810,7 @@ const source_1 = __webpack_require__(8745);
6808
6810
  const visibility_1 = __webpack_require__(6364);
6809
6811
  const util_1 = __webpack_require__(4992);
6810
6812
  const dom_1 = __webpack_require__(394);
6811
- 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, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 64 /* Backtrack.bracket */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6813
+ 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, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.inits)([inline_1.inline, exports.signature]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 0 /* Backtrack.common */], ([, bs], context) => context.linebreak === 0 && (0, visibility_1.trimBlankNodeEnd)(bs).length > 0 ? new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
6812
6814
  'data-index': dataindex(bs)
6813
6815
  }, (0, dom_1.defrag)((0, util_1.unwrap)(bs))))]) : undefined, undefined)), ns => {
6814
6816
  if (ns.length === 1) {
@@ -6823,7 +6825,7 @@ exports.index = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(32 /*
6823
6825
  return ns;
6824
6826
  }
6825
6827
  })));
6826
- exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}])/y)]), ']'), /(?=])/y, false, [3 | 64 /* Backtrack.bracket */], ([, ns], context) => {
6828
+ exports.signature = (0, combinator_1.lazy)(() => (0, combinator_1.validate)('|', (0, combinator_1.surround)((0, source_1.str)(/\|(?!\\?\s)/y), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, (0, combinator_1.some)(source_1.txt, /(?:[$"`\[\](){}<>()[]{}|])/y)]), ']'), /(?=])/y, false, [3 | 8 /* Backtrack.escapable */], ([, ns], context) => {
6827
6829
  const index = (0, indexee_1.identity)('index', undefined, ns.foldl((acc, {
6828
6830
  value
6829
6831
  }) => acc + value, ''))?.slice(7);
@@ -7028,7 +7030,7 @@ const source_1 = __webpack_require__(8745);
7028
7030
  const dom_1 = __webpack_require__(394);
7029
7031
  const body = (0, source_1.str)(/\$[A-Za-z]*(?:(?:-[A-Za-z][0-9A-Za-z]*)+|-(?:(?:0|[1-9][0-9]*)\.)*(?:0|[1-9][0-9]*)(?![0-9A-Za-z]))/y);
7030
7032
  exports.segment = (0, combinator_1.clear)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']'), body]));
7031
- exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 64 /* Backtrack.bracket */, 1]), body]), ([{
7033
+ exports.label = (0, combinator_1.constraint)(16 /* State.label */, (0, combinator_1.fmap)((0, combinator_1.union)([(0, combinator_1.surround)('[', body, ']', false, [1 | 0 /* Backtrack.common */]), body]), ([{
7032
7034
  value
7033
7035
  }]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('a', {
7034
7036
  class: 'label',
@@ -7075,7 +7077,7 @@ const dom_1 = __webpack_require__(394);
7075
7077
  // All syntax surrounded by square brackets shouldn't contain line breaks.
7076
7078
  exports.placeholder = (0, combinator_1.lazy)(() => (0, combinator_1.surround)(
7077
7079
  // ^はabbrで使用済みだが^:などのようにして分離使用可能
7078
- (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 64 /* Backtrack.bracket */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7080
+ (0, source_1.str)(/\[[:^|]/y), (0, combinator_1.precedence)(1, (0, combinator_1.recursion)(4 /* Recursion.inline */, (0, visibility_1.tightStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])))), (0, source_1.str)(']'), false, [3 | 0 /* Backtrack.common */], (_, context) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7079
7081
  class: 'invalid',
7080
7082
  ...(0, util_1.invalid)('extension', 'syntax', `Invalid start symbol or linebreak`)
7081
7083
  }, context.source.slice(context.position - context.range, context.position)))]), ([as, bs]) => bs && as.import(bs)));
@@ -7189,7 +7191,7 @@ const combinator_1 = __webpack_require__(3484);
7189
7191
  const source_1 = __webpack_require__(8745);
7190
7192
  const util_1 = __webpack_require__(4992);
7191
7193
  const dom_1 = __webpack_require__(394);
7192
- exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 64 /* Backtrack.bracket */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7194
+ exports.unsafehtmlentity = (0, combinator_1.surround)((0, source_1.str)('&'), (0, source_1.str)(/[0-9A-Za-z]+/y), (0, source_1.str)(';'), false, [3 | 4 /* Backtrack.unescapable */], ([as, bs, cs]) => new parser_1.List([new parser_1.Data(parser(as.head.value + bs.head.value + cs.head.value))]), ([as, bs]) => new parser_1.List([new parser_1.Data(as.head.value + (bs?.head?.value ?? ''))]));
7193
7195
  exports.htmlentity = (0, combinator_1.fmap)((0, combinator_1.union)([exports.unsafehtmlentity]), ([{
7194
7196
  value
7195
7197
  }]) => new parser_1.List([length === 1 || value.at(-1) !== ';' ? new parser_1.Data(value) : new parser_1.Data((0, dom_1.html)('span', {
@@ -7278,15 +7280,16 @@ const optspec = {
7278
7280
  rel: ['nofollow']
7279
7281
  };
7280
7282
  Object.setPrototypeOf(optspec, null);
7281
- exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 64 /* Backtrack.bracket */, 3 | 16 /* Backtrack.link */, 2 | 8 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns : undefined)),
7283
+ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /* State.link */, (0, combinator_1.precedence)(1, (0, combinator_1.state)(251 /* State.linkers */, (0, combinator_1.bind)((0, combinator_1.subsequence)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, visibility_1.trimBlankStart)((0, combinator_1.some)((0, combinator_1.union)([inline_1.inline]), ']', [[']', 1]])), ']', true, [3 | 0 /* Backtrack.common */, 3 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7284
+ if (context.linebreak !== 0) {
7285
+ const head = context.position - context.range;
7286
+ return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7287
+ }
7288
+ return ns.push(new parser_1.Data("\u001F" /* Command.Separator */)) && ns;
7289
+ })),
7282
7290
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
7283
7291
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
7284
- (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
7285
- if (!bs) return;
7286
- const head = context.position - context.range;
7287
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7288
- return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7289
- }))]), ([{
7292
+ (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([exports.uri, (0, combinator_1.some)(exports.option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as))]), ([{
7290
7293
  value: content
7291
7294
  }, {
7292
7295
  value: params = undefined
@@ -7295,7 +7298,7 @@ exports.textlink = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(8 /
7295
7298
  content.pop();
7296
7299
  if (params === undefined) {
7297
7300
  const head = context.position - context.range;
7298
- return void (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7301
+ return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7299
7302
  }
7300
7303
  } else {
7301
7304
  params = content;
@@ -7460,7 +7463,7 @@ const source_1 = __webpack_require__(8745);
7460
7463
  const util_1 = __webpack_require__(4992);
7461
7464
  const dom_1 = __webpack_require__(394);
7462
7465
  const forbiddenCommand = /\\(?:begin|tiny|huge|large)(?![a-z])|:\/\//i;
7463
- exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 64 /* Backtrack.bracket */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, [3 | 64 /* Backtrack.bracket */])]), ({
7466
+ exports.math = (0, combinator_1.lazy)(() => (0, combinator_1.rewrite)((0, combinator_1.union)([(0, combinator_1.surround)(/\$(?={)/y, (0, combinator_1.precedence)(4, bracket), '$', false, [3 | 8 /* Backtrack.escapable */]), (0, combinator_1.surround)(/\$(?![\s{}])/y, (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([(0, combinator_1.some)(source_1.escsource, /\s?\$|[`"{}\n]/y), (0, combinator_1.precedence)(4, bracket)]))), /\$(?![-0-9A-Za-z])/y, false, [3 | 8 /* Backtrack.escapable */])]), ({
7464
7467
  context: {
7465
7468
  source,
7466
7469
  caches: {
@@ -7506,12 +7509,13 @@ const optspec = {
7506
7509
  rel: undefined
7507
7510
  };
7508
7511
  Object.setPrototypeOf(optspec, null);
7509
- exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 4 /* Backtrack.escbracket */], ([, ns = new parser_1.List()], context) => context.linebreak === 0 ? ns : undefined)), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [3 | 16 /* Backtrack.link */], undefined, ([as, bs], context) => {
7510
- if (!bs) return;
7511
- const head = context.position - context.range;
7512
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7513
- return as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as;
7514
- }))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7512
+ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* State.media */, (0, combinator_1.open)('!', (0, combinator_1.bind)((0, combinator_1.fmap)((0, combinator_1.tails)([(0, combinator_1.dup)((0, combinator_1.surround)('[', (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']')), ']', true, [3 | 8 /* Backtrack.escapable */, 2 | 16 /* Backtrack.ruby */], ([, ns = new parser_1.List()], context) => {
7513
+ if (context.linebreak !== 0) {
7514
+ const head = context.position - context.range;
7515
+ return void (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head);
7516
+ }
7517
+ return ns;
7518
+ })), (0, combinator_1.dup)((0, combinator_1.surround)(/{(?![{}])/y, (0, combinator_1.inits)([link_1.uri, (0, combinator_1.some)(option)]), / ?}/y, false, [], undefined, ([as, bs]) => bs && as.import(bs).push(new parser_1.Data("\u0018" /* Command.Cancel */)) && as))]), nodes => nodes.length === 1 ? new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data('')])), nodes.delete(nodes.head)]) : new parser_1.List([new parser_1.Data(new parser_1.List([new parser_1.Data(nodes.head.value.foldl((acc, {
7515
7519
  value
7516
7520
  }) => acc + value, ''))])), nodes.delete(nodes.last)])), ([{
7517
7521
  value: [{
@@ -7557,7 +7561,7 @@ exports.media = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(4 /* S
7557
7561
  target: '_blank'
7558
7562
  }, [el]))]);
7559
7563
  }))));
7560
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List())])));
7564
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ')'), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), ']'), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, bracket, source_1.txt]), '}'), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.some)((0, combinator_1.union)([htmlentity_1.unsafehtmlentity, source_1.txt]), '"')), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List())])));
7561
7565
  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, [], ([[{
7562
7566
  value: a
7563
7567
  }], [{
@@ -7611,7 +7615,7 @@ const source_1 = __webpack_require__(8745);
7611
7615
  const visibility_1 = __webpack_require__(6364);
7612
7616
  const util_1 = __webpack_require__(4992);
7613
7617
  const dom_1 = __webpack_require__(394);
7614
- exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [1 | 64 /* Backtrack.bracket */, 3 | 32 /* Backtrack.doublebracket */], ([, ns], context) => {
7618
+ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64 /* State.reference */, (0, combinator_1.surround)((0, source_1.str)('[['), (0, combinator_1.precedence)(1, (0, combinator_1.state)(128 /* State.annotation */ | 64 /* State.reference */, (0, combinator_1.subsequence)([abbr, (0, visibility_1.trimBlankStart)((0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]))]))), ']]', false, [1 | 0 /* Backtrack.common */, 3 | 64 /* Backtrack.doublebracket */], ([, ns], context) => {
7615
7619
  const {
7616
7620
  position,
7617
7621
  range = 0,
@@ -7621,7 +7625,7 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7621
7625
  return new parser_1.List([new parser_1.Data((0, dom_1.html)('sup', attributes(ns), [(0, dom_1.html)('span', (0, dom_1.defrag)((0, util_1.unwrap)((0, visibility_1.trimBlankNodeEnd)(ns))))]))]);
7622
7626
  } else {
7623
7627
  const head = position - range;
7624
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
7628
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head, 2);
7625
7629
  }
7626
7630
  }, ([as, bs], context) => {
7627
7631
  if (!bs) return;
@@ -7634,9 +7638,9 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7634
7638
  } = context;
7635
7639
  const head = position - range;
7636
7640
  if (source[position] !== ']') {
7637
- (0, combinator_1.setBacktrack)(context, [2 | 64 /* Backtrack.bracket */], head, 2);
7641
+ (0, combinator_1.setBacktrack)(context, [2 | 0 /* Backtrack.common */], head, 2);
7638
7642
  } else if (linebreak !== 0) {
7639
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head, 2);
7643
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */, 2 | 16 /* Backtrack.ruby */], head, 2);
7640
7644
  } else {
7641
7645
  if (state & 128 /* State.annotation */) {
7642
7646
  bs.push(new parser_1.Data(source[position]));
@@ -7644,23 +7648,23 @@ exports.reference = (0, combinator_1.lazy)(() => (0, combinator_1.constraint)(64
7644
7648
  context.position += 1;
7645
7649
  let result;
7646
7650
  if (source[context.position] !== '{') {
7647
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7651
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7648
7652
  result = new parser_1.List();
7649
7653
  } else {
7650
- result = !(0, combinator_1.isBacktrack)(context, [1 | 16 /* Backtrack.link */]) ? (0, link_1.textlink)({
7654
+ result = !(0, combinator_1.isBacktrack)(context, [1 | 32 /* Backtrack.link */]) ? (0, link_1.textlink)({
7651
7655
  context
7652
7656
  }) : undefined;
7653
7657
  context.range = range;
7654
7658
  if (!result) {
7655
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head + 1);
7659
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head + 1);
7656
7660
  result = new parser_1.List();
7657
7661
  }
7658
7662
  }
7659
7663
  if (context.position === source.length) {
7660
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7664
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7661
7665
  } else {
7662
7666
  const next = (0, combinator_1.surround)('', (0, combinator_1.some)(inline_1.inline, ']', [[']', 1]]), (0, source_1.str)(']'), true, [], ([, cs = new parser_1.List(), ds]) => cs.import(ds), ([, cs = new parser_1.List()]) => {
7663
- (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.link */], head);
7667
+ (0, combinator_1.setBacktrack)(context, [2 | 32 /* Backtrack.link */], head);
7664
7668
  return cs;
7665
7669
  })({
7666
7670
  context
@@ -7758,17 +7762,17 @@ const source_1 = __webpack_require__(8745);
7758
7762
  const visibility_1 = __webpack_require__(6364);
7759
7763
  const util_1 = __webpack_require__(4992);
7760
7764
  const dom_1 = __webpack_require__(394);
7761
- exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */], ([, ns]) => {
7765
+ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinator_1.inits)([(0, combinator_1.dup)((0, combinator_1.surround)('[', text, ']', false, [1 | 0 /* Backtrack.common */, 3 | 16 /* Backtrack.ruby */], ([, ns]) => {
7762
7766
  ns && ns.last?.value === '' && ns.pop();
7763
7767
  return (0, visibility_1.isTightNodeStart)(ns) ? ns : undefined;
7764
- })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [1 | 64 /* Backtrack.bracket */, 3 | 8 /* Backtrack.ruby */]))]), ([{
7768
+ })), (0, combinator_1.dup)((0, combinator_1.surround)('(', text, ')', false, [1 | 0 /* Backtrack.common */, 3 | 16 /* Backtrack.ruby */]))]), ([{
7765
7769
  value: texts
7766
7770
  }, {
7767
7771
  value: rubies = undefined
7768
7772
  } = {}], context) => {
7769
7773
  if (rubies === undefined) {
7770
7774
  const head = context.position - context.range;
7771
- return void (0, combinator_1.setBacktrack)(context, [2 | 8 /* Backtrack.ruby */], head);
7775
+ return void (0, combinator_1.setBacktrack)(context, [2 | 16 /* Backtrack.ruby */], head);
7772
7776
  }
7773
7777
  switch (true) {
7774
7778
  case texts.length >= rubies.length:
@@ -7791,7 +7795,7 @@ exports.ruby = (0, combinator_1.lazy)(() => (0, combinator_1.bind)((0, combinato
7791
7795
  }, acc) => value + ' ' + acc, '').trim())), new parser_1.Data((0, dom_1.html)('rp', ')'))])))))]);
7792
7796
  }
7793
7797
  }));
7794
- const delimiter = /[$"`\[\](){}<>()[]{}]|\\?\n/y;
7798
+ const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
7795
7799
  const text = input => {
7796
7800
  const {
7797
7801
  context
@@ -7900,13 +7904,13 @@ const combinator_1 = __webpack_require__(3484);
7900
7904
  const source_1 = __webpack_require__(8745);
7901
7905
  const util_1 = __webpack_require__(4992);
7902
7906
  const dom_1 = __webpack_require__(394);
7903
- exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [3 | 32 /* Backtrack.doublebracket */, 3 | 4 /* Backtrack.escbracket */], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7907
+ exports.template = (0, combinator_1.lazy)(() => (0, combinator_1.surround)((0, source_1.str)('{{'), (0, combinator_1.precedence)(1, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}}'), true, [], ([as, bs = new parser_1.List(), cs]) => new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7904
7908
  class: 'template'
7905
7909
  }, (0, dom_1.defrag)((0, util_1.unwrap)(as.import(bs).import(cs)))))]), ([, bs], context) => bs && new parser_1.List([new parser_1.Data((0, dom_1.html)('span', {
7906
7910
  class: 'invalid',
7907
7911
  ...(0, util_1.invalid)('template', 'syntax', `Missing the closing symbol "}}"`)
7908
7912
  }, context.source.slice(context.position - context.range, context.position)))])));
7909
- const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [3 | 4 /* Backtrack.escbracket */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [3 | 4 /* Backtrack.escbracket */], ([as, bs = new parser_1.List(), cs], context) => context.linebreak === 0 ? as.import(bs).import(cs) : (context.position -= 1, as.import(bs)), ([as, bs]) => bs && as.import(bs))]));
7913
+ const bracket = (0, combinator_1.lazy)(() => (0, combinator_1.union)([(0, combinator_1.surround)((0, source_1.str)('('), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ')')), (0, source_1.str)(')'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('['), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), ']')), (0, source_1.str)(']'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('{'), (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)((0, combinator_1.union)([bracket, source_1.escsource]), '}')), (0, source_1.str)('}'), true, [3 | 8 /* Backtrack.escapable */], undefined, () => new parser_1.List()), (0, combinator_1.surround)((0, source_1.str)('"'), (0, combinator_1.precedence)(2, (0, combinator_1.recursion)(6 /* Recursion.terminal */, (0, combinator_1.some)(source_1.escsource, /["\n]/y, [['"', 2], ['\n', 3]]))), (0, source_1.str)('"'), true, [3 | 8 /* Backtrack.escapable */], undefined, ([as, bs]) => bs && as.import(bs))]));
7910
7914
 
7911
7915
  /***/ },
7912
7916
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "securemark",
3
- "version": "0.294.10",
3
+ "version": "0.294.11",
4
4
  "description": "Secure markdown renderer working on browsers for user input data.",
5
5
  "private": false,
6
6
  "homepage": "https://github.com/falsandtru/securemark",
@@ -13,7 +13,7 @@ describe('Unit: parser/api/body', () => {
13
13
  assert.deepStrictEqual(body('---\na: b\n---\n\n'), '');
14
14
  assert.deepStrictEqual(body('---\na: b\n---\n\n\n'), '\n');
15
15
  assert.deepStrictEqual(body('---\na: b\n---\n\n\na'), '\na');
16
- assert.deepStrictEqual(body('--- \r\na: b \r\n--- \r\n \r\n \r\na'), ' \r\na');
16
+ //assert.deepStrictEqual(body('--- \r\na: b \r\n--- \r\n \r\n \r\na'), ' \r\na');
17
17
  });
18
18
 
19
19
  });
@@ -13,13 +13,13 @@ describe('Unit: parser/api/header', () => {
13
13
  assert.deepStrictEqual(headers('---\na: b\n---\nc'), []);
14
14
  assert.deepStrictEqual(headers('---\r \na: b\n---'), []);
15
15
  assert.deepStrictEqual(headers('---\na:\rb\n---'), []);
16
- assert.deepStrictEqual(headers('---\na: b\r \n---'), []);
16
+ //assert.deepStrictEqual(headers('---\na: b\r \n---'), []);
17
17
  assert.deepStrictEqual(headers('---\n\n---'), []);
18
18
  assert.deepStrictEqual(headers('---\n \n---'), []);
19
19
  assert.deepStrictEqual(headers('---\n-\n---'), []);
20
20
  assert.deepStrictEqual(headers('---\na: b\n---'), ['a: b']);
21
21
  assert.deepStrictEqual(headers('---\na: b\nC: D e\n---\n'), ['a: b', 'C: D e']);
22
- assert.deepStrictEqual(headers('--- \r\na: b \r\n--- \r\n \r\n'), ['a: b']);
22
+ //assert.deepStrictEqual(headers('--- \r\na: b \r\n--- \r\n \r\n'), ['a: b']);
23
23
  });
24
24
 
25
25
  });
@@ -6,6 +6,8 @@ describe('Unit: parser/normalize', () => {
6
6
  assert(normalize('\r') === '\n');
7
7
  assert(normalize('\r\n') === '\n');
8
8
  assert(normalize('\n\r') === '\n\n');
9
+ assert(normalize('\u2028') === '\n');
10
+ assert(normalize('\u2029') === '\n');
9
11
  assert(normalize('\x00') === '\uFFFD');
10
12
  assert(normalize('\x01') === '\uFFFD');
11
13
  assert(normalize('\x02') === '\uFFFD');
@@ -9,7 +9,7 @@ export function normalize(source: string): string {
9
9
  }
10
10
 
11
11
  function format(source: string): string {
12
- return source.replace(/\r\n?/g, '\n');
12
+ return source.replace(/\r\n?|[\u2028\u2029]/g, '\n');
13
13
  }
14
14
 
15
15
  const invalid = new RegExp([
@@ -28,12 +28,15 @@ export const enum Recursion {
28
28
  }
29
29
 
30
30
  export const enum Backtrack {
31
- bracket = 1 << 6,
32
- doublebracket = 1 << 5,
33
- link = 1 << 4,
34
- ruby = 1 << 3,
35
- escbracket = 1 << 2,
36
- autolink = 0 << 2,
31
+ // 構文
32
+ doublebracket = 1 << 6,
33
+ link = 1 << 5,
34
+ ruby = 1 << 4,
35
+ // 特殊構造
36
+ escapable = 1 << 3,
37
+ unescapable = 1 << 2,
38
+ // 共通構造
39
+ common = 0 << 2,
37
40
  }
38
41
 
39
42
  export const enum Command {
@@ -17,7 +17,7 @@ describe('Unit: parser/header', () => {
17
17
  assert.deepStrictEqual(inspect(parser('---\na: b\n---\nc'), ctx), undefined);
18
18
  assert.deepStrictEqual(inspect(parser('---\r \na: b\n---'), ctx), undefined);
19
19
  assert.deepStrictEqual(inspect(parser('---\na:\rb\n---'), ctx), [['<pre class="invalid" translate="no">---\na:\nb\n---</pre>'], '']);
20
- assert.deepStrictEqual(inspect(parser('---\na: b\r \n---'), ctx), [['<pre class="invalid" translate="no">---\na: b\n \n---</pre>'], '']);
20
+ //assert.deepStrictEqual(inspect(parser('---\na: b\r \n---'), ctx), [['<pre class="invalid" translate="no">---\na: b\n \n---</pre>'], '']);
21
21
  assert.deepStrictEqual(inspect(parser('---\n\n---'), ctx), undefined);
22
22
  assert.deepStrictEqual(inspect(parser('---\n \n---'), ctx), undefined);
23
23
  assert.deepStrictEqual(inspect(parser('---\n-\n---'), ctx), [['<pre class="invalid" translate="no">---\n-\n---</pre>'], '']);
@@ -30,7 +30,7 @@ describe('Unit: parser/header', () => {
30
30
  assert.deepStrictEqual(inspect(parser('---\na: b\n---'), ctx), [['<aside class="header"><details open=""><summary>Header</summary><span class="field" data-name="a" data-value="b"><span class="field-name">a</span>: <span class="field-value">b</span>\n</span></details></aside>'], '']);
31
31
  assert.deepStrictEqual(inspect(parser('---\na: b\n---\n'), ctx), [['<aside class="header"><details open=""><summary>Header</summary><span class="field" data-name="a" data-value="b"><span class="field-name">a</span>: <span class="field-value">b</span>\n</span></details></aside>'], '']);
32
32
  assert.deepStrictEqual(inspect(parser('---\na: b\nC: D e\n---\n'), ctx), [['<aside class="header"><details open=""><summary>Header</summary><span class="field" data-name="a" data-value="b"><span class="field-name">a</span>: <span class="field-value">b</span>\n</span><span class="field" data-name="c" data-value="D e"><span class="field-name">C</span>: <span class="field-value">D e</span>\n</span></details></aside>'], '']);
33
- assert.deepStrictEqual(inspect(parser('--- \r\na: b \r\n--- \r\n \r\n \r\na'), ctx), [['<aside class="header"><details open=""><summary>Header</summary><span class="field" data-name="a" data-value="b"><span class="field-name">a</span>: <span class="field-value">b</span>\n</span></details></aside>'], ' \r\na']);
33
+ //assert.deepStrictEqual(inspect(parser('--- \r\na: b \r\n--- \r\n \r\n \r\na'), ctx), [['<aside class="header"><details open=""><summary>Header</summary><span class="field" data-name="a" data-value="b"><span class="field-name">a</span>: <span class="field-value">b</span>\n</span></details></aside>'], ' \r\na']);
34
34
  assert.deepStrictEqual(inspect(parser('----\na: b\n----'), ctx), [['<aside class="header"><details open=""><summary>Header</summary><span class="field" data-name="a" data-value="b"><span class="field-name">a</span>: <span class="field-value">b</span>\n</span></details></aside>'], '']);
35
35
  });
36
36
 
@@ -7,12 +7,12 @@ import { normalize } from './api/normalize';
7
7
  import { html, defrag } from 'typed-dom/dom';
8
8
 
9
9
  export const header: MarkdownParser.HeaderParser = lazy(() => validate(
10
- /---+ *\r?\n(?=\S)/y,
10
+ /---+ *\n(?=\S)/y,
11
11
  inits([
12
12
  block(
13
13
  union([
14
14
  validate(({ context }) => context.header ?? true,
15
- focus(/(---+) *\r?\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\r\n]*\r?\n){1,100}\1 *(?:$|\r?\n)/y,
15
+ focus(/(---+) *\n(?:[A-Za-z][0-9A-Za-z]*(?:-[0-9A-Za-z]+)*:[ \t]+\S[^\n]*\n){1,100}\1 *(?:$|\n)/y,
16
16
  convert(source =>
17
17
  normalize(source.slice(source.indexOf('\n') + 1, source.trimEnd().lastIndexOf('\n'))),
18
18
  fmap(
@@ -36,7 +36,7 @@ export const header: MarkdownParser.HeaderParser = lazy(() => validate(
36
36
  ]);
37
37
  },
38
38
  ])),
39
- clear(str(/ *\r?\n/y)),
39
+ clear(str(/ *\n/y)),
40
40
  ])));
41
41
 
42
42
  const field: MarkdownParser.HeaderParser.FieldParser = line(({ context: { source, position } }) => {
@@ -13,7 +13,7 @@ export const annotation: AnnotationParser = lazy(() => constraint(State.annotati
13
13
  trimBlankStart(some(union([inline]), ')', [[')', 1]])))),
14
14
  '))',
15
15
  false,
16
- [1 | Backtrack.bracket, 3 | Backtrack.doublebracket],
16
+ [1 | Backtrack.common, 3 | Backtrack.doublebracket],
17
17
  ([, ns], context) =>
18
18
  context.linebreak === 0
19
19
  ? new List([new Data(html('sup', { class: 'annotation' }, [html('span', defrag(unwrap(trimBlankNodeEnd(ns))))]))])
@@ -17,7 +17,7 @@ export const account: AutolinkParser.AccountParser = lazy(() => constraint(State
17
17
  str(/[0-9a-z](?:[.-](?=[0-9a-z])|[0-9a-z]){0,254}\/|/yi),
18
18
  str(/[a-z][0-9a-z]*(?:[-.][0-9a-z]+)*(?![-.]?[0-9a-z@]|>>|:\S)/yi),
19
19
  false,
20
- [3 | Backtrack.autolink]),
20
+ [3 | Backtrack.unescapable]),
21
21
  some(surround(
22
22
  '#',
23
23
  verify(
@@ -29,7 +29,7 @@ export const account: AutolinkParser.AccountParser = lazy(() => constraint(State
29
29
  /(?![0-9a-z@]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source,
30
30
  ].join('|').replace(/emoji/g, emoji.source), 'yu'),
31
31
  false,
32
- [3 | Backtrack.autolink])),
32
+ [3 | Backtrack.unescapable])),
33
33
  '',
34
34
  false, [],
35
35
  ([[{ value: host }, { value: account }], nodes], context) => {
@@ -47,7 +47,7 @@ export const account: AutolinkParser.AccountParser = lazy(() => constraint(State
47
47
  ([[{ value: host }, { value: account }]], context) => {
48
48
  if (context.source[context.position] === '#') {
49
49
  assert(context.source[context.position - context.range!] === '@');
50
- return void setBacktrack(context, [2 | Backtrack.autolink], context.position - context.range!);
50
+ return void setBacktrack(context, [2 | Backtrack.unescapable], context.position - context.range!);
51
51
  }
52
52
  return new List([
53
53
  new Data(define(
@@ -22,7 +22,7 @@ export const anchor: AutolinkParser.AnchorParser = lazy(() => constraint(State.a
22
22
  str(/[0-9a-z]+(?:-[0-9a-z]+)*(?!-?[0-9a-z@#]|>>|:\S)/yi),
23
23
  '',
24
24
  false,
25
- [3 | Backtrack.autolink],
25
+ [3 | Backtrack.unescapable],
26
26
  ([, [{ value }]], context) =>
27
27
  new List([
28
28
  new Data(define(parse(
@@ -15,6 +15,6 @@ export const email: AutolinkParser.EmailParser = constraint(State.autolink, stat
15
15
  ([{ value }]) => value.length <= 254),
16
16
  '',
17
17
  false,
18
- [3 | Backtrack.autolink],
18
+ [3 | Backtrack.unescapable],
19
19
  ([, [{ value }]]) =>
20
20
  new List([new Data(html('a', { class: 'email', href: `mailto:${value}` }, value))]))));
@@ -17,7 +17,7 @@ export const hashnum: AutolinkParser.HashnumParser = lazy(() => constraint(State
17
17
  ].join('|').replace(/emoji/g, emoji.source), 'yu')),
18
18
  '',
19
19
  false,
20
- [1 | Backtrack.autolink],
20
+ [1 | Backtrack.unescapable],
21
21
  ([, [{ value }]], context) =>
22
22
  new List([
23
23
  new Data(define(parse(
@@ -25,7 +25,7 @@ export const hashtag: AutolinkParser.HashtagParser = lazy(() => constraint(State
25
25
  /(?![0-9a-z@#]|>>|:\S|[^\p{C}\p{S}\p{P}\s]|emoji)/yu.source,
26
26
  ].join('|').replace(/emoji/g, emoji.source), 'yu'),
27
27
  false,
28
- [3 | Backtrack.autolink],
28
+ [3 | Backtrack.unescapable],
29
29
  ([, [{ value }]], context) =>
30
30
  new List([
31
31
  new Data(define(parse(
@@ -14,7 +14,7 @@ export const url: AutolinkParser.UrlParser = lazy(() => rewrite(
14
14
  precedence(1, verify(bracket, ns => ns.length > 0)),
15
15
  ]), undefined, [[/[^\x21-\x7E]|\$/y, 9]])),
16
16
  false,
17
- [3 | Backtrack.autolink]),
17
+ [3 | Backtrack.unescapable]),
18
18
  union([
19
19
  constraint(State.autolink, state(State.autolink, ({ context }) =>
20
20
  new List([new Data(parse(new List(), new List([new Data(context.source)]), context))]))),
@@ -43,11 +43,11 @@ export const lineurl: AutolinkParser.UrlParser.LineUrlParser = lazy(() => focus(
43
43
 
44
44
  const bracket: AutolinkParser.UrlParser.BracketParser = lazy(() => union([
45
45
  surround(str('('), recursion(Recursion.terminal, some(union([bracket, unescsource]), ')')), str(')'),
46
- true, [3 | Backtrack.autolink], undefined, () => new List()),
46
+ true, [3 | Backtrack.unescapable], undefined, () => new List()),
47
47
  surround(str('['), recursion(Recursion.terminal, some(union([bracket, unescsource]), ']')), str(']'),
48
- true, [3 | Backtrack.autolink], undefined, () => new List()),
48
+ true, [3 | Backtrack.unescapable], undefined, () => new List()),
49
49
  surround(str('{'), recursion(Recursion.terminal, some(union([bracket, unescsource]), '}')), str('}'),
50
- true, [3 | Backtrack.autolink], undefined, () => new List()),
50
+ true, [3 | Backtrack.unescapable], undefined, () => new List()),
51
51
  surround(str('"'), precedence(2, recursion(Recursion.terminal, some(unescsource, '"'))), str('"'),
52
- true, [3 | Backtrack.autolink], undefined, () => new List()),
52
+ true, [3 | Backtrack.unescapable], undefined, () => new List()),
53
53
  ]));
@@ -39,7 +39,7 @@ const p1 = lazy(() => surround(
39
39
  precedence(1, recursion(Recursion.bracket, some(inline, ')', [[')', 1]]))),
40
40
  str(')'),
41
41
  true,
42
- [2 | Backtrack.bracket],
42
+ [2 | Backtrack.common],
43
43
  ([as, bs = new List(), cs], { source, position, range = 0 }) => {
44
44
  const str = source.slice(position - range + 1, position - 1);
45
45
  return indexA.test(str)
@@ -53,7 +53,7 @@ const p2 = lazy(() => surround(
53
53
  precedence(1, recursion(Recursion.bracket, some(inline, ')', [[')', 1]]))),
54
54
  str(')'),
55
55
  true,
56
- [2 | Backtrack.bracket],
56
+ [2 | Backtrack.common],
57
57
  ([as, bs = [], cs], { source, position, range = 0 }) => {
58
58
  const str = source.slice(position - range + 1, position - 1);
59
59
  return indexF.test(str)
@@ -67,12 +67,15 @@ const s1 = lazy(() => surround(
67
67
  precedence(1, recursion(Recursion.bracket, some(inline, ']', [[']', 1]]))),
68
68
  str(']'),
69
69
  true,
70
- [2 | Backtrack.bracket],
70
+ [2 | Backtrack.common],
71
71
  ([as, bs = new List(), cs], context) => {
72
72
  if (context.state! & State.link) {
73
73
  const { source, position, range = 0 } = context;
74
74
  const head = position - range;
75
- if (context.linebreak !== 0 || source[position] !== '{') {
75
+ if (context.linebreak !== 0) {
76
+ setBacktrack(context, [2 | Backtrack.link, 2 | Backtrack.ruby], head);
77
+ }
78
+ else if (source[position] !== '{') {
76
79
  setBacktrack(context, [2 | Backtrack.link], head);
77
80
  }
78
81
  else {
@@ -97,7 +100,7 @@ const s2 = lazy(() => surround(
97
100
  precedence(1, recursion(Recursion.bracket, some(inline, ']', [[']', 1]]))),
98
101
  str(']'),
99
102
  true,
100
- [2 | Backtrack.bracket],
103
+ [2 | Backtrack.common],
101
104
  undefined,
102
105
  ([as, bs = new List()]) => as.import(bs as List<Data<string>>)));
103
106
 
@@ -106,7 +109,7 @@ const c1 = lazy(() => surround(
106
109
  precedence(1, recursion(Recursion.bracket, some(inline, '}', [['}', 1]]))),
107
110
  str('}'),
108
111
  true,
109
- [2 | Backtrack.bracket],
112
+ [2 | Backtrack.common],
110
113
  undefined,
111
114
  ([as, bs = new List()]) => as.import(bs as List<Data<string>>)));
112
115
 
@@ -115,7 +118,7 @@ const c2 = lazy(() => surround(
115
118
  precedence(1, recursion(Recursion.bracket, some(inline, '}', [['}', 1]]))),
116
119
  str('}'),
117
120
  true,
118
- [2 | Backtrack.bracket],
121
+ [2 | Backtrack.common],
119
122
  undefined,
120
123
  ([as, bs = new List()]) => as.import(bs as List<Data<string>>)));
121
124
 
@@ -125,6 +128,6 @@ const d1 = lazy(() => surround(
125
128
  precedence(2, recursion(Recursion.bracket, some(inline, /["\n]/y, [['"', 2], ['\n', 3]]))),
126
129
  str('"'),
127
130
  true,
128
- [2 | Backtrack.bracket],
131
+ [2 | Backtrack.common],
129
132
  undefined,
130
133
  ([as, bs = new List()]) => as.import(bs as List<Data<string>>)));
@@ -22,7 +22,7 @@ export const index: IndexParser = lazy(() => constraint(State.index, fmap(indexe
22
22
  ]), ']', [[']', 1]])))),
23
23
  str(']'),
24
24
  false,
25
- [3 | Backtrack.bracket],
25
+ [3 | Backtrack.common],
26
26
  ([, bs], context) =>
27
27
  context.linebreak === 0 && trimBlankNodeEnd(bs).length > 0
28
28
  ? new List([new Data(html('a', { 'data-index': dataindex(bs) }, defrag(unwrap(bs))))])
@@ -50,11 +50,11 @@ export const signature: IndexParser.SignatureParser = lazy(() => validate('|', s
50
50
  str(/\|(?!\\?\s)/y),
51
51
  some(union([
52
52
  unsafehtmlentity,
53
- some(txt, /(?:[$"`\[\](){}<>()[]{}])/y),
53
+ some(txt, /(?:[$"`\[\](){}<>()[]{}|])/y),
54
54
  ]), ']'),
55
55
  /(?=])/y,
56
56
  false,
57
- [3 | Backtrack.bracket],
57
+ [3 | Backtrack.escapable],
58
58
  ([, ns], context) => {
59
59
  const index = identity('index', undefined, ns.foldl((acc, { value }) => acc + value, ''))?.slice(7);
60
60
  return index && context.linebreak === 0
@@ -14,7 +14,7 @@ export const segment: ExtensionParser.LabelParser.SegmentParser = clear(union([
14
14
 
15
15
  export const label: ExtensionParser.LabelParser = constraint(State.label, fmap(
16
16
  union([
17
- surround('[', body, ']', false, [1 | Backtrack.bracket, 1]),
17
+ surround('[', body, ']', false, [1 | Backtrack.common]),
18
18
  body,
19
19
  ]),
20
20
  ([{ value }]) => new List([
@@ -19,7 +19,7 @@ export const placeholder: ExtensionParser.PlaceholderParser = lazy(() => surroun
19
19
  tightStart(some(union([inline]), ']', [[']', 1]])))),
20
20
  str(']'),
21
21
  false,
22
- [3 | Backtrack.bracket],
22
+ [3 | Backtrack.common],
23
23
  (_, context) => new List([
24
24
  new Data(html('span',
25
25
  {
@@ -9,7 +9,7 @@ import { html } from 'typed-dom/dom';
9
9
  export const unsafehtmlentity: UnsafeHTMLEntityParser = surround(
10
10
  str('&'), str(/[0-9A-Za-z]+/y), str(';'),
11
11
  false,
12
- [3 | Backtrack.bracket],
12
+ [3 | Backtrack.unescapable],
13
13
  ([as, bs, cs]) =>
14
14
  new List([new Data(parser(as.head!.value + bs.head!.value + cs.head!.value))]),
15
15
  ([as, bs]) =>
@@ -24,26 +24,24 @@ export const textlink: LinkParser.TextLinkParser = lazy(() => constraint(State.l
24
24
  trimBlankStart(some(union([inline]), ']', [[']', 1]])),
25
25
  ']',
26
26
  true,
27
- [3 | Backtrack.bracket, 3 | Backtrack.link, 2 | Backtrack.ruby],
28
- ([, ns = new List()], context) =>
29
- context.linebreak === 0
30
- ? ns.push(new Data(Command.Separator)) && ns
31
- : undefined)),
27
+ [3 | Backtrack.common, 3 | Backtrack.link, 2 | Backtrack.ruby],
28
+ ([, ns = new List()], context) => {
29
+ if (context.linebreak !== 0) {
30
+ const head = context.position - context.range!;
31
+ return void setBacktrack(context, [2 | Backtrack.link, 2 | Backtrack.ruby], head);
32
+ }
33
+ return ns.push(new Data(Command.Separator)) && ns;
34
+ })),
32
35
  // `{ `と`{`で個別にバックトラックが発生し+1nされる。
33
36
  // 自己再帰的にパースしてもオプションの不要なパースによる計算量の増加により相殺される。
34
37
  dup(surround(
35
38
  /{(?![{}])/y,
36
39
  inits([uri, some(option)]),
37
40
  / ?}/y,
38
- false,
39
- [3 | Backtrack.link],
41
+ false, [],
40
42
  undefined,
41
- ([as, bs], context) => {
42
- if (!bs) return;
43
- const head = context.position - context.range!;
44
- setBacktrack(context, [2 | Backtrack.link], head);
45
- return as.import(bs).push(new Data(Command.Cancel)) && as;
46
- })),
43
+ ([as, bs]) =>
44
+ bs && as.import(bs).push(new Data(Command.Cancel)) && as)),
47
45
  ]),
48
46
  ([{ value: content }, { value: params = undefined } = {}], context) => {
49
47
  if (content.last!.value === Command.Separator) {
@@ -15,7 +15,7 @@ export const math: MathParser = lazy(() => rewrite(
15
15
  precedence(4, bracket),
16
16
  '$',
17
17
  false,
18
- [3 | Backtrack.bracket]),
18
+ [3 | Backtrack.escapable]),
19
19
  surround(
20
20
  /\$(?![\s{}])/y,
21
21
  precedence(2, some(union([
@@ -24,7 +24,7 @@ export const math: MathParser = lazy(() => rewrite(
24
24
  ]))),
25
25
  /\$(?![-0-9A-Za-z])/y,
26
26
  false,
27
- [3 | Backtrack.bracket]),
27
+ [3 | Backtrack.escapable]),
28
28
  ]),
29
29
  ({ context: { source, caches: { math: cache } = {} } }) => new List([
30
30
  new Data(cache?.get(source)?.cloneNode(true) ||
@@ -30,24 +30,22 @@ export const media: MediaParser = lazy(() => constraint(State.media, open(
30
30
  ]), ']')),
31
31
  ']',
32
32
  true,
33
- [3 | Backtrack.escbracket],
34
- ([, ns = new List()], context) =>
35
- context.linebreak === 0
36
- ? ns
37
- : undefined)),
33
+ [3 | Backtrack.escapable, 2 | Backtrack.ruby],
34
+ ([, ns = new List()], context) => {
35
+ if (context.linebreak !== 0) {
36
+ const head = context.position - context.range!;
37
+ return void setBacktrack(context, [2 | Backtrack.link, 2 | Backtrack.ruby], head);
38
+ }
39
+ return ns;
40
+ })),
38
41
  dup(surround(
39
42
  /{(?![{}])/y,
40
43
  inits([uri, some(option)]),
41
44
  / ?}/y,
42
- false,
43
- [3 | Backtrack.link],
45
+ false, [],
44
46
  undefined,
45
- ([as, bs], context) => {
46
- if (!bs) return;
47
- const head = context.position - context.range!;
48
- setBacktrack(context, [2 | Backtrack.link], head);
49
- return as.import(bs).push(new Data(Command.Cancel)) && as;
50
- })),
47
+ ([as, bs]) =>
48
+ bs && as.import(bs).push(new Data(Command.Cancel)) && as)),
51
49
  ]),
52
50
  nodes =>
53
51
  nodes.length === 1
@@ -111,13 +109,13 @@ export const media: MediaParser = lazy(() => constraint(State.media, open(
111
109
 
112
110
  const bracket: MediaParser.TextParser.BracketParser = lazy(() => recursion(Recursion.terminal, union([
113
111
  surround(str('('), some(union([unsafehtmlentity, bracket, txt]), ')'), str(')'),
114
- true, [3 | Backtrack.escbracket], undefined, () => new List()),
112
+ true, [3 | Backtrack.escapable], undefined, () => new List()),
115
113
  surround(str('['), some(union([unsafehtmlentity, bracket, txt]), ']'), str(']'),
116
- true, [3 | Backtrack.escbracket], undefined, () => new List()),
114
+ true, [3 | Backtrack.escapable], undefined, () => new List()),
117
115
  surround(str('{'), some(union([unsafehtmlentity, bracket, txt]), '}'), str('}'),
118
- true, [3 | Backtrack.escbracket], undefined, () => new List()),
116
+ true, [3 | Backtrack.escapable], undefined, () => new List()),
119
117
  surround(str('"'), precedence(2, some(union([unsafehtmlentity, txt]), '"')), str('"'),
120
- true, [3 | Backtrack.escbracket], undefined, () => new List()),
118
+ true, [3 | Backtrack.escapable], undefined, () => new List()),
121
119
  ])));
122
120
 
123
121
  const option: MediaParser.ParameterParser.OptionParser = lazy(() => union([
@@ -18,7 +18,7 @@ export const reference: ReferenceParser = lazy(() => constraint(State.reference,
18
18
  ]))),
19
19
  ']]',
20
20
  false,
21
- [1 | Backtrack.bracket, 3 | Backtrack.doublebracket],
21
+ [1 | Backtrack.common, 3 | Backtrack.doublebracket],
22
22
  ([, ns], context) => {
23
23
  const { position, range = 0, linebreak = 0 } = context;
24
24
  if (linebreak === 0) {
@@ -34,10 +34,10 @@ export const reference: ReferenceParser = lazy(() => constraint(State.reference,
34
34
  const { source, position, range = 0, linebreak = 0, state = 0 } = context;
35
35
  const head = position - range;
36
36
  if (source[position] !== ']') {
37
- setBacktrack(context, [2 | Backtrack.bracket], head, 2);
37
+ setBacktrack(context, [2 | Backtrack.common], head, 2);
38
38
  }
39
39
  else if (linebreak !== 0) {
40
- setBacktrack(context, [2 | Backtrack.link], head, 2);
40
+ setBacktrack(context, [2 | Backtrack.link, 2 | Backtrack.ruby], head, 2);
41
41
  }
42
42
  else {
43
43
  assert(source[position] === ']');
@@ -13,7 +13,7 @@ export const ruby: RubyParser = lazy(() => bind(
13
13
  dup(surround(
14
14
  '[', text, ']',
15
15
  false,
16
- [1 | Backtrack.bracket, 3 | Backtrack.ruby],
16
+ [1 | Backtrack.common, 3 | Backtrack.ruby],
17
17
  ([, ns]) => {
18
18
  ns && ns.last?.value === '' && ns.pop();
19
19
  return isTightNodeStart(ns) ? ns : undefined;
@@ -21,7 +21,7 @@ export const ruby: RubyParser = lazy(() => bind(
21
21
  dup(surround(
22
22
  '(', text, ')',
23
23
  false,
24
- [1 | Backtrack.bracket, 3 | Backtrack.ruby])),
24
+ [1 | Backtrack.common, 3 | Backtrack.ruby])),
25
25
  ]),
26
26
  ([{ value: texts }, { value: rubies = undefined } = {}], context) => {
27
27
  if (rubies === undefined) {
@@ -62,7 +62,7 @@ export const ruby: RubyParser = lazy(() => bind(
62
62
  }
63
63
  }));
64
64
 
65
- const delimiter = /[$"`\[\](){}<>()[]{}]|\\?\n/y;
65
+ const delimiter = /[$"`\[\](){}<>()[]{}|]|\\?\n/y;
66
66
 
67
67
  const text: RubyParser.TextParser = input => {
68
68
  const { context } = input;
@@ -11,8 +11,7 @@ export const template: TemplateParser = lazy(() => surround(
11
11
  precedence(1,
12
12
  some(union([bracket, escsource]), '}')),
13
13
  str('}}'),
14
- true,
15
- [3 | Backtrack.doublebracket, 3 | Backtrack.escbracket],
14
+ true, [],
16
15
  ([as, bs = new List(), cs]) => new List([
17
16
  new Data(html('span', { class: 'template' }, defrag(unwrap(as.import(bs as List<Data<string>>).import(cs)))))
18
17
  ]),
@@ -28,20 +27,17 @@ export const template: TemplateParser = lazy(() => surround(
28
27
 
29
28
  const bracket: TemplateParser.BracketParser = lazy(() => union([
30
29
  surround(str('('), recursion(Recursion.terminal, some(union([bracket, escsource]), ')')), str(')'),
31
- true, [3 | Backtrack.escbracket], undefined, () => new List()),
30
+ true, [3 | Backtrack.escapable], undefined, () => new List()),
32
31
  surround(str('['), recursion(Recursion.terminal, some(union([bracket, escsource]), ']')), str(']'),
33
- true, [3 | Backtrack.escbracket], undefined, () => new List()),
32
+ true, [3 | Backtrack.escapable], undefined, () => new List()),
34
33
  surround(str('{'), recursion(Recursion.terminal, some(union([bracket, escsource]), '}')), str('}'),
35
- true, [3 | Backtrack.escbracket], undefined, () => new List()),
34
+ true, [3 | Backtrack.escapable], undefined, () => new List()),
36
35
  surround(
37
36
  str('"'),
38
37
  precedence(2, recursion(Recursion.terminal, some(escsource, /["\n]/y, [['"', 2], ['\n', 3]]))),
39
38
  str('"'),
40
39
  true,
41
- [3 | Backtrack.escbracket],
42
- ([as, bs = new List(), cs], context) =>
43
- context.linebreak === 0
44
- ? as.import(bs as List<Data<string>>).import(cs)
45
- : (context.position -= 1, as.import(bs as List<Data<string>>)),
40
+ [3 | Backtrack.escapable],
41
+ undefined,
46
42
  ([as, bs]) => bs && as.import(bs as List<Data<string>>)),
47
43
  ]));