@libreflare/worker-runtime 0.8.3 → 0.9.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 +230 -23
- package/dist/log-handler.d.ts.map +1 -1
- package/dist/log-handler.js +12 -6
- package/dist/log-handler.js.map +1 -1
- package/dist/rule-evaluator/access-values.d.ts +19 -6
- package/dist/rule-evaluator/access-values.d.ts.map +1 -1
- package/dist/rule-evaluator/access-values.js +33 -8
- package/dist/rule-evaluator/access-values.js.map +1 -1
- package/dist/rule-evaluator/analysis.d.ts +49 -17
- package/dist/rule-evaluator/analysis.d.ts.map +1 -1
- package/dist/rule-evaluator/analysis.js +39 -41
- package/dist/rule-evaluator/analysis.js.map +1 -1
- package/dist/rule-evaluator/ast.d.ts +31 -18
- package/dist/rule-evaluator/ast.d.ts.map +1 -1
- package/dist/rule-evaluator/ast.js +3 -4
- package/dist/rule-evaluator/ast.js.map +1 -1
- package/dist/rule-evaluator/constants.d.ts +1 -1
- package/dist/rule-evaluator/constants.d.ts.map +1 -1
- package/dist/rule-evaluator/constants.js +3 -0
- package/dist/rule-evaluator/constants.js.map +1 -1
- package/dist/rule-evaluator/country-codes.generated.js +1 -1
- package/dist/rule-evaluator/custom-lists.d.ts +0 -6
- package/dist/rule-evaluator/custom-lists.d.ts.map +1 -1
- package/dist/rule-evaluator/custom-lists.js +1 -12
- package/dist/rule-evaluator/custom-lists.js.map +1 -1
- package/dist/rule-evaluator/diagnostics.d.ts +1 -1
- package/dist/rule-evaluator/diagnostics.d.ts.map +1 -1
- package/dist/rule-evaluator/diagnostics.js +17 -0
- package/dist/rule-evaluator/diagnostics.js.map +1 -1
- package/dist/rule-evaluator/engine-observations.generated.d.ts +20 -0
- package/dist/rule-evaluator/engine-observations.generated.d.ts.map +1 -1
- package/dist/rule-evaluator/engine-observations.generated.js +5 -0
- package/dist/rule-evaluator/engine-observations.generated.js.map +1 -1
- package/dist/rule-evaluator/evaluator.d.ts +4 -2
- package/dist/rule-evaluator/evaluator.d.ts.map +1 -1
- package/dist/rule-evaluator/evaluator.js +5 -4
- package/dist/rule-evaluator/evaluator.js.map +1 -1
- package/dist/rule-evaluator/explain.d.ts +2 -1
- package/dist/rule-evaluator/explain.d.ts.map +1 -1
- package/dist/rule-evaluator/explain.js +49 -7
- package/dist/rule-evaluator/explain.js.map +1 -1
- package/dist/rule-evaluator/field-descriptions.generated.d.ts +13 -0
- package/dist/rule-evaluator/field-descriptions.generated.d.ts.map +1 -1
- package/dist/rule-evaluator/field-descriptions.generated.js +33 -0
- package/dist/rule-evaluator/field-descriptions.generated.js.map +1 -1
- package/dist/rule-evaluator/fields.d.ts +13 -1
- package/dist/rule-evaluator/fields.d.ts.map +1 -1
- package/dist/rule-evaluator/fields.js +71 -17
- package/dist/rule-evaluator/fields.js.map +1 -1
- package/dist/rule-evaluator/function-descriptions.d.ts +2 -0
- package/dist/rule-evaluator/function-descriptions.d.ts.map +1 -1
- package/dist/rule-evaluator/function-descriptions.generated.d.ts +66 -10
- package/dist/rule-evaluator/function-descriptions.generated.d.ts.map +1 -1
- package/dist/rule-evaluator/function-descriptions.generated.js +129 -11
- package/dist/rule-evaluator/function-descriptions.generated.js.map +1 -1
- package/dist/rule-evaluator/function-descriptions.js.map +1 -1
- package/dist/rule-evaluator/function-signature-validation.d.ts +2 -0
- package/dist/rule-evaluator/function-signature-validation.d.ts.map +1 -1
- package/dist/rule-evaluator/function-signature-validation.js +169 -19
- package/dist/rule-evaluator/function-signature-validation.js.map +1 -1
- package/dist/rule-evaluator/functions.d.ts +24 -1
- package/dist/rule-evaluator/functions.d.ts.map +1 -1
- package/dist/rule-evaluator/functions.js +423 -95
- package/dist/rule-evaluator/functions.js.map +1 -1
- package/dist/rule-evaluator/ip-literals.d.ts +56 -0
- package/dist/rule-evaluator/ip-literals.d.ts.map +1 -0
- package/dist/rule-evaluator/ip-literals.js +162 -0
- package/dist/rule-evaluator/ip-literals.js.map +1 -0
- package/dist/rule-evaluator/log-sample.d.ts.map +1 -1
- package/dist/rule-evaluator/log-sample.js +14 -2
- package/dist/rule-evaluator/log-sample.js.map +1 -1
- package/dist/rule-evaluator/match-chain.d.ts +2 -1
- package/dist/rule-evaluator/match-chain.d.ts.map +1 -1
- package/dist/rule-evaluator/match-chain.js +12 -17
- package/dist/rule-evaluator/match-chain.js.map +1 -1
- package/dist/rule-evaluator/minifier.d.ts +1 -1
- package/dist/rule-evaluator/minifier.d.ts.map +1 -1
- package/dist/rule-evaluator/minifier.js +15 -14
- package/dist/rule-evaluator/minifier.js.map +1 -1
- package/dist/rule-evaluator/normalizer.d.ts +1 -1
- package/dist/rule-evaluator/normalizer.d.ts.map +1 -1
- package/dist/rule-evaluator/normalizer.js +4 -5
- package/dist/rule-evaluator/normalizer.js.map +1 -1
- package/dist/rule-evaluator/operators.d.ts +4 -0
- package/dist/rule-evaluator/operators.d.ts.map +1 -1
- package/dist/rule-evaluator/operators.js +26 -98
- package/dist/rule-evaluator/operators.js.map +1 -1
- package/dist/rule-evaluator/outcome.d.ts +2 -0
- package/dist/rule-evaluator/outcome.d.ts.map +1 -1
- package/dist/rule-evaluator/outcome.js +0 -6
- package/dist/rule-evaluator/outcome.js.map +1 -1
- package/dist/rule-evaluator/parse-cache.d.ts +8 -3
- package/dist/rule-evaluator/parse-cache.d.ts.map +1 -1
- package/dist/rule-evaluator/parse-cache.js +9 -8
- package/dist/rule-evaluator/parse-cache.js.map +1 -1
- package/dist/rule-evaluator/parser.d.ts +155 -18
- package/dist/rule-evaluator/parser.d.ts.map +1 -1
- package/dist/rule-evaluator/parser.js +478 -81
- package/dist/rule-evaluator/parser.js.map +1 -1
- package/dist/rule-evaluator/quantifier.d.ts +96 -2
- package/dist/rule-evaluator/quantifier.d.ts.map +1 -1
- package/dist/rule-evaluator/quantifier.js +263 -22
- package/dist/rule-evaluator/quantifier.js.map +1 -1
- package/dist/rule-evaluator/query-args.d.ts +23 -0
- package/dist/rule-evaluator/query-args.d.ts.map +1 -0
- package/dist/rule-evaluator/query-args.js +46 -0
- package/dist/rule-evaluator/query-args.js.map +1 -0
- package/dist/rule-evaluator/rule-language-types.d.ts +28 -17
- package/dist/rule-evaluator/rule-language-types.d.ts.map +1 -1
- package/dist/rule-evaluator/rule-language-types.js +117 -42
- package/dist/rule-evaluator/rule-language-types.js.map +1 -1
- package/dist/rule-evaluator/string-literals.d.ts +20 -0
- package/dist/rule-evaluator/string-literals.d.ts.map +1 -0
- package/dist/rule-evaluator/string-literals.js +44 -0
- package/dist/rule-evaluator/string-literals.js.map +1 -0
- package/dist/rule-evaluator/tokenizer.d.ts +34 -5
- package/dist/rule-evaluator/tokenizer.d.ts.map +1 -1
- package/dist/rule-evaluator/tokenizer.js +320 -74
- package/dist/rule-evaluator/tokenizer.js.map +1 -1
- package/dist/rule-evaluator/transformation.d.ts +2 -2
- package/dist/rule-evaluator/transformation.d.ts.map +1 -1
- package/dist/rule-evaluator/transformation.js +4 -5
- package/dist/rule-evaluator/transformation.js.map +1 -1
- package/dist/rule-evaluator/validation.d.ts.map +1 -1
- package/dist/rule-evaluator/validation.js +261 -122
- package/dist/rule-evaluator/validation.js.map +1 -1
- package/dist/rule-evaluator.d.ts +3 -1
- package/dist/rule-evaluator.d.ts.map +1 -1
- package/dist/rule-evaluator.js +2 -0
- package/dist/rule-evaluator.js.map +1 -1
- package/dist/runtime-config.d.ts.map +1 -1
- package/dist/runtime-config.js +4 -3
- package/dist/runtime-config.js.map +1 -1
- package/dist/tools/explain-rule-miss.js +4 -6
- package/dist/tools/explain-rule-miss.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,6 +1,19 @@
|
|
|
1
|
+
import { type RuleExpressionDataType } from './rule-language-types.js';
|
|
1
2
|
import { type ComparisonValueNode, type ExprNode } from './ast.js';
|
|
2
3
|
import { type RuleExpressionDiagnosticDetail } from './diagnostics.js';
|
|
3
|
-
import { type Token } from './tokenizer.js';
|
|
4
|
+
import { type Token, type TokenizeMetadata, type TokenizeOptions } from './tokenizer.js';
|
|
5
|
+
/**
|
|
6
|
+
* The type a number literal is read as first: the comparison's left side's,
|
|
7
|
+
* when that is an Integer or an IP address, as Cloudflare reads a literal by
|
|
8
|
+
* the type its place expects. Null means none.
|
|
9
|
+
*/
|
|
10
|
+
export type LiteralType = 'number' | 'ip' | null;
|
|
11
|
+
/**
|
|
12
|
+
* The type to read a literal compared with a value of a type as; see
|
|
13
|
+
* LiteralType. An array's is its elements', which any() and all() compare
|
|
14
|
+
* one by one, as in `any(cf.waf.content_scan.obj_sizes[*] in {10-20})`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function literalTypeOf(type: RuleExpressionDataType): LiteralType;
|
|
4
17
|
export declare class Parser {
|
|
5
18
|
private source;
|
|
6
19
|
private diagnostics?;
|
|
@@ -33,6 +46,23 @@ export declare class Parser {
|
|
|
33
46
|
* call node is not in the set.
|
|
34
47
|
*/
|
|
35
48
|
private readonly cutShortCalls;
|
|
49
|
+
/** Whether the input holds a line break, which only then a string can span; see reportMultilineStrings(). */
|
|
50
|
+
private readonly multiline;
|
|
51
|
+
/** Whether the input has a syntax error, from the parser, or from the tokenizer in input over lines. */
|
|
52
|
+
private syntaxError;
|
|
53
|
+
/**
|
|
54
|
+
* The quoted strings it read as a value the other way than the tokenizer
|
|
55
|
+
* did, by position, with whether each is the value of `matches`; see
|
|
56
|
+
* parseSource().
|
|
57
|
+
*/
|
|
58
|
+
misreadStrings: Map<number, boolean> | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* The left side of the comparison whose value parseComparisonValue()
|
|
61
|
+
* reads, kept here rather than passed, so that the frame each nested
|
|
62
|
+
* comparison adds stays small. Nothing that runs before it reads a literal
|
|
63
|
+
* value parses another comparison, so it is still that comparison's.
|
|
64
|
+
*/
|
|
65
|
+
private comparisonLeft;
|
|
36
66
|
constructor(tokens: Token[], source: string, diagnostics?: RuleExpressionDiagnosticDetail[] | undefined);
|
|
37
67
|
parse(): ExprNode;
|
|
38
68
|
/**
|
|
@@ -40,10 +70,28 @@ export declare class Parser {
|
|
|
40
70
|
* invalid, with an error. What follows the value is read as after an
|
|
41
71
|
* operand at the top level, and a field or call that recovery cuts short
|
|
42
72
|
* is kept as fieldCondition() keeps it, since the text may be a comparison.
|
|
73
|
+
* `literalType` is the type of the side the value is for; see LiteralType.
|
|
74
|
+
*/
|
|
75
|
+
parseValueExpression(afterMatches?: boolean, literalType?: LiteralType): ComparisonValueNode;
|
|
76
|
+
/**
|
|
77
|
+
* Warns at each closed quoted string whose text holds a line break, when
|
|
78
|
+
* the input has a syntax error. A string may hold one, but a missing
|
|
79
|
+
* closing quote takes in the lines after it, up to the next `"`, so the
|
|
80
|
+
* errors land after the mistake, and the warning points back at it. A line
|
|
81
|
+
* break in an escape, or in a regex class, can't come from a missing quote;
|
|
82
|
+
* see stringLineBreak().
|
|
43
83
|
*/
|
|
44
|
-
|
|
84
|
+
private reportMultilineStrings;
|
|
85
|
+
private readValueExpression;
|
|
45
86
|
/** The value at the current token. A name is a field, since a value read on its own has no side. */
|
|
46
87
|
private parseLoneValue;
|
|
88
|
+
/**
|
|
89
|
+
* Notes the string after the noise and unknown characters at the current
|
|
90
|
+
* token, which starts no value, as the value of `matches`: it is once they
|
|
91
|
+
* are gone, even where recovery reads them as the value instead. Unlike
|
|
92
|
+
* skipNoise(), it reads past an unknown character.
|
|
93
|
+
*/
|
|
94
|
+
private noteMatchesValueAfterNoise;
|
|
47
95
|
/** Reports a condition where a value belongs, and reads it as invalid. */
|
|
48
96
|
private conditionInsteadOfValue;
|
|
49
97
|
/** Skips the rest of the input, and returns an InvalidNode from `startPos` through the last token. */
|
|
@@ -60,10 +108,8 @@ export declare class Parser {
|
|
|
60
108
|
* delimiter, or '' for any other. What was meant to follow such a token
|
|
61
109
|
* may be in it, but only where its text holds it: in
|
|
62
110
|
* `coalesce(http.host eq "x, ssl)` the string holds the `)`, and in
|
|
63
|
-
* `lower(http.host eq "ab` it holds nothing.
|
|
64
|
-
*
|
|
65
|
-
* reads the tokenizer's tokens, since an unknown character that the
|
|
66
|
-
* parser reads past still follows the string, on a later line.
|
|
111
|
+
* `lower(http.host eq "ab` it holds nothing. Every token without its
|
|
112
|
+
* closing delimiter runs to the end of the input.
|
|
67
113
|
*/
|
|
68
114
|
private hiddenText;
|
|
69
115
|
private rawSpan;
|
|
@@ -141,6 +187,14 @@ export declare class Parser {
|
|
|
141
187
|
private isCutShort;
|
|
142
188
|
private parseFieldRef;
|
|
143
189
|
private parseAccessPath;
|
|
190
|
+
/**
|
|
191
|
+
* Reports a space, or a comment, before the `[` of an access. Cloudflare
|
|
192
|
+
* reads an access only right after its field, call, or previous access, and
|
|
193
|
+
* ends the value at the space. The access is read as written all the same.
|
|
194
|
+
* After a stray closer, or an access without its `]`, the space is part of
|
|
195
|
+
* that error.
|
|
196
|
+
*/
|
|
197
|
+
private reportSpaceBeforeAccess;
|
|
144
198
|
/**
|
|
145
199
|
* The value of an access, or null when it is not a valid one, after
|
|
146
200
|
* reporting it. A number or string touching an unknown character is the
|
|
@@ -148,13 +202,28 @@ export declare class Parser {
|
|
|
148
202
|
*/
|
|
149
203
|
private parseAccessValue;
|
|
150
204
|
private parseComparisonValue;
|
|
205
|
+
/**
|
|
206
|
+
* A comparison's literal value, with a number literal read as the type of
|
|
207
|
+
* `comparisonLeft` first; see LiteralType. Its own method, so that the
|
|
208
|
+
* frame each nested comparison adds stays small.
|
|
209
|
+
*/
|
|
210
|
+
private parseLiteralComparisonValue;
|
|
151
211
|
private tryParseDynamicValue;
|
|
152
212
|
private isMissingComparisonValueBoundary;
|
|
153
213
|
private previousTokenEnd;
|
|
154
214
|
private fieldLength;
|
|
155
215
|
/** Reads the comparison operator at the current token, if one starts there; see isComparisonStart(). */
|
|
156
216
|
private tryParseCompOp;
|
|
157
|
-
/**
|
|
217
|
+
/**
|
|
218
|
+
* Notes a quoted string read as a value the other way than the tokenizer
|
|
219
|
+
* did: as the value of `matches`, or as any other value.
|
|
220
|
+
*/
|
|
221
|
+
private noteReading;
|
|
222
|
+
/**
|
|
223
|
+
* A literal value, or an InvalidNode for one that is not valid, such as an
|
|
224
|
+
* unquoted name, after reporting it. A number literal is read as
|
|
225
|
+
* `literalType` first; see LiteralType.
|
|
226
|
+
*/
|
|
158
227
|
private parseValue;
|
|
159
228
|
/**
|
|
160
229
|
* Consumes an invalid value: one token, or an opener with everything up to
|
|
@@ -163,10 +232,42 @@ export declare class Parser {
|
|
|
163
232
|
* which holds only values, it holds nothing, and the members after it stay.
|
|
164
233
|
*/
|
|
165
234
|
private skipInvalidValue;
|
|
166
|
-
/**
|
|
167
|
-
|
|
235
|
+
/**
|
|
236
|
+
* A number token as one value: an integer, with its exact `integer` value,
|
|
237
|
+
* or one IP address. Text that neither reads gets the error of the type
|
|
238
|
+
* its place expects, or with none, of the type its text suggests. A literal
|
|
239
|
+
* that only the other type reads stays one, for the type check to report,
|
|
240
|
+
* as in `ip.src eq 1`. Cloudflare reads a function argument as an IP
|
|
241
|
+
* address, then an integer, whatever its parameter, so the parameter's
|
|
242
|
+
* type picks only the error. An argument can't be hex, which Cloudflare
|
|
243
|
+
* reads as a name there.
|
|
244
|
+
*/
|
|
245
|
+
private numberValue;
|
|
246
|
+
/** The type the innermost call's parameter for the argument read declares, as a LiteralType. */
|
|
247
|
+
private argumentLiteralType;
|
|
168
248
|
private parseSetLiteral;
|
|
169
|
-
/**
|
|
249
|
+
/**
|
|
250
|
+
* An unquoted list member, read as `literalType` first, as Cloudflare
|
|
251
|
+
* reads each member as the type of the list's left side: an integer or
|
|
252
|
+
* integer range, or an IP address, CIDR, or IP range. A member that only
|
|
253
|
+
* the other type reads stays one, for the type check to report. One that
|
|
254
|
+
* neither reads gets the error of the type its place expects, or with
|
|
255
|
+
* none, of the type its text suggests.
|
|
256
|
+
*/
|
|
257
|
+
private setMember;
|
|
258
|
+
/** Reports an integer list member that is not valid: a bound that is not an integer, a missing bound, or reversed bounds. */
|
|
259
|
+
private reportInvalidIntegerMember;
|
|
260
|
+
/** Reports why an IP list member is not valid. */
|
|
261
|
+
private reportInvalidIpMember;
|
|
262
|
+
private reportReversedRange;
|
|
263
|
+
private reportInvalidIpAddress;
|
|
264
|
+
/**
|
|
265
|
+
* Warns at an IPv4 list member with fewer than four parts and no prefix,
|
|
266
|
+
* which is one address, such as 10.1.0.0 for `10.1`, while the network,
|
|
267
|
+
* 10.1.0.0/16, is a likely meaning. It is no syntax error.
|
|
268
|
+
*/
|
|
269
|
+
private warnShortIpv4Address;
|
|
270
|
+
/** A list member that is not a valid element, from its token to the last token read, or of the length given. */
|
|
170
271
|
private invalidMember;
|
|
171
272
|
private parseFuncCall;
|
|
172
273
|
/** Reads a function's name that no `(` follows, reports it, and recovers; the name stands as invalid. */
|
|
@@ -197,6 +298,11 @@ export declare class Parser {
|
|
|
197
298
|
* `coalesce(has_value(...), http.host eq "x")`.
|
|
198
299
|
*/
|
|
199
300
|
private parseFunctionArg;
|
|
301
|
+
/**
|
|
302
|
+
* Reads the logical operators after an argument's first condition as if
|
|
303
|
+
* parentheses were around them, which Cloudflare needs, and reports them.
|
|
304
|
+
*/
|
|
305
|
+
private parseUnparenthesizedLogicalRest;
|
|
200
306
|
/**
|
|
201
307
|
* Reports and skips each token that stands for nothing before what
|
|
202
308
|
* `starts` accepts, when that follows them: before an argument, see
|
|
@@ -209,9 +315,12 @@ export declare class Parser {
|
|
|
209
315
|
private skipNoise;
|
|
210
316
|
/**
|
|
211
317
|
* Skips the tokens that stand for nothing before an argument; see
|
|
212
|
-
* skipNoise().
|
|
213
|
-
*
|
|
214
|
-
* the
|
|
318
|
+
* skipNoise(). Before a quantifier's predicate, `starts` is
|
|
319
|
+
* startsCondition(), since a value there is no predicate: the tokens
|
|
320
|
+
* before one stay, and the first of them gets the error. A comparison
|
|
321
|
+
* operator among them may have lost its left side, which would make the
|
|
322
|
+
* argument a comparison, so that argument and the ones after it are
|
|
323
|
+
* uncertain.
|
|
215
324
|
*/
|
|
216
325
|
private skipNoiseBeforeArgument;
|
|
217
326
|
/** Leaves the argument the innermost call reads, and the ones after it, uncertain; see FuncNode.uncertainFrom. */
|
|
@@ -279,11 +388,11 @@ export declare class Parser {
|
|
|
279
388
|
*/
|
|
280
389
|
private handlerOf;
|
|
281
390
|
/**
|
|
282
|
-
* Whether the innermost construct ends at
|
|
283
|
-
* without its `]`, or a call without its `)` that reads a
|
|
284
|
-
* the comparison cannot be; see takesComparison(). A
|
|
285
|
-
* does not: the comparison belongs to the innermost
|
|
286
|
-
* one holds, such as a condition.
|
|
391
|
+
* Whether the innermost construct ends at the comparison operator at an
|
|
392
|
+
* index: an access without its `]`, or a call without its `)` that reads a
|
|
393
|
+
* value argument the comparison cannot be; see takesComparison(). A
|
|
394
|
+
* construct outside it does not: the comparison belongs to the innermost
|
|
395
|
+
* one, or to what that one holds, such as a condition.
|
|
287
396
|
*/
|
|
288
397
|
private endsAtComparison;
|
|
289
398
|
/** Whether a construct outside the one at `depth` resumes at the current token. */
|
|
@@ -361,6 +470,17 @@ export declare class Parser {
|
|
|
361
470
|
/** A call without a comparison, as a condition; see fieldCondition(). */
|
|
362
471
|
private functionCondition;
|
|
363
472
|
private parseAnyAll;
|
|
473
|
+
/**
|
|
474
|
+
* Parses the argument of any() or all() as Cloudflare does, as a function
|
|
475
|
+
* argument is read: one that starts with `(`, `not`, any() or all() is a
|
|
476
|
+
* whole logical expression, and any other is one condition, which needs
|
|
477
|
+
* parentheses to combine with others. Without its `)`, the quantifier
|
|
478
|
+
* leaves a logical operator after such a condition to the condition around
|
|
479
|
+
* it; see NearestConstructs.
|
|
480
|
+
*/
|
|
481
|
+
private parseQuantifierPredicate;
|
|
482
|
+
/** A logical operator that starts a predicate combines nothing, so it is the predicate, invalid; see invalidArgument(). */
|
|
483
|
+
private invalidLogicalPredicate;
|
|
364
484
|
/**
|
|
365
485
|
* Reads an integer literal, reporting one Cloudflare rejects: one with a
|
|
366
486
|
* fraction, an octal one with the digit 8 or 9, or one outside the 64-bit
|
|
@@ -378,4 +498,21 @@ export declare class Parser {
|
|
|
378
498
|
private reportAtSpan;
|
|
379
499
|
private report;
|
|
380
500
|
}
|
|
501
|
+
/**
|
|
502
|
+
* Tokenizes and parses the input. The tokenizer reads a quoted string right
|
|
503
|
+
* after `matches` as a regex literal, which is always the value of `matches`
|
|
504
|
+
* in valid input. Recovery may read a string in input with errors the other
|
|
505
|
+
* way, as in `http.host matches , "\d"`, so each string the parser read as a
|
|
506
|
+
* value the other way is read again its way, and the input parsed again; see
|
|
507
|
+
* docs/string-literal-alignment.md. Each pass writes into the caller's
|
|
508
|
+
* diagnostics and comments, and a pass that is redone takes its own back.
|
|
509
|
+
* The tokenizer's diagnostics come first; `tokenizerDiagnosticCount` says
|
|
510
|
+
* how many of the last pass's there are. `afterMatches` says that the input
|
|
511
|
+
* follows `matches`; see InternalTokenizeOptions.
|
|
512
|
+
*/
|
|
513
|
+
export declare function parseSource<T>(source: string, diagnostics: RuleExpressionDiagnosticDetail[] | undefined, options: TokenizeOptions, metadata: TokenizeMetadata, parse: (parser: Parser) => T, afterMatches?: boolean): {
|
|
514
|
+
tokens: Token[];
|
|
515
|
+
result: T;
|
|
516
|
+
tokenizerDiagnosticCount: number;
|
|
517
|
+
};
|
|
381
518
|
//# sourceMappingURL=parser.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/rule-evaluator/parser.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../../src/rule-evaluator/parser.ts"],"names":[],"mappings":"AAGA,OAAO,EASN,KAAK,sBAAsB,EAC3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAQN,KAAK,mBAAmB,EAExB,KAAK,QAAQ,EAab,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,KAAK,8BAA8B,EAEnC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAMN,KAAK,KAAK,EACV,KAAK,gBAAgB,EACrB,KAAK,eAAe,EAEpB,MAAM,gBAAgB,CAAC;AAI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