@markuplint/types 3.5.1 → 3.6.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/check-multi-types.d.ts +4 -1
- package/lib/check.spec.js +61 -61
- package/lib/css-syntax.spec.js +151 -149
- package/lib/list.spec.js +117 -117
- package/lib/match-result.d.ts +21 -8
- package/lib/primitive/index.spec.js +52 -52
- package/lib/rfc/is-bcp-47.spec.js +8 -8
- package/lib/token/token-collection.d.ts +68 -55
- package/lib/token/token-collection.spec.js +155 -134
- package/lib/token/token.d.ts +57 -52
- package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
- package/lib/whatwg/check-autocomplete.spec.js +360 -360
- package/lib/whatwg/check-datetime/index.spec.js +277 -276
- package/lib/whatwg/check-mime-type.spec.js +52 -52
- package/lib/whatwg/is-abs-url.spec.js +5 -5
- package/package.json +8 -10
- package/test/check.spec.js +89 -0
- package/test/css-syntax.spec.js +165 -0
- package/test/list.spec.js +133 -0
- package/test/primitive/index.spec.js +65 -0
- package/test/rfc/is-bcp-47.spec.js +23 -0
- package/test/token/token-collection.spec.js +146 -0
- package/test/w3c/check-serialized-permissions-policy.spec.js +36 -0
- package/test/whatwg/check-autocomplete.spec.js +387 -0
- package/test/whatwg/check-datetime/index.spec.js +336 -0
- package/test/whatwg/check-mime-type.spec.js +59 -0
- package/test/whatwg/is-abs-url.spec.js +8 -0
package/lib/list.spec.js
CHANGED
|
@@ -1,130 +1,130 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
const list_1 = require(
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
const list_1 = require('./list');
|
|
5
5
|
test('Zero space', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
6
|
+
const type = { token: 'Zero', separator: 'space' };
|
|
7
|
+
expect((0, list_1.checkList)('0', type).matched).toBe(true);
|
|
8
|
+
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true);
|
|
9
|
+
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(true);
|
|
10
|
+
expect((0, list_1.checkList)(' 0 0 ', type).matched).toBe(true);
|
|
11
|
+
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(true);
|
|
12
|
+
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true);
|
|
13
|
+
expect((0, list_1.checkList)('0 0 0 0', type).matched).toBe(true);
|
|
14
|
+
expect((0, list_1.checkList)('1', type).matched).toBe(false);
|
|
15
|
+
expect((0, list_1.checkList)(' 1 ', type).matched).toBe(false);
|
|
16
|
+
expect((0, list_1.checkList)(' 1 0', type).matched).toBe(false);
|
|
17
|
+
expect((0, list_1.checkList)(' 1 0 ', type).matched).toBe(false);
|
|
18
|
+
expect((0, list_1.checkList)('0 1 0 ', type).matched).toBe(false);
|
|
19
|
+
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false);
|
|
20
|
+
expect((0, list_1.checkList)('0 1 0 0', type).matched).toBe(false);
|
|
21
21
|
});
|
|
22
22
|
test('Zero comma', () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
23
|
+
const type = { token: 'Zero', separator: 'comma' };
|
|
24
|
+
expect((0, list_1.checkList)('0', type).matched).toBe(true);
|
|
25
|
+
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(true);
|
|
26
|
+
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false);
|
|
27
|
+
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(true);
|
|
28
|
+
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false);
|
|
29
|
+
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false);
|
|
30
|
+
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(true);
|
|
31
|
+
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(true);
|
|
32
|
+
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false);
|
|
33
|
+
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false);
|
|
34
34
|
});
|
|
35
35
|
test('Zero comma (disallowToSurroundBySpaces)', () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
36
|
+
const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true };
|
|
37
|
+
expect((0, list_1.checkList)('0', type).matched).toBe(true);
|
|
38
|
+
expect((0, list_1.checkList)(' 0 ', type).matched).toBe(false);
|
|
39
|
+
expect((0, list_1.checkList)(' 0 0', type).matched).toBe(false);
|
|
40
|
+
expect((0, list_1.checkList)(' 0,0', type).matched).toBe(false);
|
|
41
|
+
expect((0, list_1.checkList)(' 0,,0 ', type).matched).toBe(false);
|
|
42
|
+
expect((0, list_1.checkList)('0 0 0 ', type).matched).toBe(false);
|
|
43
|
+
expect((0, list_1.checkList)(' 0,0,0,0 ', type).matched).toBe(false);
|
|
44
|
+
expect((0, list_1.checkList)('0, 0, 0 , 0', type).matched).toBe(false);
|
|
45
|
+
expect((0, list_1.checkList)('0,0,0,0', type).matched).toBe(true);
|
|
46
|
+
expect((0, list_1.checkList)('0,0,0,0,', type).matched).toBe(false);
|
|
47
|
+
expect((0, list_1.checkList)(',0,0,0,0', type).matched).toBe(false);
|
|
48
48
|
});
|
|
49
49
|
test('Location of the token', () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
50
|
+
const type = { token: 'Accept', separator: 'comma' };
|
|
51
|
+
expect((0, list_1.checkList)('x/y;a=b', type)).toStrictEqual({
|
|
52
|
+
candidate: 'x/y',
|
|
53
|
+
column: 4,
|
|
54
|
+
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
55
|
+
length: 4,
|
|
56
|
+
line: 1,
|
|
57
|
+
matched: false,
|
|
58
|
+
offset: 3,
|
|
59
|
+
raw: ';a=b',
|
|
60
|
+
reason: 'extra-token',
|
|
61
|
+
partName: 'the content of the list',
|
|
62
|
+
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept',
|
|
63
|
+
});
|
|
64
|
+
expect((0, list_1.checkList)('x/y,x/y;a=b', type)).toStrictEqual({
|
|
65
|
+
candidate: 'x/y',
|
|
66
|
+
column: 8,
|
|
67
|
+
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
68
|
+
length: 4,
|
|
69
|
+
line: 1,
|
|
70
|
+
matched: false,
|
|
71
|
+
offset: 7,
|
|
72
|
+
raw: ';a=b',
|
|
73
|
+
reason: 'extra-token',
|
|
74
|
+
partName: 'the content of the list',
|
|
75
|
+
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept',
|
|
76
|
+
});
|
|
77
|
+
expect((0, list_1.checkList)('x/y\n,\nx/y;a=b', type)).toStrictEqual({
|
|
78
|
+
candidate: 'x/y',
|
|
79
|
+
column: 4,
|
|
80
|
+
expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
|
|
81
|
+
length: 4,
|
|
82
|
+
line: 3,
|
|
83
|
+
matched: false,
|
|
84
|
+
offset: 9,
|
|
85
|
+
raw: ';a=b',
|
|
86
|
+
reason: 'extra-token',
|
|
87
|
+
partName: 'the content of the list',
|
|
88
|
+
ref: 'https://html.spec.whatwg.org/multipage/input.html#attr-input-accept',
|
|
89
|
+
});
|
|
90
90
|
});
|
|
91
91
|
test('Expected comma', () => {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
92
|
+
const type = { token: 'Accept', separator: 'comma' };
|
|
93
|
+
expect((0, list_1.checkList)('x/y,', type)).toStrictEqual({
|
|
94
|
+
column: 4,
|
|
95
|
+
expects: undefined,
|
|
96
|
+
length: 1,
|
|
97
|
+
line: 1,
|
|
98
|
+
matched: false,
|
|
99
|
+
offset: 3,
|
|
100
|
+
raw: ',',
|
|
101
|
+
reason: 'extra-token',
|
|
102
|
+
ref: null,
|
|
103
|
+
});
|
|
104
|
+
expect((0, list_1.checkList)('x/y,,x/y', type)).toStrictEqual({
|
|
105
|
+
column: 5,
|
|
106
|
+
expects: undefined,
|
|
107
|
+
length: 1,
|
|
108
|
+
line: 1,
|
|
109
|
+
matched: false,
|
|
110
|
+
offset: 4,
|
|
111
|
+
raw: ',',
|
|
112
|
+
reason: 'unexpected-comma',
|
|
113
|
+
ref: null,
|
|
114
|
+
});
|
|
115
115
|
});
|
|
116
116
|
test('Missing comma', () => {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
117
|
+
const type = { token: 'Accept', separator: 'comma' };
|
|
118
|
+
expect((0, list_1.checkList)('a/b,x/y a/z', type)).toStrictEqual({
|
|
119
|
+
column: 9,
|
|
120
|
+
candidate: ',a/z',
|
|
121
|
+
expects: undefined,
|
|
122
|
+
length: 3,
|
|
123
|
+
line: 1,
|
|
124
|
+
matched: false,
|
|
125
|
+
offset: 8,
|
|
126
|
+
raw: 'a/z',
|
|
127
|
+
reason: 'missing-comma',
|
|
128
|
+
ref: null,
|
|
129
|
+
});
|
|
130
130
|
});
|
package/lib/match-result.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import type {
|
|
2
|
+
FormattedPrimitiveTypeCheck,
|
|
3
|
+
MatchedResult,
|
|
4
|
+
UnmatchedResult,
|
|
5
|
+
UnmatchedResultOptions,
|
|
6
|
+
UnmatchedResultReason,
|
|
7
|
+
} from './types';
|
|
8
|
+
export declare function matches(
|
|
9
|
+
checker: FormattedPrimitiveTypeCheck,
|
|
10
|
+
options?: UnmatchedResultOptions & {
|
|
11
|
+
readonly ref?: string;
|
|
12
|
+
readonly reason?: UnmatchedResultReason;
|
|
13
|
+
},
|
|
14
|
+
): (value: string) => MatchedResult | UnmatchedResult;
|
|
6
15
|
export declare function matched(): MatchedResult;
|
|
7
|
-
export declare function unmatched(
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
export declare function unmatched(
|
|
17
|
+
value: string,
|
|
18
|
+
reason?: UnmatchedResultReason,
|
|
19
|
+
options?: UnmatchedResultOptions & {
|
|
20
|
+
readonly ref?: string;
|
|
21
|
+
},
|
|
22
|
+
): UnmatchedResult;
|
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
const _1 = require(
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
const _1 = require('.');
|
|
5
5
|
test('int', () => {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
expect((0, _1.isInt)('0')).toBe(true);
|
|
7
|
+
expect((0, _1.isInt)('1')).toBe(true);
|
|
8
|
+
expect((0, _1.isInt)('-0')).toBe(true);
|
|
9
|
+
expect((0, _1.isInt)('-1')).toBe(true);
|
|
10
|
+
expect((0, _1.isInt)('10')).toBe(true);
|
|
11
|
+
expect((0, _1.isInt)('100')).toBe(true);
|
|
12
|
+
expect((0, _1.isInt)('1.00')).toBe(false);
|
|
13
|
+
expect((0, _1.isInt)('.001')).toBe(false);
|
|
14
|
+
expect((0, _1.isInt)(' 1 ')).toBe(false);
|
|
15
|
+
expect((0, _1.isInt)('- 1')).toBe(false);
|
|
16
16
|
});
|
|
17
17
|
test('uint', () => {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
expect((0, _1.isUint)('0')).toBe(true);
|
|
19
|
+
expect((0, _1.isUint)('1')).toBe(true);
|
|
20
|
+
expect((0, _1.isUint)('10')).toBe(true);
|
|
21
|
+
expect((0, _1.isUint)('100')).toBe(true);
|
|
22
|
+
expect((0, _1.isUint)('-0')).toBe(false);
|
|
23
|
+
expect((0, _1.isUint)('-1')).toBe(false);
|
|
24
|
+
expect((0, _1.isUint)('1.00')).toBe(false);
|
|
25
|
+
expect((0, _1.isUint)('.001')).toBe(false);
|
|
26
|
+
expect((0, _1.isUint)(' 1 ')).toBe(false);
|
|
27
|
+
expect((0, _1.isUint)('- 1')).toBe(false);
|
|
28
28
|
});
|
|
29
29
|
test('float', () => {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
expect((0, _1.isFloat)('0')).toBe(true);
|
|
31
|
+
expect((0, _1.isFloat)('1')).toBe(true);
|
|
32
|
+
expect((0, _1.isFloat)('10')).toBe(true);
|
|
33
|
+
expect((0, _1.isFloat)('100')).toBe(true);
|
|
34
|
+
expect((0, _1.isFloat)('-0')).toBe(true);
|
|
35
|
+
expect((0, _1.isFloat)('-1')).toBe(true);
|
|
36
|
+
expect((0, _1.isFloat)('1.00')).toBe(true);
|
|
37
|
+
expect((0, _1.isFloat)('.001')).toBe(true);
|
|
38
|
+
expect((0, _1.isFloat)(' 1 ')).toBe(false);
|
|
39
|
+
expect((0, _1.isFloat)('- 1')).toBe(false);
|
|
40
40
|
});
|
|
41
41
|
test('nonZeroUint', () => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
expect((0, _1.isNonZeroUint)('0')).toBe(false);
|
|
43
|
+
expect((0, _1.isNonZeroUint)('1')).toBe(true);
|
|
44
|
+
expect((0, _1.isNonZeroUint)('10')).toBe(true);
|
|
45
|
+
expect((0, _1.isNonZeroUint)('100')).toBe(true);
|
|
46
|
+
expect((0, _1.isNonZeroUint)('-0')).toBe(false);
|
|
47
|
+
expect((0, _1.isNonZeroUint)('-1')).toBe(false);
|
|
48
|
+
expect((0, _1.isNonZeroUint)('1.00')).toBe(false);
|
|
49
|
+
expect((0, _1.isNonZeroUint)('.001')).toBe(false);
|
|
50
|
+
expect((0, _1.isNonZeroUint)(' 1 ')).toBe(false);
|
|
51
|
+
expect((0, _1.isNonZeroUint)('- 1')).toBe(false);
|
|
52
52
|
});
|
|
53
53
|
test('quantity', () => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
expect((0, _1.isQuantity)('0px', ['px', 'em'])).toBe(true);
|
|
55
|
+
expect((0, _1.isQuantity)('.5px', ['px', 'em'])).toBe(true);
|
|
56
|
+
expect((0, _1.isQuantity)('1.5em', ['px', 'em'])).toBe(true);
|
|
57
|
+
expect((0, _1.isQuantity)('1.5cm', ['px', 'em'])).toBe(false);
|
|
58
|
+
expect((0, _1.isQuantity)('1.5px', ['px', 'em'], 'int')).toBe(false);
|
|
59
|
+
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'int')).toBe(true);
|
|
60
|
+
expect((0, _1.isQuantity)('-5px', ['px', 'em'], 'uint')).toBe(false);
|
|
61
|
+
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'float')).toBe(true);
|
|
62
|
+
expect((0, _1.isQuantity)('1.12e+21px', ['px', 'em'], 'int')).toBe(false);
|
|
63
63
|
});
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
const is_bcp_47_1 = require(
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
const is_bcp_47_1 = require('./is-bcp-47');
|
|
5
5
|
const is = (0, is_bcp_47_1.isBCP47)();
|
|
6
6
|
test('en-us', () => {
|
|
7
|
-
|
|
7
|
+
expect(is('en-us')).toBe(true);
|
|
8
8
|
});
|
|
9
9
|
test('ja-JP', () => {
|
|
10
|
-
|
|
10
|
+
expect(is('ja-JP')).toBe(true);
|
|
11
11
|
});
|
|
12
12
|
test('Empty', () => {
|
|
13
|
-
|
|
13
|
+
expect(is('')).toBe(false);
|
|
14
14
|
});
|
|
15
15
|
test('Invalid', () => {
|
|
16
|
-
|
|
16
|
+
expect(is(':::')).toBe(false);
|
|
17
17
|
});
|
|
18
18
|
test('Surrounded by spaces', () => {
|
|
19
|
-
|
|
19
|
+
expect(is(' en ')).toBe(false);
|
|
20
20
|
});
|
|
@@ -3,62 +3,75 @@ import type { UnmatchedResult } from '..';
|
|
|
3
3
|
import type { Expect, Result, List } from '../types';
|
|
4
4
|
import type { ReadonlyDeep } from 'type-fest';
|
|
5
5
|
import { Token } from './token';
|
|
6
|
-
type TokenCollectionOptions = Partial<
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
type TokenCollectionOptions = Partial<
|
|
7
|
+
Omit<List, 'token'> & {
|
|
8
|
+
specificSeparator: string | string[];
|
|
9
|
+
}
|
|
10
|
+
>;
|
|
9
11
|
export type TokenEachCheck = (head: Readonly<Token> | null, tail: ReadonlyDeep<TokenCollection>) => Result | void;
|
|
10
12
|
export declare class TokenCollection extends Array<Token> {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
13
|
+
static fromPatterns(
|
|
14
|
+
value: Readonly<Token> | string,
|
|
15
|
+
patterns: readonly Readonly<RegExp>[],
|
|
16
|
+
typeOptions?: ReadonlyDeep<
|
|
17
|
+
Omit<TokenCollectionOptions, 'specificSeparator'> & {
|
|
18
|
+
repeat?: boolean;
|
|
19
|
+
}
|
|
20
|
+
>,
|
|
21
|
+
): TokenCollection;
|
|
22
|
+
static get [Symbol.species](): ArrayConstructor;
|
|
23
|
+
readonly allowEmpty: NonNullable<List['allowEmpty']>;
|
|
24
|
+
readonly caseInsensitive: NonNullable<List['caseInsensitive']>;
|
|
25
|
+
readonly disallowToSurroundBySpaces: NonNullable<List['disallowToSurroundBySpaces']>;
|
|
26
|
+
readonly number: List['number'];
|
|
27
|
+
readonly ordered: NonNullable<List['ordered']>;
|
|
28
|
+
readonly separator: NonNullable<List['separator']>;
|
|
29
|
+
readonly unique: NonNullable<List['unique']>;
|
|
30
|
+
constructor(value?: string, typeOptions?: ReadonlyDeep<TokenCollectionOptions>);
|
|
31
|
+
constructor(value?: number);
|
|
32
|
+
get value(): string;
|
|
33
|
+
check(options?: {
|
|
34
|
+
expects?: Expect[];
|
|
35
|
+
ref?: string;
|
|
36
|
+
cache?: boolean;
|
|
37
|
+
}): import('..').MatchedResult | UnmatchedResult;
|
|
38
|
+
chunk(split: number): TokenCollection[];
|
|
39
|
+
compareTokens(
|
|
40
|
+
callback: (prev: Readonly<Token>, current: Readonly<Token>) => Readonly<Token> | null | void,
|
|
41
|
+
): Readonly<Token> | null | undefined;
|
|
42
|
+
divide(position: number): readonly [TokenCollection, TokenCollection];
|
|
43
|
+
eachCheck(...callbacks: readonly TokenEachCheck[]): Result;
|
|
44
|
+
filter(callback: Parameters<Array<Token>['filter']>[0]): TokenCollection;
|
|
45
|
+
getConsecutiveToken(tokenType: number): Readonly<Token> | null;
|
|
46
|
+
getDuplicated(): Token | null;
|
|
47
|
+
getIdentTokens(): TokenCollection;
|
|
48
|
+
/**
|
|
49
|
+
*
|
|
50
|
+
* @param value The token value or the token type or its list
|
|
51
|
+
*/
|
|
52
|
+
has(value: TokenValue): boolean;
|
|
53
|
+
headAndTail(): {
|
|
54
|
+
head: Token | null;
|
|
55
|
+
tail: TokenCollection;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
*
|
|
59
|
+
* @param value The token value or the token type or its list
|
|
60
|
+
*/
|
|
61
|
+
search(value: TokenValue): Token | null;
|
|
62
|
+
takeTurns(
|
|
63
|
+
tokenNumbers: ReadonlyArray<number>,
|
|
64
|
+
lastTokenNumber?: number,
|
|
65
|
+
): {
|
|
66
|
+
unexpectedLastToken: boolean;
|
|
67
|
+
expectedTokenNumber: number | undefined;
|
|
68
|
+
token: Token;
|
|
69
|
+
} | null;
|
|
70
|
+
toJSON(): {
|
|
71
|
+
type: number;
|
|
72
|
+
value: string;
|
|
73
|
+
offset: number;
|
|
74
|
+
}[];
|
|
75
|
+
private static _new;
|
|
63
76
|
}
|
|
64
77
|
export {};
|