@renovatebot/good-enough-parser 1.1.24 → 1.2.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/README.md +6 -6
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/lang/groovy.d.ts +6 -6
- package/dist/cjs/lang/groovy.js +83 -83
- package/dist/cjs/lang/index.d.ts +20 -20
- package/dist/cjs/lang/index.js +56 -56
- package/dist/cjs/lang/python.d.ts +6 -6
- package/dist/cjs/lang/python.js +73 -73
- package/dist/cjs/lang/scala.d.ts +6 -6
- package/dist/cjs/lang/scala.js +71 -71
- package/dist/cjs/lang/starlark.d.ts +6 -6
- package/dist/cjs/lang/starlark.js +58 -58
- package/dist/cjs/lang/types.d.ts +6 -6
- package/dist/cjs/lang/types.js +2 -2
- package/dist/cjs/lexer/bracket.d.ts +6 -6
- package/dist/cjs/lexer/bracket.js +57 -57
- package/dist/cjs/lexer/comment.d.ts +3 -3
- package/dist/cjs/lexer/comment.js +44 -44
- package/dist/cjs/lexer/index.d.ts +5 -5
- package/dist/cjs/lexer/index.js +155 -155
- package/dist/cjs/lexer/number.d.ts +2 -2
- package/dist/cjs/lexer/number.js +18 -18
- package/dist/cjs/lexer/operator.d.ts +2 -2
- package/dist/cjs/lexer/operator.js +24 -24
- package/dist/cjs/lexer/rules.d.ts +4 -4
- package/dist/cjs/lexer/rules.js +74 -74
- package/dist/cjs/lexer/string.d.ts +2 -2
- package/dist/cjs/lexer/string.js +181 -181
- package/dist/cjs/lexer/symbol.d.ts +2 -2
- package/dist/cjs/lexer/symbol.js +18 -18
- package/dist/cjs/lexer/token.d.ts +3 -3
- package/dist/cjs/lexer/token.js +64 -64
- package/dist/cjs/lexer/types.d.ts +142 -142
- package/dist/cjs/lexer/types.js +2 -2
- package/dist/cjs/parser/cursor.d.ts +2 -2
- package/dist/cjs/parser/cursor.js +13 -13
- package/dist/cjs/parser/index.d.ts +3 -3
- package/dist/cjs/parser/index.js +19 -19
- package/dist/cjs/parser/tree.d.ts +4 -4
- package/dist/cjs/parser/tree.js +246 -246
- package/dist/cjs/parser/types.d.ts +33 -33
- package/dist/cjs/parser/types.js +2 -2
- package/dist/cjs/query/builder.d.ts +144 -144
- package/dist/cjs/query/builder.js +332 -332
- package/dist/cjs/query/handler.d.ts +2 -2
- package/dist/cjs/query/handler.js +10 -10
- package/dist/cjs/query/index.d.ts +2 -2
- package/dist/cjs/query/index.js +32 -32
- package/dist/cjs/query/matchers/abstract-matcher.d.ts +9 -9
- package/dist/cjs/query/matchers/abstract-matcher.js +36 -36
- package/dist/cjs/query/matchers/alt-matcher.d.ts +10 -10
- package/dist/cjs/query/matchers/alt-matcher.js +33 -33
- package/dist/cjs/query/matchers/anchor-matcher.d.ts +17 -17
- package/dist/cjs/query/matchers/anchor-matcher.js +50 -50
- package/dist/cjs/query/matchers/comment-matcher.d.ts +10 -10
- package/dist/cjs/query/matchers/comment-matcher.js +39 -39
- package/dist/cjs/query/matchers/index.d.ts +6 -6
- package/dist/cjs/query/matchers/index.js +22 -22
- package/dist/cjs/query/matchers/many-matcher.d.ts +13 -13
- package/dist/cjs/query/matchers/many-matcher.js +61 -61
- package/dist/cjs/query/matchers/num-matcher.d.ts +8 -8
- package/dist/cjs/query/matchers/num-matcher.js +34 -34
- package/dist/cjs/query/matchers/op-matcher.d.ts +8 -8
- package/dist/cjs/query/matchers/op-matcher.js +34 -34
- package/dist/cjs/query/matchers/seq-matcher.d.ts +14 -14
- package/dist/cjs/query/matchers/seq-matcher.js +76 -76
- package/dist/cjs/query/matchers/str-matcher.d.ts +38 -38
- package/dist/cjs/query/matchers/str-matcher.js +108 -108
- package/dist/cjs/query/matchers/sym-matcher.d.ts +8 -8
- package/dist/cjs/query/matchers/sym-matcher.js +34 -34
- package/dist/cjs/query/matchers/tree-matcher.d.ts +23 -23
- package/dist/cjs/query/matchers/tree-matcher.js +121 -121
- package/dist/cjs/query/options.d.ts +10 -10
- package/dist/cjs/query/options.js +149 -149
- package/dist/cjs/query/regex.d.ts +1 -1
- package/dist/cjs/query/regex.js +13 -13
- package/dist/cjs/query/types.d.ts +100 -100
- package/dist/cjs/query/types.js +2 -2
- package/dist/cjs/util/clone.d.ts +1 -1
- package/dist/cjs/util/clone.js +5 -5
- package/dist/cjs/util/regex.d.ts +1 -1
- package/dist/cjs/util/regex.js +7 -7
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +8 -8
- package/dist/esm/lang/groovy.d.ts +6 -6
- package/dist/esm/lang/groovy.js +80 -80
- package/dist/esm/lang/index.d.ts +20 -20
- package/dist/esm/lang/index.js +37 -37
- package/dist/esm/lang/python.d.ts +6 -6
- package/dist/esm/lang/python.js +70 -70
- package/dist/esm/lang/scala.d.ts +6 -6
- package/dist/esm/lang/scala.js +68 -68
- package/dist/esm/lang/starlark.d.ts +6 -6
- package/dist/esm/lang/starlark.js +55 -55
- package/dist/esm/lang/types.d.ts +6 -6
- package/dist/esm/lang/types.js +1 -1
- package/dist/esm/lexer/bracket.d.ts +6 -6
- package/dist/esm/lexer/bracket.js +49 -49
- package/dist/esm/lexer/comment.d.ts +3 -3
- package/dist/esm/lexer/comment.js +39 -39
- package/dist/esm/lexer/index.d.ts +5 -5
- package/dist/esm/lexer/index.js +136 -136
- package/dist/esm/lexer/number.d.ts +2 -2
- package/dist/esm/lexer/number.js +14 -14
- package/dist/esm/lexer/operator.d.ts +2 -2
- package/dist/esm/lexer/operator.js +20 -20
- package/dist/esm/lexer/rules.d.ts +4 -4
- package/dist/esm/lexer/rules.js +69 -69
- package/dist/esm/lexer/string.d.ts +2 -2
- package/dist/esm/lexer/string.js +177 -177
- package/dist/esm/lexer/symbol.d.ts +2 -2
- package/dist/esm/lexer/symbol.js +14 -14
- package/dist/esm/lexer/token.d.ts +3 -3
- package/dist/esm/lexer/token.js +60 -60
- package/dist/esm/lexer/types.d.ts +142 -142
- package/dist/esm/lexer/types.js +1 -1
- package/dist/esm/parser/cursor.d.ts +2 -2
- package/dist/esm/parser/cursor.js +9 -9
- package/dist/esm/parser/index.d.ts +3 -3
- package/dist/esm/parser/index.js +3 -3
- package/dist/esm/parser/tree.d.ts +4 -4
- package/dist/esm/parser/tree.js +241 -241
- package/dist/esm/parser/types.d.ts +33 -33
- package/dist/esm/parser/types.js +1 -1
- package/dist/esm/query/builder.d.ts +144 -144
- package/dist/esm/query/builder.js +304 -304
- package/dist/esm/query/handler.d.ts +2 -2
- package/dist/esm/query/handler.js +6 -6
- package/dist/esm/query/index.d.ts +2 -2
- package/dist/esm/query/index.js +2 -2
- package/dist/esm/query/matchers/abstract-matcher.d.ts +9 -9
- package/dist/esm/query/matchers/abstract-matcher.js +32 -32
- package/dist/esm/query/matchers/alt-matcher.d.ts +10 -10
- package/dist/esm/query/matchers/alt-matcher.js +29 -29
- package/dist/esm/query/matchers/anchor-matcher.d.ts +17 -17
- package/dist/esm/query/matchers/anchor-matcher.js +44 -44
- package/dist/esm/query/matchers/comment-matcher.d.ts +10 -10
- package/dist/esm/query/matchers/comment-matcher.js +35 -35
- package/dist/esm/query/matchers/index.d.ts +6 -6
- package/dist/esm/query/matchers/index.js +6 -6
- package/dist/esm/query/matchers/many-matcher.d.ts +13 -13
- package/dist/esm/query/matchers/many-matcher.js +57 -57
- package/dist/esm/query/matchers/num-matcher.d.ts +8 -8
- package/dist/esm/query/matchers/num-matcher.js +30 -30
- package/dist/esm/query/matchers/op-matcher.d.ts +8 -8
- package/dist/esm/query/matchers/op-matcher.js +30 -30
- package/dist/esm/query/matchers/seq-matcher.d.ts +14 -14
- package/dist/esm/query/matchers/seq-matcher.js +72 -72
- package/dist/esm/query/matchers/str-matcher.d.ts +38 -38
- package/dist/esm/query/matchers/str-matcher.js +102 -102
- package/dist/esm/query/matchers/sym-matcher.d.ts +8 -8
- package/dist/esm/query/matchers/sym-matcher.js +30 -30
- package/dist/esm/query/matchers/tree-matcher.d.ts +23 -23
- package/dist/esm/query/matchers/tree-matcher.js +117 -117
- package/dist/esm/query/options.d.ts +10 -10
- package/dist/esm/query/options.js +139 -139
- package/dist/esm/query/regex.d.ts +1 -1
- package/dist/esm/query/regex.js +9 -9
- package/dist/esm/query/types.d.ts +100 -100
- package/dist/esm/query/types.js +1 -1
- package/dist/esm/util/clone.d.ts +1 -1
- package/dist/esm/util/clone.js +1 -1
- package/dist/esm/util/regex.d.ts +1 -1
- package/dist/esm/util/regex.js +3 -3
- package/package.json +3 -3
|
@@ -1,150 +1,150 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.coerceStrOptions = exports.coerceTreeOptions = exports.coerceManyOptions = exports.coerceNumOptions = exports.coerceCommentOptions = exports.coerceOpOptions = exports.coerceSymOptions = void 0;
|
|
4
|
-
const regex_1 = require("./regex");
|
|
5
|
-
function coerceSymOptions(arg1, arg2) {
|
|
6
|
-
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
7
|
-
return {
|
|
8
|
-
value: arg1,
|
|
9
|
-
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
if (typeof arg1 === 'function') {
|
|
13
|
-
return {
|
|
14
|
-
value: null,
|
|
15
|
-
handler: arg1,
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
if (arg1 !== null && typeof arg1 === 'object') {
|
|
19
|
-
return arg1;
|
|
20
|
-
}
|
|
21
|
-
return { value: null, handler: null };
|
|
22
|
-
}
|
|
23
|
-
exports.coerceSymOptions = coerceSymOptions;
|
|
24
|
-
function coerceOpOptions(arg1, arg2) {
|
|
25
|
-
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
26
|
-
return {
|
|
27
|
-
value: arg1,
|
|
28
|
-
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
if (typeof arg1 === 'function') {
|
|
32
|
-
return {
|
|
33
|
-
value: null,
|
|
34
|
-
handler: arg1,
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
if (arg1 !== null && typeof arg1 === 'object') {
|
|
38
|
-
return arg1;
|
|
39
|
-
}
|
|
40
|
-
return { value: null, handler: null };
|
|
41
|
-
}
|
|
42
|
-
exports.coerceOpOptions = coerceOpOptions;
|
|
43
|
-
function coerceCommentOptions(arg1, arg2) {
|
|
44
|
-
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
45
|
-
return {
|
|
46
|
-
value: arg1,
|
|
47
|
-
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (typeof arg1 === 'function') {
|
|
51
|
-
return {
|
|
52
|
-
value: null,
|
|
53
|
-
handler: arg1,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (arg1 !== null && typeof arg1 === 'object') {
|
|
57
|
-
return arg1;
|
|
58
|
-
}
|
|
59
|
-
return { value: null, handler: null };
|
|
60
|
-
}
|
|
61
|
-
exports.coerceCommentOptions = coerceCommentOptions;
|
|
62
|
-
function coerceNumOptions(arg1, arg2) {
|
|
63
|
-
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
64
|
-
return {
|
|
65
|
-
value: arg1,
|
|
66
|
-
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
if (typeof arg1 === 'function') {
|
|
70
|
-
return {
|
|
71
|
-
value: null,
|
|
72
|
-
handler: arg1,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
if (arg1 !== null && typeof arg1 === 'object') {
|
|
76
|
-
return arg1;
|
|
77
|
-
}
|
|
78
|
-
return { value: null, handler: null };
|
|
79
|
-
}
|
|
80
|
-
exports.coerceNumOptions = coerceNumOptions;
|
|
81
|
-
function coerceManyOptions(builder, arg2, arg3) {
|
|
82
|
-
if (typeof arg2 === 'number' && typeof arg3 === 'number') {
|
|
83
|
-
return { builder, min: arg2, max: arg3 };
|
|
84
|
-
}
|
|
85
|
-
return { builder, min: 1, max: null };
|
|
86
|
-
}
|
|
87
|
-
exports.coerceManyOptions = coerceManyOptions;
|
|
88
|
-
function coerceTreeOptions(arg1) {
|
|
89
|
-
if (typeof arg1 === 'string') {
|
|
90
|
-
return { type: arg1 };
|
|
91
|
-
}
|
|
92
|
-
else if (!arg1) {
|
|
93
|
-
return { type: null };
|
|
94
|
-
}
|
|
95
|
-
else {
|
|
96
|
-
return arg1;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.coerceTreeOptions = coerceTreeOptions;
|
|
100
|
-
function coerceStrOptions(arg1, arg2) {
|
|
101
|
-
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
102
|
-
if (arg1 === '') {
|
|
103
|
-
return {
|
|
104
|
-
type: 'str-tree',
|
|
105
|
-
match: [],
|
|
106
|
-
postHandler: arg2
|
|
107
|
-
? (ctx, tree) => arg2(ctx, {
|
|
108
|
-
...tree.startsWith,
|
|
109
|
-
type: 'string-value',
|
|
110
|
-
value: arg1,
|
|
111
|
-
})
|
|
112
|
-
: null,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
type: 'str-content',
|
|
117
|
-
match: arg1,
|
|
118
|
-
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
else if (typeof arg1 === 'function') {
|
|
122
|
-
return {
|
|
123
|
-
type: 'str-content',
|
|
124
|
-
match: null,
|
|
125
|
-
handler: arg1,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
else if (arg1) {
|
|
129
|
-
if (arg1['handler'] ||
|
|
130
|
-
typeof arg1.match === 'string' ||
|
|
131
|
-
(0, regex_1.isRegex)(arg1.match)) {
|
|
132
|
-
return {
|
|
133
|
-
type: 'str-content',
|
|
134
|
-
...arg1,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
return {
|
|
138
|
-
type: 'str-tree',
|
|
139
|
-
...arg1,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
return {
|
|
143
|
-
type: 'str-tree',
|
|
144
|
-
match: null,
|
|
145
|
-
preHandler: null,
|
|
146
|
-
postHandler: null,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
exports.coerceStrOptions = coerceStrOptions;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.coerceStrOptions = exports.coerceTreeOptions = exports.coerceManyOptions = exports.coerceNumOptions = exports.coerceCommentOptions = exports.coerceOpOptions = exports.coerceSymOptions = void 0;
|
|
4
|
+
const regex_1 = require("./regex");
|
|
5
|
+
function coerceSymOptions(arg1, arg2) {
|
|
6
|
+
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
7
|
+
return {
|
|
8
|
+
value: arg1,
|
|
9
|
+
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
if (typeof arg1 === 'function') {
|
|
13
|
+
return {
|
|
14
|
+
value: null,
|
|
15
|
+
handler: arg1,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
if (arg1 !== null && typeof arg1 === 'object') {
|
|
19
|
+
return arg1;
|
|
20
|
+
}
|
|
21
|
+
return { value: null, handler: null };
|
|
22
|
+
}
|
|
23
|
+
exports.coerceSymOptions = coerceSymOptions;
|
|
24
|
+
function coerceOpOptions(arg1, arg2) {
|
|
25
|
+
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
26
|
+
return {
|
|
27
|
+
value: arg1,
|
|
28
|
+
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
if (typeof arg1 === 'function') {
|
|
32
|
+
return {
|
|
33
|
+
value: null,
|
|
34
|
+
handler: arg1,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
if (arg1 !== null && typeof arg1 === 'object') {
|
|
38
|
+
return arg1;
|
|
39
|
+
}
|
|
40
|
+
return { value: null, handler: null };
|
|
41
|
+
}
|
|
42
|
+
exports.coerceOpOptions = coerceOpOptions;
|
|
43
|
+
function coerceCommentOptions(arg1, arg2) {
|
|
44
|
+
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
45
|
+
return {
|
|
46
|
+
value: arg1,
|
|
47
|
+
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (typeof arg1 === 'function') {
|
|
51
|
+
return {
|
|
52
|
+
value: null,
|
|
53
|
+
handler: arg1,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (arg1 !== null && typeof arg1 === 'object') {
|
|
57
|
+
return arg1;
|
|
58
|
+
}
|
|
59
|
+
return { value: null, handler: null };
|
|
60
|
+
}
|
|
61
|
+
exports.coerceCommentOptions = coerceCommentOptions;
|
|
62
|
+
function coerceNumOptions(arg1, arg2) {
|
|
63
|
+
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
64
|
+
return {
|
|
65
|
+
value: arg1,
|
|
66
|
+
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
if (typeof arg1 === 'function') {
|
|
70
|
+
return {
|
|
71
|
+
value: null,
|
|
72
|
+
handler: arg1,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
if (arg1 !== null && typeof arg1 === 'object') {
|
|
76
|
+
return arg1;
|
|
77
|
+
}
|
|
78
|
+
return { value: null, handler: null };
|
|
79
|
+
}
|
|
80
|
+
exports.coerceNumOptions = coerceNumOptions;
|
|
81
|
+
function coerceManyOptions(builder, arg2, arg3) {
|
|
82
|
+
if (typeof arg2 === 'number' && typeof arg3 === 'number') {
|
|
83
|
+
return { builder, min: arg2, max: arg3 };
|
|
84
|
+
}
|
|
85
|
+
return { builder, min: 1, max: null };
|
|
86
|
+
}
|
|
87
|
+
exports.coerceManyOptions = coerceManyOptions;
|
|
88
|
+
function coerceTreeOptions(arg1) {
|
|
89
|
+
if (typeof arg1 === 'string') {
|
|
90
|
+
return { type: arg1 };
|
|
91
|
+
}
|
|
92
|
+
else if (!arg1) {
|
|
93
|
+
return { type: null };
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return arg1;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.coerceTreeOptions = coerceTreeOptions;
|
|
100
|
+
function coerceStrOptions(arg1, arg2) {
|
|
101
|
+
if (typeof arg1 === 'string' || (0, regex_1.isRegex)(arg1)) {
|
|
102
|
+
if (arg1 === '') {
|
|
103
|
+
return {
|
|
104
|
+
type: 'str-tree',
|
|
105
|
+
match: [],
|
|
106
|
+
postHandler: arg2
|
|
107
|
+
? (ctx, tree) => arg2(ctx, {
|
|
108
|
+
...tree.startsWith,
|
|
109
|
+
type: 'string-value',
|
|
110
|
+
value: arg1,
|
|
111
|
+
})
|
|
112
|
+
: null,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
type: 'str-content',
|
|
117
|
+
match: arg1,
|
|
118
|
+
handler: arg2 !== null && arg2 !== void 0 ? arg2 : null,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
else if (typeof arg1 === 'function') {
|
|
122
|
+
return {
|
|
123
|
+
type: 'str-content',
|
|
124
|
+
match: null,
|
|
125
|
+
handler: arg1,
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
else if (arg1) {
|
|
129
|
+
if (arg1['handler'] ||
|
|
130
|
+
typeof arg1.match === 'string' ||
|
|
131
|
+
(0, regex_1.isRegex)(arg1.match)) {
|
|
132
|
+
return {
|
|
133
|
+
type: 'str-content',
|
|
134
|
+
...arg1,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
type: 'str-tree',
|
|
139
|
+
...arg1,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
return {
|
|
143
|
+
type: 'str-tree',
|
|
144
|
+
match: null,
|
|
145
|
+
preHandler: null,
|
|
146
|
+
postHandler: null,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
exports.coerceStrOptions = coerceStrOptions;
|
|
150
150
|
//# sourceMappingURL=options.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function isRegex(input: unknown): input is RegExp;
|
|
1
|
+
export declare function isRegex(input: unknown): input is RegExp;
|
|
2
2
|
//# sourceMappingURL=regex.d.ts.map
|
package/dist/cjs/query/regex.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isRegex = void 0;
|
|
4
|
-
function isRegex(input) {
|
|
5
|
-
if (input instanceof RegExp) {
|
|
6
|
-
return true;
|
|
7
|
-
}
|
|
8
|
-
if (input && typeof input === 'object' && input.constructor.name === 'RE2') {
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
exports.isRegex = isRegex;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isRegex = void 0;
|
|
4
|
+
function isRegex(input) {
|
|
5
|
+
if (input instanceof RegExp) {
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
if (input && typeof input === 'object' && input.constructor.name === 'RE2') {
|
|
9
|
+
return true;
|
|
10
|
+
}
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
exports.isRegex = isRegex;
|
|
14
14
|
//# sourceMappingURL=regex.js.map
|
|
@@ -1,101 +1,101 @@
|
|
|
1
|
-
import type { CommentToken, MinorToken, NumberToken, OperatorToken, SymbolToken } from '../lexer/types';
|
|
2
|
-
import type { Cursor, Node, StringTree, TemplateTree, Tree, TreeType } from '../parser/types';
|
|
3
|
-
import type { StrContentMatcherHandler } from './matchers/str-matcher';
|
|
4
|
-
export interface Checkpoint<Ctx> {
|
|
5
|
-
cursor: Cursor;
|
|
6
|
-
context: Ctx;
|
|
7
|
-
}
|
|
8
|
-
export type NodeHandler<Ctx, T extends Node> = (ctx: Ctx, tree: T) => Ctx;
|
|
9
|
-
export type SymMatcherValue = string | RegExp | null;
|
|
10
|
-
export type SymMatcherHandler<Ctx> = NodeHandler<Ctx, SymbolToken>;
|
|
11
|
-
export interface SymMatcherOptions<Ctx> {
|
|
12
|
-
value: SymMatcherValue;
|
|
13
|
-
handler: SymMatcherHandler<Ctx> | null;
|
|
14
|
-
}
|
|
15
|
-
export type OpMatcherValue = string | RegExp | null;
|
|
16
|
-
export type OpMatcherHandler<Ctx> = NodeHandler<Ctx, OperatorToken>;
|
|
17
|
-
export interface OpMatcherOptions<Ctx> {
|
|
18
|
-
value: OpMatcherValue;
|
|
19
|
-
handler: OpMatcherHandler<Ctx> | null;
|
|
20
|
-
}
|
|
21
|
-
export type CommentMatcherValue = string | RegExp | null;
|
|
22
|
-
export type CommentMatcherHandler<Ctx> = NodeHandler<Ctx, CommentToken>;
|
|
23
|
-
export interface CommentMatcherOptions<Ctx> {
|
|
24
|
-
value: CommentMatcherValue;
|
|
25
|
-
handler: CommentMatcherHandler<Ctx> | null;
|
|
26
|
-
}
|
|
27
|
-
export type NumMatcherValue = string | RegExp | null;
|
|
28
|
-
export type NumMatcherHandler<Ctx> = NodeHandler<Ctx, NumberToken>;
|
|
29
|
-
export interface NumMatcherOptions<Ctx> {
|
|
30
|
-
value: NumMatcherValue;
|
|
31
|
-
handler: NumMatcherHandler<Ctx> | null;
|
|
32
|
-
}
|
|
33
|
-
export interface SeqMatcherOptions<Ctx> {
|
|
34
|
-
matchers: Matcher<Ctx>[];
|
|
35
|
-
}
|
|
36
|
-
export type TreeMatcherType = TreeType | null;
|
|
37
|
-
export type TreeMatcherHandler<Ctx> = NodeHandler<Ctx, Tree>;
|
|
38
|
-
export interface TreeOptionsBase<Ctx> {
|
|
39
|
-
type?: TreeMatcherType;
|
|
40
|
-
startsWith?: string | null;
|
|
41
|
-
endsWith?: string | null;
|
|
42
|
-
maxDepth?: number | null;
|
|
43
|
-
maxMatches?: number | null;
|
|
44
|
-
preHandler?: TreeMatcherHandler<Ctx>;
|
|
45
|
-
postHandler?: TreeMatcherHandler<Ctx>;
|
|
46
|
-
}
|
|
47
|
-
export interface Matcher<Ctx> {
|
|
48
|
-
seekNext(cursor: Cursor): Cursor;
|
|
49
|
-
match(checkpoint: Checkpoint<Ctx>): Checkpoint<Ctx> | null;
|
|
50
|
-
nextMatch(): Checkpoint<Ctx> | null;
|
|
51
|
-
readonly preventSkipping?: MinorToken['type'];
|
|
52
|
-
}
|
|
53
|
-
export interface ManyBuilderOpts<Ctx> {
|
|
54
|
-
builder: QueryBuilder<Ctx, Node>;
|
|
55
|
-
min: number;
|
|
56
|
-
max: number | null;
|
|
57
|
-
}
|
|
58
|
-
export interface ManyMatcherOptions<Ctx> {
|
|
59
|
-
matcher: Matcher<Ctx>;
|
|
60
|
-
min: number;
|
|
61
|
-
max: number | null;
|
|
62
|
-
}
|
|
63
|
-
export interface TreeBuilderOptions<Ctx> extends TreeOptionsBase<Ctx> {
|
|
64
|
-
search?: QueryBuilder<Ctx, Node> | null;
|
|
65
|
-
}
|
|
66
|
-
export interface AltMatcherOptions<Ctx> {
|
|
67
|
-
matchers: Matcher<Ctx>[];
|
|
68
|
-
}
|
|
69
|
-
export type StrTreeHandler<Ctx> = NodeHandler<Ctx, StringTree>;
|
|
70
|
-
export interface StrTreeOptionsBase<Ctx> {
|
|
71
|
-
preHandler?: StrTreeHandler<Ctx> | null;
|
|
72
|
-
postHandler?: StrTreeHandler<Ctx> | null;
|
|
73
|
-
}
|
|
74
|
-
type StrTplHandler<Ctx> = NodeHandler<Ctx, TemplateTree>;
|
|
75
|
-
export interface StrTplOptionsBase<Ctx> {
|
|
76
|
-
preHandler?: StrTplHandler<Ctx> | null;
|
|
77
|
-
postHandler?: StrTplHandler<Ctx> | null;
|
|
78
|
-
}
|
|
79
|
-
export interface StrContentBuilderOptionsBase<Ctx> {
|
|
80
|
-
match?: string | RegExp | null;
|
|
81
|
-
handler?: StrContentMatcherHandler<Ctx> | null;
|
|
82
|
-
}
|
|
83
|
-
export interface StrTreeBuilderOptionsBase<Ctx> {
|
|
84
|
-
match?: (string | RegExp | QueryBuilder<Ctx, Node>)[] | null;
|
|
85
|
-
preHandler?: NodeHandler<Ctx, StringTree> | null;
|
|
86
|
-
postHandler?: NodeHandler<Ctx, StringTree> | null;
|
|
87
|
-
}
|
|
88
|
-
export type StrBuilderOptionsBase<Ctx> = StrContentBuilderOptionsBase<Ctx> | StrTreeBuilderOptionsBase<Ctx>;
|
|
89
|
-
export interface StrContentBuilderOptions<Ctx> extends StrContentBuilderOptionsBase<Ctx> {
|
|
90
|
-
type: 'str-content';
|
|
91
|
-
}
|
|
92
|
-
export interface StrTreeBuilderOptions<Ctx> extends StrTreeBuilderOptionsBase<Ctx> {
|
|
93
|
-
type: 'str-tree';
|
|
94
|
-
}
|
|
95
|
-
export type StrBuilderOptions<Ctx> = StrContentBuilderOptions<Ctx> | StrTreeBuilderOptions<Ctx>;
|
|
96
|
-
export interface QueryBuilder<Ctx, T extends Node> {
|
|
97
|
-
handler(fn: (ctx: Ctx, t: T) => Ctx): QueryBuilder<Ctx, T>;
|
|
98
|
-
build(): Matcher<Ctx>;
|
|
99
|
-
}
|
|
100
|
-
export {};
|
|
1
|
+
import type { CommentToken, MinorToken, NumberToken, OperatorToken, SymbolToken } from '../lexer/types';
|
|
2
|
+
import type { Cursor, Node, StringTree, TemplateTree, Tree, TreeType } from '../parser/types';
|
|
3
|
+
import type { StrContentMatcherHandler } from './matchers/str-matcher';
|
|
4
|
+
export interface Checkpoint<Ctx> {
|
|
5
|
+
cursor: Cursor;
|
|
6
|
+
context: Ctx;
|
|
7
|
+
}
|
|
8
|
+
export type NodeHandler<Ctx, T extends Node> = (ctx: Ctx, tree: T) => Ctx;
|
|
9
|
+
export type SymMatcherValue = string | RegExp | null;
|
|
10
|
+
export type SymMatcherHandler<Ctx> = NodeHandler<Ctx, SymbolToken>;
|
|
11
|
+
export interface SymMatcherOptions<Ctx> {
|
|
12
|
+
value: SymMatcherValue;
|
|
13
|
+
handler: SymMatcherHandler<Ctx> | null;
|
|
14
|
+
}
|
|
15
|
+
export type OpMatcherValue = string | RegExp | null;
|
|
16
|
+
export type OpMatcherHandler<Ctx> = NodeHandler<Ctx, OperatorToken>;
|
|
17
|
+
export interface OpMatcherOptions<Ctx> {
|
|
18
|
+
value: OpMatcherValue;
|
|
19
|
+
handler: OpMatcherHandler<Ctx> | null;
|
|
20
|
+
}
|
|
21
|
+
export type CommentMatcherValue = string | RegExp | null;
|
|
22
|
+
export type CommentMatcherHandler<Ctx> = NodeHandler<Ctx, CommentToken>;
|
|
23
|
+
export interface CommentMatcherOptions<Ctx> {
|
|
24
|
+
value: CommentMatcherValue;
|
|
25
|
+
handler: CommentMatcherHandler<Ctx> | null;
|
|
26
|
+
}
|
|
27
|
+
export type NumMatcherValue = string | RegExp | null;
|
|
28
|
+
export type NumMatcherHandler<Ctx> = NodeHandler<Ctx, NumberToken>;
|
|
29
|
+
export interface NumMatcherOptions<Ctx> {
|
|
30
|
+
value: NumMatcherValue;
|
|
31
|
+
handler: NumMatcherHandler<Ctx> | null;
|
|
32
|
+
}
|
|
33
|
+
export interface SeqMatcherOptions<Ctx> {
|
|
34
|
+
matchers: Matcher<Ctx>[];
|
|
35
|
+
}
|
|
36
|
+
export type TreeMatcherType = TreeType | null;
|
|
37
|
+
export type TreeMatcherHandler<Ctx> = NodeHandler<Ctx, Tree>;
|
|
38
|
+
export interface TreeOptionsBase<Ctx> {
|
|
39
|
+
type?: TreeMatcherType;
|
|
40
|
+
startsWith?: string | null;
|
|
41
|
+
endsWith?: string | null;
|
|
42
|
+
maxDepth?: number | null;
|
|
43
|
+
maxMatches?: number | null;
|
|
44
|
+
preHandler?: TreeMatcherHandler<Ctx>;
|
|
45
|
+
postHandler?: TreeMatcherHandler<Ctx>;
|
|
46
|
+
}
|
|
47
|
+
export interface Matcher<Ctx> {
|
|
48
|
+
seekNext(cursor: Cursor): Cursor;
|
|
49
|
+
match(checkpoint: Checkpoint<Ctx>): Checkpoint<Ctx> | null;
|
|
50
|
+
nextMatch(): Checkpoint<Ctx> | null;
|
|
51
|
+
readonly preventSkipping?: MinorToken['type'];
|
|
52
|
+
}
|
|
53
|
+
export interface ManyBuilderOpts<Ctx> {
|
|
54
|
+
builder: QueryBuilder<Ctx, Node>;
|
|
55
|
+
min: number;
|
|
56
|
+
max: number | null;
|
|
57
|
+
}
|
|
58
|
+
export interface ManyMatcherOptions<Ctx> {
|
|
59
|
+
matcher: Matcher<Ctx>;
|
|
60
|
+
min: number;
|
|
61
|
+
max: number | null;
|
|
62
|
+
}
|
|
63
|
+
export interface TreeBuilderOptions<Ctx> extends TreeOptionsBase<Ctx> {
|
|
64
|
+
search?: QueryBuilder<Ctx, Node> | null;
|
|
65
|
+
}
|
|
66
|
+
export interface AltMatcherOptions<Ctx> {
|
|
67
|
+
matchers: Matcher<Ctx>[];
|
|
68
|
+
}
|
|
69
|
+
export type StrTreeHandler<Ctx> = NodeHandler<Ctx, StringTree>;
|
|
70
|
+
export interface StrTreeOptionsBase<Ctx> {
|
|
71
|
+
preHandler?: StrTreeHandler<Ctx> | null;
|
|
72
|
+
postHandler?: StrTreeHandler<Ctx> | null;
|
|
73
|
+
}
|
|
74
|
+
type StrTplHandler<Ctx> = NodeHandler<Ctx, TemplateTree>;
|
|
75
|
+
export interface StrTplOptionsBase<Ctx> {
|
|
76
|
+
preHandler?: StrTplHandler<Ctx> | null;
|
|
77
|
+
postHandler?: StrTplHandler<Ctx> | null;
|
|
78
|
+
}
|
|
79
|
+
export interface StrContentBuilderOptionsBase<Ctx> {
|
|
80
|
+
match?: string | RegExp | null;
|
|
81
|
+
handler?: StrContentMatcherHandler<Ctx> | null;
|
|
82
|
+
}
|
|
83
|
+
export interface StrTreeBuilderOptionsBase<Ctx> {
|
|
84
|
+
match?: (string | RegExp | QueryBuilder<Ctx, Node>)[] | null;
|
|
85
|
+
preHandler?: NodeHandler<Ctx, StringTree> | null;
|
|
86
|
+
postHandler?: NodeHandler<Ctx, StringTree> | null;
|
|
87
|
+
}
|
|
88
|
+
export type StrBuilderOptionsBase<Ctx> = StrContentBuilderOptionsBase<Ctx> | StrTreeBuilderOptionsBase<Ctx>;
|
|
89
|
+
export interface StrContentBuilderOptions<Ctx> extends StrContentBuilderOptionsBase<Ctx> {
|
|
90
|
+
type: 'str-content';
|
|
91
|
+
}
|
|
92
|
+
export interface StrTreeBuilderOptions<Ctx> extends StrTreeBuilderOptionsBase<Ctx> {
|
|
93
|
+
type: 'str-tree';
|
|
94
|
+
}
|
|
95
|
+
export type StrBuilderOptions<Ctx> = StrContentBuilderOptions<Ctx> | StrTreeBuilderOptions<Ctx>;
|
|
96
|
+
export interface QueryBuilder<Ctx, T extends Node> {
|
|
97
|
+
handler(fn: (ctx: Ctx, t: T) => Ctx): QueryBuilder<Ctx, T>;
|
|
98
|
+
build(): Matcher<Ctx>;
|
|
99
|
+
}
|
|
100
|
+
export {};
|
|
101
101
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/cjs/query/types.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
//# sourceMappingURL=types.js.map
|
package/dist/cjs/util/clone.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { klona as clone } from 'klona/lite';
|
|
1
|
+
export { klona as clone } from 'klona/lite';
|
|
2
2
|
//# sourceMappingURL=clone.d.ts.map
|
package/dist/cjs/util/clone.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.clone = void 0;
|
|
4
|
-
var lite_1 = require("klona/lite");
|
|
5
|
-
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return lite_1.klona; } });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clone = void 0;
|
|
4
|
+
var lite_1 = require("klona/lite");
|
|
5
|
+
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return lite_1.klona; } });
|
|
6
6
|
//# sourceMappingURL=clone.js.map
|
package/dist/cjs/util/regex.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function escape(input: string): string;
|
|
1
|
+
export declare function escape(input: string): string;
|
|
2
2
|
//# sourceMappingURL=regex.d.ts.map
|
package/dist/cjs/util/regex.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.escape = void 0;
|
|
4
|
-
function escape(input) {
|
|
5
|
-
return input.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
6
|
-
}
|
|
7
|
-
exports.escape = escape;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.escape = void 0;
|
|
4
|
+
function escape(input) {
|
|
5
|
+
return input.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
6
|
+
}
|
|
7
|
+
exports.escape = escape;
|
|
8
8
|
//# sourceMappingURL=regex.js.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * as lang from './lang';
|
|
2
|
-
export * as lexer from './lexer';
|
|
3
|
-
export * as parser from './parser';
|
|
4
|
-
export * as query from './query';
|
|
1
|
+
export * as lang from './lang';
|
|
2
|
+
export * as lexer from './lexer';
|
|
3
|
+
export * as parser from './parser';
|
|
4
|
+
export * as query from './query';
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import * as lang_1 from './lang';
|
|
2
|
-
export { lang_1 as lang };
|
|
3
|
-
import * as lexer_1 from './lexer';
|
|
4
|
-
export { lexer_1 as lexer };
|
|
5
|
-
import * as parser_1 from './parser';
|
|
6
|
-
export { parser_1 as parser };
|
|
7
|
-
import * as query_1 from './query';
|
|
8
|
-
export { query_1 as query };
|
|
1
|
+
import * as lang_1 from './lang';
|
|
2
|
+
export { lang_1 as lang };
|
|
3
|
+
import * as lexer_1 from './lexer';
|
|
4
|
+
export { lexer_1 as lexer };
|
|
5
|
+
import * as parser_1 from './parser';
|
|
6
|
+
export { parser_1 as parser };
|
|
7
|
+
import * as query_1 from './query';
|
|
8
|
+
export { query_1 as query };
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { LexerConfig } from '../lexer/types';
|
|
2
|
-
import type { ParserConfig } from '../parser/types';
|
|
3
|
-
import type { LanguageConfig } from './types';
|
|
4
|
-
export declare const lexer: LexerConfig;
|
|
5
|
-
export declare const parser: ParserConfig;
|
|
6
|
-
export declare const lang: LanguageConfig;
|
|
1
|
+
import type { LexerConfig } from '../lexer/types';
|
|
2
|
+
import type { ParserConfig } from '../parser/types';
|
|
3
|
+
import type { LanguageConfig } from './types';
|
|
4
|
+
export declare const lexer: LexerConfig;
|
|
5
|
+
export declare const parser: ParserConfig;
|
|
6
|
+
export declare const lang: LanguageConfig;
|
|
7
7
|
//# sourceMappingURL=groovy.d.ts.map
|