@yozora/tokenizer-definition 1.3.0 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +54 -39
- package/lib/esm/index.js +53 -40
- package/lib/types/index.d.ts +4 -4
- package/lib/types/match.d.ts +18 -0
- package/lib/types/parse.d.ts +3 -0
- package/lib/types/tokenizer.d.ts +6 -38
- package/lib/types/types.d.ts +7 -6
- package/lib/types/util/link-destination.d.ts +3 -3
- package/lib/types/util/link-label.d.ts +3 -3
- package/lib/types/util/link-title.d.ts +3 -3
- package/package.json +5 -5
package/lib/cjs/index.js
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var ast = require('@yozora/ast');
|
|
6
5
|
var character = require('@yozora/character');
|
|
7
6
|
var coreTokenizer = require('@yozora/core-tokenizer');
|
|
8
|
-
|
|
9
|
-
const uniqueName = '@yozora/tokenizer-definition';
|
|
7
|
+
var ast = require('@yozora/ast');
|
|
10
8
|
|
|
11
9
|
function eatAndCollectLinkDestination(nodePoints, startIndex, endIndex, state) {
|
|
12
10
|
let i = startIndex;
|
|
@@ -76,8 +74,7 @@ function eatAndCollectLinkDestination(nodePoints, startIndex, endIndex, state) {
|
|
|
76
74
|
}
|
|
77
75
|
break;
|
|
78
76
|
default:
|
|
79
|
-
if (character.isWhitespaceCharacter(p.codePoint) ||
|
|
80
|
-
character.isAsciiControlCharacter(p.codePoint)) {
|
|
77
|
+
if (character.isWhitespaceCharacter(p.codePoint) || character.isAsciiControlCharacter(p.codePoint)) {
|
|
81
78
|
state.saturated = true;
|
|
82
79
|
return { nextIndex: i, state: state };
|
|
83
80
|
}
|
|
@@ -206,8 +203,7 @@ function eatAndCollectLinkTitle(nodePoints, startIndex, endIndex, state) {
|
|
|
206
203
|
case character.AsciiCodePoint.OPEN_PARENTHESIS:
|
|
207
204
|
return { nextIndex: -1, state: state };
|
|
208
205
|
case character.AsciiCodePoint.CLOSE_PARENTHESIS:
|
|
209
|
-
if (i + 1 >= endIndex ||
|
|
210
|
-
nodePoints[i + 1].codePoint === character.VirtualCodePoint.LINE_END) {
|
|
206
|
+
if (i + 1 >= endIndex || nodePoints[i + 1].codePoint === character.VirtualCodePoint.LINE_END) {
|
|
211
207
|
state.nodePoints.push(p);
|
|
212
208
|
state.saturated = true;
|
|
213
209
|
break;
|
|
@@ -223,16 +219,14 @@ function eatAndCollectLinkTitle(nodePoints, startIndex, endIndex, state) {
|
|
|
223
219
|
return { nextIndex: endIndex, state: state };
|
|
224
220
|
}
|
|
225
221
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
}
|
|
235
|
-
eatOpener(line) {
|
|
222
|
+
const match = function (api) {
|
|
223
|
+
return {
|
|
224
|
+
isContainingBlock: false,
|
|
225
|
+
eatOpener,
|
|
226
|
+
eatContinuationText,
|
|
227
|
+
onClose,
|
|
228
|
+
};
|
|
229
|
+
function eatOpener(line) {
|
|
236
230
|
if (line.countOfPrecedeSpaces >= 4)
|
|
237
231
|
return null;
|
|
238
232
|
const { nodePoints, startIndex, endIndex, firstNonWhitespaceIndex } = line;
|
|
@@ -302,7 +296,7 @@ class DefinitionTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
|
302
296
|
token.lineNoOfTitle = lineNo;
|
|
303
297
|
return { token, nextIndex: endIndex };
|
|
304
298
|
}
|
|
305
|
-
eatContinuationText(line, token) {
|
|
299
|
+
function eatContinuationText(line, token) {
|
|
306
300
|
var _a;
|
|
307
301
|
if (token.title != null && token.title.saturated)
|
|
308
302
|
return { status: 'notMatched' };
|
|
@@ -366,7 +360,7 @@ class DefinitionTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
|
366
360
|
const saturated = (_a = token.title) === null || _a === void 0 ? void 0 : _a.saturated;
|
|
367
361
|
return { status: saturated ? 'closing' : 'opening', nextIndex: endIndex };
|
|
368
362
|
}
|
|
369
|
-
onClose(token
|
|
363
|
+
function onClose(token) {
|
|
370
364
|
let result;
|
|
371
365
|
if (token.title == null || !token.title.saturated) {
|
|
372
366
|
if (!token.label.saturated) {
|
|
@@ -394,31 +388,52 @@ class DefinitionTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
|
394
388
|
token._identifier = identifier;
|
|
395
389
|
return result;
|
|
396
390
|
}
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
const parse = function () {
|
|
394
|
+
return {
|
|
395
|
+
parse: token => {
|
|
396
|
+
const label = token._label;
|
|
397
|
+
const identifier = token._identifier;
|
|
398
|
+
const destinationPoints = token.destination.nodePoints;
|
|
399
|
+
const destination = destinationPoints[0].codePoint === character.AsciiCodePoint.OPEN_ANGLE
|
|
400
|
+
? character.calcEscapedStringFromNodePoints(destinationPoints, 1, destinationPoints.length - 1, true)
|
|
401
|
+
: character.calcEscapedStringFromNodePoints(destinationPoints, 0, destinationPoints.length, true);
|
|
402
|
+
const url = coreTokenizer.encodeLinkDestination(destination);
|
|
403
|
+
const title = token.title == null
|
|
404
|
+
? undefined
|
|
405
|
+
: character.calcEscapedStringFromNodePoints(token.title.nodePoints, 1, token.title.nodePoints.length - 1);
|
|
406
|
+
const node = {
|
|
407
|
+
type: ast.DefinitionType,
|
|
408
|
+
identifier,
|
|
409
|
+
label,
|
|
410
|
+
url,
|
|
411
|
+
title,
|
|
412
|
+
};
|
|
413
|
+
return node;
|
|
414
|
+
},
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
const uniqueName = '@yozora/tokenizer-definition';
|
|
419
|
+
|
|
420
|
+
class DefinitionTokenizer extends coreTokenizer.BaseBlockTokenizer {
|
|
421
|
+
constructor(props = {}) {
|
|
422
|
+
var _a, _b;
|
|
423
|
+
super({
|
|
424
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
425
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : coreTokenizer.TokenizerPriority.ATOMIC,
|
|
426
|
+
});
|
|
427
|
+
this.match = match;
|
|
428
|
+
this.parse = parse;
|
|
416
429
|
}
|
|
417
430
|
}
|
|
418
431
|
|
|
419
432
|
exports.DefinitionTokenizer = DefinitionTokenizer;
|
|
420
433
|
exports.DefinitionTokenizerName = uniqueName;
|
|
421
|
-
exports[
|
|
434
|
+
exports["default"] = DefinitionTokenizer;
|
|
435
|
+
exports.definitionMatch = match;
|
|
436
|
+
exports.definitionParse = parse;
|
|
422
437
|
exports.eatAndCollectLinkDestination = eatAndCollectLinkDestination;
|
|
423
438
|
exports.eatAndCollectLinkLabel = eatAndCollectLinkLabel;
|
|
424
439
|
exports.eatAndCollectLinkTitle = eatAndCollectLinkTitle;
|
package/lib/esm/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import { DefinitionType } from '@yozora/ast';
|
|
2
1
|
import { AsciiCodePoint, VirtualCodePoint, isWhitespaceCharacter, isAsciiControlCharacter, calcStringFromNodePoints, calcEscapedStringFromNodePoints } from '@yozora/character';
|
|
3
|
-
import { eatOptionalWhitespaces,
|
|
4
|
-
|
|
5
|
-
const uniqueName = '@yozora/tokenizer-definition';
|
|
2
|
+
import { eatOptionalWhitespaces, calcEndYastNodePoint, resolveLabelToIdentifier, calcStartYastNodePoint, encodeLinkDestination, BaseBlockTokenizer, TokenizerPriority } from '@yozora/core-tokenizer';
|
|
3
|
+
import { DefinitionType } from '@yozora/ast';
|
|
6
4
|
|
|
7
5
|
function eatAndCollectLinkDestination(nodePoints, startIndex, endIndex, state) {
|
|
8
6
|
let i = startIndex;
|
|
@@ -72,8 +70,7 @@ function eatAndCollectLinkDestination(nodePoints, startIndex, endIndex, state) {
|
|
|
72
70
|
}
|
|
73
71
|
break;
|
|
74
72
|
default:
|
|
75
|
-
if (isWhitespaceCharacter(p.codePoint) ||
|
|
76
|
-
isAsciiControlCharacter(p.codePoint)) {
|
|
73
|
+
if (isWhitespaceCharacter(p.codePoint) || isAsciiControlCharacter(p.codePoint)) {
|
|
77
74
|
state.saturated = true;
|
|
78
75
|
return { nextIndex: i, state: state };
|
|
79
76
|
}
|
|
@@ -202,8 +199,7 @@ function eatAndCollectLinkTitle(nodePoints, startIndex, endIndex, state) {
|
|
|
202
199
|
case AsciiCodePoint.OPEN_PARENTHESIS:
|
|
203
200
|
return { nextIndex: -1, state: state };
|
|
204
201
|
case AsciiCodePoint.CLOSE_PARENTHESIS:
|
|
205
|
-
if (i + 1 >= endIndex ||
|
|
206
|
-
nodePoints[i + 1].codePoint === VirtualCodePoint.LINE_END) {
|
|
202
|
+
if (i + 1 >= endIndex || nodePoints[i + 1].codePoint === VirtualCodePoint.LINE_END) {
|
|
207
203
|
state.nodePoints.push(p);
|
|
208
204
|
state.saturated = true;
|
|
209
205
|
break;
|
|
@@ -219,16 +215,14 @@ function eatAndCollectLinkTitle(nodePoints, startIndex, endIndex, state) {
|
|
|
219
215
|
return { nextIndex: endIndex, state: state };
|
|
220
216
|
}
|
|
221
217
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
}
|
|
231
|
-
eatOpener(line) {
|
|
218
|
+
const match = function (api) {
|
|
219
|
+
return {
|
|
220
|
+
isContainingBlock: false,
|
|
221
|
+
eatOpener,
|
|
222
|
+
eatContinuationText,
|
|
223
|
+
onClose,
|
|
224
|
+
};
|
|
225
|
+
function eatOpener(line) {
|
|
232
226
|
if (line.countOfPrecedeSpaces >= 4)
|
|
233
227
|
return null;
|
|
234
228
|
const { nodePoints, startIndex, endIndex, firstNonWhitespaceIndex } = line;
|
|
@@ -298,7 +292,7 @@ class DefinitionTokenizer extends BaseBlockTokenizer {
|
|
|
298
292
|
token.lineNoOfTitle = lineNo;
|
|
299
293
|
return { token, nextIndex: endIndex };
|
|
300
294
|
}
|
|
301
|
-
eatContinuationText(line, token) {
|
|
295
|
+
function eatContinuationText(line, token) {
|
|
302
296
|
var _a;
|
|
303
297
|
if (token.title != null && token.title.saturated)
|
|
304
298
|
return { status: 'notMatched' };
|
|
@@ -362,7 +356,7 @@ class DefinitionTokenizer extends BaseBlockTokenizer {
|
|
|
362
356
|
const saturated = (_a = token.title) === null || _a === void 0 ? void 0 : _a.saturated;
|
|
363
357
|
return { status: saturated ? 'closing' : 'opening', nextIndex: endIndex };
|
|
364
358
|
}
|
|
365
|
-
onClose(token
|
|
359
|
+
function onClose(token) {
|
|
366
360
|
let result;
|
|
367
361
|
if (token.title == null || !token.title.saturated) {
|
|
368
362
|
if (!token.label.saturated) {
|
|
@@ -390,26 +384,45 @@ class DefinitionTokenizer extends BaseBlockTokenizer {
|
|
|
390
384
|
token._identifier = identifier;
|
|
391
385
|
return result;
|
|
392
386
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
const parse = function () {
|
|
390
|
+
return {
|
|
391
|
+
parse: token => {
|
|
392
|
+
const label = token._label;
|
|
393
|
+
const identifier = token._identifier;
|
|
394
|
+
const destinationPoints = token.destination.nodePoints;
|
|
395
|
+
const destination = destinationPoints[0].codePoint === AsciiCodePoint.OPEN_ANGLE
|
|
396
|
+
? calcEscapedStringFromNodePoints(destinationPoints, 1, destinationPoints.length - 1, true)
|
|
397
|
+
: calcEscapedStringFromNodePoints(destinationPoints, 0, destinationPoints.length, true);
|
|
398
|
+
const url = encodeLinkDestination(destination);
|
|
399
|
+
const title = token.title == null
|
|
400
|
+
? undefined
|
|
401
|
+
: calcEscapedStringFromNodePoints(token.title.nodePoints, 1, token.title.nodePoints.length - 1);
|
|
402
|
+
const node = {
|
|
403
|
+
type: DefinitionType,
|
|
404
|
+
identifier,
|
|
405
|
+
label,
|
|
406
|
+
url,
|
|
407
|
+
title,
|
|
408
|
+
};
|
|
409
|
+
return node;
|
|
410
|
+
},
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
const uniqueName = '@yozora/tokenizer-definition';
|
|
415
|
+
|
|
416
|
+
class DefinitionTokenizer extends BaseBlockTokenizer {
|
|
417
|
+
constructor(props = {}) {
|
|
418
|
+
var _a, _b;
|
|
419
|
+
super({
|
|
420
|
+
name: (_a = props.name) !== null && _a !== void 0 ? _a : uniqueName,
|
|
421
|
+
priority: (_b = props.priority) !== null && _b !== void 0 ? _b : TokenizerPriority.ATOMIC,
|
|
422
|
+
});
|
|
423
|
+
this.match = match;
|
|
424
|
+
this.parse = parse;
|
|
412
425
|
}
|
|
413
426
|
}
|
|
414
427
|
|
|
415
|
-
export { DefinitionTokenizer, uniqueName as DefinitionTokenizerName, DefinitionTokenizer as default, eatAndCollectLinkDestination, eatAndCollectLinkLabel, eatAndCollectLinkTitle };
|
|
428
|
+
export { DefinitionTokenizer, uniqueName as DefinitionTokenizerName, DefinitionTokenizer as default, match as definitionMatch, parse as definitionParse, eatAndCollectLinkDestination, eatAndCollectLinkLabel, eatAndCollectLinkTitle };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { DefinitionTokenizer } from './tokenizer';
|
|
2
1
|
export * from './util/link-destination';
|
|
3
2
|
export * from './util/link-label';
|
|
4
3
|
export * from './util/link-title';
|
|
5
|
-
export {
|
|
4
|
+
export { match as definitionMatch } from './match';
|
|
5
|
+
export { parse as definitionParse } from './parse';
|
|
6
|
+
export { DefinitionTokenizer, DefinitionTokenizer as default } from './tokenizer';
|
|
6
7
|
export { uniqueName as DefinitionTokenizerName } from './types';
|
|
7
|
-
export type {
|
|
8
|
-
export default DefinitionTokenizer;
|
|
8
|
+
export type { IHookContext as IDefinitionHookContext, IToken as IDefinitionToken, ITokenizerProps as IDefinitionTokenizerProps, } from './types';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IMatchBlockHookCreator } from '@yozora/core-tokenizer';
|
|
2
|
+
import type { IHookContext, IToken, T } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* A link reference definition consists of a link label, indented up to three
|
|
5
|
+
* spaces, followed by a colon (:), optional whitespace (including up to one
|
|
6
|
+
* line ending), a link destination, optional whitespace (including up to one
|
|
7
|
+
* line ending), and an optional link title, which if it is present must be
|
|
8
|
+
* separated from the link destination by whitespace. No further non-whitespace
|
|
9
|
+
* characters may occur on the line.
|
|
10
|
+
*
|
|
11
|
+
* A link reference definition does not correspond to a structural element of
|
|
12
|
+
* a document. Instead, it defines a label which can be used in reference
|
|
13
|
+
* links and reference-style images elsewhere in the document. Link reference
|
|
14
|
+
* definitions can come either before or after the links that use them.
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.github.com/gfm/#link-reference-definition
|
|
17
|
+
*/
|
|
18
|
+
export declare const match: IMatchBlockHookCreator<T, IToken, IHookContext>;
|
package/lib/types/tokenizer.d.ts
CHANGED
|
@@ -1,44 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { IBlockTokenizer, IMatchBlockHookCreator, IParseBlockHookCreator } from '@yozora/core-tokenizer';
|
|
2
2
|
import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
|
|
3
|
-
import type {
|
|
3
|
+
import type { IHookContext, INode, IToken, ITokenizerProps, T } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* Lexical Analyzer for Definition.
|
|
6
|
-
*
|
|
7
|
-
* A link reference definition consists of a link label, indented up to three
|
|
8
|
-
* spaces, followed by a colon (:), optional whitespace (including up to one
|
|
9
|
-
* line ending), a link destination, optional whitespace (including up to one
|
|
10
|
-
* line ending), and an optional link title, which if it is present must be
|
|
11
|
-
* separated from the link destination by whitespace. No further non-whitespace
|
|
12
|
-
* characters may occur on the line.
|
|
13
|
-
*
|
|
14
|
-
* A link reference definition does not correspond to a structural element of
|
|
15
|
-
* a document. Instead, it defines a label which can be used in reference
|
|
16
|
-
* links and reference-style images elsewhere in the document. Link reference
|
|
17
|
-
* definitions can come either before or after the links that use them.
|
|
18
|
-
*
|
|
19
6
|
* @see https://github.github.com/gfm/#link-reference-definition
|
|
20
7
|
*/
|
|
21
|
-
export declare class DefinitionTokenizer extends BaseBlockTokenizer
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* @override
|
|
26
|
-
* @see TokenizerMatchBlockHook
|
|
27
|
-
*/
|
|
28
|
-
eatOpener(line: Readonly<PhrasingContentLine>): ResultOfEatOpener<T, Token>;
|
|
29
|
-
/**
|
|
30
|
-
* @override
|
|
31
|
-
* @see TokenizerMatchBlockHook
|
|
32
|
-
*/
|
|
33
|
-
eatContinuationText(line: Readonly<PhrasingContentLine>, token: Token): ResultOfEatContinuationText;
|
|
34
|
-
/**
|
|
35
|
-
* @override
|
|
36
|
-
* @see TokenizerMatchBlockHook
|
|
37
|
-
*/
|
|
38
|
-
onClose(token: Token, api: Readonly<MatchBlockPhaseApi>): ResultOfOnClose;
|
|
39
|
-
/**
|
|
40
|
-
* @override
|
|
41
|
-
* @see TokenizerParseBlockHook
|
|
42
|
-
*/
|
|
43
|
-
parseBlock(token: Readonly<Token>): ResultOfParse<T, Node>;
|
|
8
|
+
export declare class DefinitionTokenizer extends BaseBlockTokenizer<T, IToken, INode, IHookContext> implements IBlockTokenizer<T, IToken, INode, IHookContext> {
|
|
9
|
+
constructor(props?: ITokenizerProps);
|
|
10
|
+
readonly match: IMatchBlockHookCreator<T, IToken, IHookContext>;
|
|
11
|
+
readonly parse: IParseBlockHookCreator<T, IToken, INode, IHookContext>;
|
|
44
12
|
}
|
package/lib/types/types.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { DefinitionType, IDefinition } from '@yozora/ast';
|
|
2
|
+
import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, IPhrasingContentLine, ITokenizer } from '@yozora/core-tokenizer';
|
|
3
3
|
import type { LinkDestinationCollectingState } from './util/link-destination';
|
|
4
4
|
import type { LinkLabelCollectingState } from './util/link-label';
|
|
5
5
|
import type { LinkTitleCollectingState } from './util/link-title';
|
|
6
6
|
export declare type T = DefinitionType;
|
|
7
|
-
export declare type
|
|
7
|
+
export declare type INode = IDefinition;
|
|
8
8
|
export declare const uniqueName = "@yozora/tokenizer-definition";
|
|
9
|
-
export interface
|
|
9
|
+
export interface IToken extends IPartialYastBlockToken<T> {
|
|
10
10
|
/**
|
|
11
11
|
*
|
|
12
12
|
*/
|
|
13
|
-
lines: Array<Readonly<
|
|
13
|
+
lines: Array<Readonly<IPhrasingContentLine>>;
|
|
14
14
|
/**
|
|
15
15
|
* Link label
|
|
16
16
|
* Trimmed, Case-Insensitive
|
|
@@ -45,4 +45,5 @@ export interface Token extends PartialYastBlockToken<T> {
|
|
|
45
45
|
*/
|
|
46
46
|
_identifier?: string;
|
|
47
47
|
}
|
|
48
|
-
export declare type
|
|
48
|
+
export declare type IHookContext = ITokenizer;
|
|
49
|
+
export declare type ITokenizerProps = Partial<IBaseBlockTokenizerProps>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { INodePoint } from '@yozora/character';
|
|
2
2
|
/**
|
|
3
3
|
* The processing token of eatAndCollectLinkDestination, used to save
|
|
4
4
|
* intermediate data to support multiple codePosition fragment processing
|
|
@@ -13,7 +13,7 @@ export interface LinkDestinationCollectingState {
|
|
|
13
13
|
/**
|
|
14
14
|
* Collected token points
|
|
15
15
|
*/
|
|
16
|
-
nodePoints:
|
|
16
|
+
nodePoints: INodePoint[];
|
|
17
17
|
/**
|
|
18
18
|
* Whether an opening angle bracket has been matched
|
|
19
19
|
*/
|
|
@@ -31,7 +31,7 @@ export interface LinkDestinationCollectingState {
|
|
|
31
31
|
* @param state
|
|
32
32
|
* @see https://github.github.com/gfm/#link-destination
|
|
33
33
|
*/
|
|
34
|
-
export declare function eatAndCollectLinkDestination(nodePoints: ReadonlyArray<
|
|
34
|
+
export declare function eatAndCollectLinkDestination(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, state: LinkDestinationCollectingState | null): {
|
|
35
35
|
nextIndex: number;
|
|
36
36
|
state: LinkDestinationCollectingState;
|
|
37
37
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { INodePoint } from '@yozora/character';
|
|
2
2
|
/**
|
|
3
3
|
* The processing token of eatAndCollectLinkLabel, used to save
|
|
4
4
|
* intermediate data to support multiple codePosition fragment processing
|
|
@@ -13,7 +13,7 @@ export interface LinkLabelCollectingState {
|
|
|
13
13
|
/**
|
|
14
14
|
* Collected token points
|
|
15
15
|
*/
|
|
16
|
-
nodePoints:
|
|
16
|
+
nodePoints: INodePoint[];
|
|
17
17
|
/**
|
|
18
18
|
* Does it contain non-blank characters
|
|
19
19
|
*/
|
|
@@ -38,7 +38,7 @@ export interface LinkLabelCollectingState {
|
|
|
38
38
|
* @param state
|
|
39
39
|
* @see https://github.github.com/gfm/#link-label
|
|
40
40
|
*/
|
|
41
|
-
export declare function eatAndCollectLinkLabel(nodePoints: ReadonlyArray<
|
|
41
|
+
export declare function eatAndCollectLinkLabel(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, state: LinkLabelCollectingState | null): {
|
|
42
42
|
nextIndex: number;
|
|
43
43
|
state: LinkLabelCollectingState;
|
|
44
44
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { INodePoint } from '@yozora/character';
|
|
2
2
|
/**
|
|
3
3
|
* The processing token of eatAndCollectLinkDestination, used to save
|
|
4
4
|
* intermediate data to support multiple codePosition fragment processing.
|
|
@@ -13,7 +13,7 @@ export interface LinkTitleCollectingState {
|
|
|
13
13
|
/**
|
|
14
14
|
* Collected token points
|
|
15
15
|
*/
|
|
16
|
-
nodePoints:
|
|
16
|
+
nodePoints: INodePoint[];
|
|
17
17
|
/**
|
|
18
18
|
* Character that wrap link-title
|
|
19
19
|
*/
|
|
@@ -27,7 +27,7 @@ export interface LinkTitleCollectingState {
|
|
|
27
27
|
* @param state
|
|
28
28
|
* @see https://github.github.com/gfm/#link-title
|
|
29
29
|
*/
|
|
30
|
-
export declare function eatAndCollectLinkTitle(nodePoints: ReadonlyArray<
|
|
30
|
+
export declare function eatAndCollectLinkTitle(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, state: LinkTitleCollectingState | null): {
|
|
31
31
|
nextIndex: number;
|
|
32
32
|
state: LinkTitleCollectingState;
|
|
33
33
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yozora/tokenizer-definition",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-alpha.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "guanghechen",
|
|
6
6
|
"url": "https://github.com/guanghechen/"
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@yozora/ast": "^
|
|
39
|
-
"@yozora/character": "^
|
|
40
|
-
"@yozora/core-tokenizer": "^
|
|
38
|
+
"@yozora/ast": "^2.0.0-alpha.0",
|
|
39
|
+
"@yozora/character": "^2.0.0-alpha.0",
|
|
40
|
+
"@yozora/core-tokenizer": "^2.0.0-alpha.0"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "0171501339c49ffd02ed16a63447fa20a47a29a7"
|
|
43
43
|
}
|