@yozora/tokenizer-definition 2.0.2 → 2.0.4

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020-2021 guanghechen (me.guanghechen@gmail.com)
3
+ Copyright (c) 2020-2022 guanghechen (me.guanghechen@gmail.com)
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yozora/tokenizer-definition",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
4
4
  "author": {
5
5
  "name": "guanghechen",
6
6
  "url": "https://github.com/guanghechen/"
@@ -30,14 +30,14 @@
30
30
  ],
31
31
  "scripts": {
32
32
  "build": "cross-env NODE_ENV=production rollup -c ../../rollup.config.js",
33
- "prebuild": "rimraf lib/ && tsc -p tsconfig.src.json --emitDeclarationOnly",
33
+ "prebuild": "rimraf lib/",
34
34
  "prepublishOnly": "cross-env ROLLUP_SHOULD_SOURCEMAP=false yarn build",
35
35
  "test": "cross-env TS_NODE_FILES=true jest --config ../../jest.config.js --rootDir ."
36
36
  },
37
37
  "dependencies": {
38
- "@yozora/ast": "^2.0.2",
39
- "@yozora/character": "^2.0.2",
40
- "@yozora/core-tokenizer": "^2.0.2"
38
+ "@yozora/ast": "^2.0.4",
39
+ "@yozora/character": "^2.0.4",
40
+ "@yozora/core-tokenizer": "^2.0.4"
41
41
  },
42
- "gitHead": "6911295e9eacfa29563fe93494704190e50625fd"
42
+ "gitHead": "c980b95254394dcacba0cbb4bea251350b09397c"
43
43
  }
@@ -1,18 +0,0 @@
1
- import type { IMatchBlockHookCreator } from '@yozora/core-tokenizer';
2
- import type { IThis, 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, IThis>;
@@ -1,3 +0,0 @@
1
- import type { IParseBlockHookCreator } from '@yozora/core-tokenizer';
2
- import type { INode, IThis, IToken, T } from './types';
3
- export declare const parse: IParseBlockHookCreator<T, IToken, INode, IThis>;
@@ -1,12 +0,0 @@
1
- import type { IBlockTokenizer, IMatchBlockHookCreator, IParseBlockHookCreator } from '@yozora/core-tokenizer';
2
- import { BaseBlockTokenizer } from '@yozora/core-tokenizer';
3
- import type { INode, IThis, IToken, ITokenizerProps, T } from './types';
4
- /**
5
- * Lexical Analyzer for Definition.
6
- * @see https://github.github.com/gfm/#link-reference-definition
7
- */
8
- export declare class DefinitionTokenizer extends BaseBlockTokenizer<T, IToken, INode, IThis> implements IBlockTokenizer<T, IToken, INode, IThis> {
9
- constructor(props?: ITokenizerProps);
10
- readonly match: IMatchBlockHookCreator<T, IToken, IThis>;
11
- readonly parse: IParseBlockHookCreator<T, IToken, INode, IThis>;
12
- }
@@ -1,49 +0,0 @@
1
- import type { Definition, DefinitionType } from '@yozora/ast';
2
- import type { IBaseBlockTokenizerProps, IPartialYastBlockToken, IPhrasingContentLine, ITokenizer } from '@yozora/core-tokenizer';
3
- import type { ILinkDestinationCollectingState } from './util/link-destination';
4
- import type { ILinkLabelCollectingState } from './util/link-label';
5
- import type { ILinkTitleCollectingState } from './util/link-title';
6
- export declare type T = DefinitionType;
7
- export declare type INode = Definition;
8
- export declare const uniqueName = "@yozora/tokenizer-definition";
9
- export interface IToken extends IPartialYastBlockToken<T> {
10
- /**
11
- *
12
- */
13
- lines: Array<Readonly<IPhrasingContentLine>>;
14
- /**
15
- * Link label
16
- * Trimmed, Case-Insensitive
17
- */
18
- label: ILinkLabelCollectingState;
19
- /**
20
- * Link destination
21
- */
22
- destination: ILinkDestinationCollectingState | null;
23
- /**
24
- * Link title
25
- */
26
- title: ILinkTitleCollectingState | null;
27
- /**
28
- * The line number of the first matched character of the link label
29
- */
30
- lineNoOfLabel: number;
31
- /**
32
- * The line number of the first matched character of the link destination
33
- */
34
- lineNoOfDestination: number;
35
- /**
36
- * The line number of the first matched character of the link title
37
- */
38
- lineNoOfTitle: number;
39
- /**
40
- * Resolved definition label.
41
- */
42
- _label?: string;
43
- /**
44
- * Resolved definition identifier.
45
- */
46
- _identifier?: string;
47
- }
48
- export declare type IThis = ITokenizer;
49
- export declare type ITokenizerProps = Partial<IBaseBlockTokenizerProps>;
@@ -1,37 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * The processing token of eatAndCollectLinkDestination, used to save
4
- * intermediate data to support multiple codePosition fragment processing
5
- *
6
- * @see https://github.github.com/gfm/#link-destination
7
- */
8
- export interface ILinkDestinationCollectingState {
9
- /**
10
- * Whether the current token has collected a legal LinkDestination
11
- */
12
- saturated: boolean;
13
- /**
14
- * Collected token points
15
- */
16
- nodePoints: INodePoint[];
17
- /**
18
- * Whether an opening angle bracket has been matched
19
- */
20
- hasOpenAngleBracket: boolean;
21
- /**
22
- * Number of parentheses encountered
23
- */
24
- openParensCount: number;
25
- }
26
- /**
27
- *
28
- * @param nodePoints
29
- * @param startIndex
30
- * @param endIndex
31
- * @param state
32
- * @see https://github.github.com/gfm/#link-destination
33
- */
34
- export declare function eatAndCollectLinkDestination(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, state: ILinkDestinationCollectingState | null): {
35
- nextIndex: number;
36
- state: ILinkDestinationCollectingState;
37
- };
@@ -1,44 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * The processing token of eatAndCollectLinkLabel, used to save
4
- * intermediate data to support multiple codePosition fragment processing
5
- *
6
- * @see https://github.github.com/gfm/#link-label
7
- */
8
- export interface ILinkLabelCollectingState {
9
- /**
10
- * Whether the current token has collected a legal LinkDestination
11
- */
12
- saturated: boolean;
13
- /**
14
- * Collected token points
15
- */
16
- nodePoints: INodePoint[];
17
- /**
18
- * Does it contain non-blank characters
19
- */
20
- hasNonWhitespaceCharacter: boolean;
21
- }
22
- /**
23
- * A link label begins with a left bracket '[' and ends with the first right bracket ']'
24
- * that is not backslash-escaped. Between these brackets there must be at least one
25
- * non-whitespace character. Unescaped square bracket characters are not allowed inside
26
- * the opening and closing square brackets of link labels. A link label can have at most
27
- * 999 characters inside the square brackets.
28
- *
29
- * One label matches another just in case their normalized forms are equal. To normalize
30
- * a label, strip off the opening and closing brackets, perform the Unicode case fold,
31
- * strip leading and trailing whitespace and collapse consecutive internal whitespace to
32
- * a single space. If there are multiple matching reference link definitions, the one that
33
- * comes first in the document is used. (It is desirable in such cases to emit a warning.)
34
- *
35
- * @param nodePoints
36
- * @param startIndex
37
- * @param endIndex
38
- * @param state
39
- * @see https://github.github.com/gfm/#link-label
40
- */
41
- export declare function eatAndCollectLinkLabel(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, state: ILinkLabelCollectingState | null): {
42
- nextIndex: number;
43
- state: ILinkLabelCollectingState;
44
- };
@@ -1,33 +0,0 @@
1
- import type { INodePoint } from '@yozora/character';
2
- /**
3
- * The processing token of eatAndCollectLinkDestination, used to save
4
- * intermediate data to support multiple codePosition fragment processing.
5
- *
6
- * @see https://github.github.com/gfm/#link-title
7
- */
8
- export interface ILinkTitleCollectingState {
9
- /**
10
- * Whether the current token has collected a legal LinkDestination
11
- */
12
- saturated: boolean;
13
- /**
14
- * Collected token points
15
- */
16
- nodePoints: INodePoint[];
17
- /**
18
- * Character that wrap link-title
19
- */
20
- wrapSymbol: number | null;
21
- }
22
- /**
23
- *
24
- * @param nodePoints
25
- * @param startIndex
26
- * @param endIndex
27
- * @param state
28
- * @see https://github.github.com/gfm/#link-title
29
- */
30
- export declare function eatAndCollectLinkTitle(nodePoints: ReadonlyArray<INodePoint>, startIndex: number, endIndex: number, state: ILinkTitleCollectingState | null): {
31
- nextIndex: number;
32
- state: ILinkTitleCollectingState;
33
- };