@xano/xanoscript-language-server 12.1.0 → 12.3.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/lexer/datadog.js +57 -0
- package/lexer/error_trigger.js +23 -0
- package/lexer/tokens.js +12 -0
- package/onHover/functions.md +46 -0
- package/package.json +1 -1
- package/parser/clauses/nakedStackFn.js +1 -0
- package/parser/definitions/objectColumnDefinition.js +5 -5
- package/parser/error_trigger_parser.js +88 -0
- package/parser/functions/datadog/datadogLogBulkFn.js +21 -0
- package/parser/functions/datadog/datadogLogFn.js +35 -0
- package/parser/functions/datadog/datadogMetricBulkFn.js +21 -0
- package/parser/functions/datadog/datadogMetricFn.js +35 -0
- package/parser/functions/datadog/register.js +18 -0
- package/parser/functions/datadogFn.js +20 -0
- package/parser/functions/register.js +4 -0
- package/parser/parser.js +3 -0
- package/parser/register.js +5 -0
- package/utils.js +1 -0
package/lexer/datadog.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { DebugLogToken } from "./debug.js";
|
|
2
|
+
import { Identifier } from "./identifier.js";
|
|
3
|
+
import { createTokenByName } from "./utils.js";
|
|
4
|
+
|
|
5
|
+
// datadog
|
|
6
|
+
export const DatadogToken = createTokenByName("datadog", {
|
|
7
|
+
longer_alt: Identifier,
|
|
8
|
+
categories: [Identifier],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
// datadog.log reuses the existing "log" token from debug
|
|
12
|
+
export { DebugLogToken as DatadogLogToken };
|
|
13
|
+
|
|
14
|
+
// datadog.log_bulk
|
|
15
|
+
export const DatadogLogBulkToken = createTokenByName("log_bulk", {
|
|
16
|
+
longer_alt: Identifier,
|
|
17
|
+
categories: [Identifier],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// datadog.metric
|
|
21
|
+
export const DatadogMetricToken = createTokenByName("metric", {
|
|
22
|
+
longer_alt: Identifier,
|
|
23
|
+
categories: [Identifier],
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// datadog.metric_bulk
|
|
27
|
+
export const DatadogMetricBulkToken = createTokenByName("metric_bulk", {
|
|
28
|
+
longer_alt: Identifier,
|
|
29
|
+
categories: [Identifier],
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Order matters: longer patterns must come before shorter prefixes
|
|
33
|
+
// (e.g. metric_bulk before metric) so the lexer matches them correctly.
|
|
34
|
+
// Note: `log_bulk` ordering vs the reused `log` token depends on
|
|
35
|
+
// DatadogTokens being registered before DebugTokens in lexer/tokens.js.
|
|
36
|
+
export const DatadogTokens = [
|
|
37
|
+
DatadogToken,
|
|
38
|
+
DatadogLogBulkToken,
|
|
39
|
+
DatadogMetricBulkToken,
|
|
40
|
+
DatadogMetricToken,
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Maps a token name to a type
|
|
45
|
+
* @param {string} token the token name
|
|
46
|
+
*/
|
|
47
|
+
export function mapTokenToType(token) {
|
|
48
|
+
switch (token) {
|
|
49
|
+
case DatadogToken.name:
|
|
50
|
+
case DatadogLogBulkToken.name:
|
|
51
|
+
case DatadogMetricToken.name:
|
|
52
|
+
case DatadogMetricBulkToken.name:
|
|
53
|
+
return "function";
|
|
54
|
+
default:
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Identifier } from "./identifier.js";
|
|
2
|
+
import { createTokenByName } from "./utils.js";
|
|
3
|
+
|
|
4
|
+
// "error_trigger"
|
|
5
|
+
export const ErrorTriggerToken = createTokenByName("error_trigger", {
|
|
6
|
+
longer_alt: Identifier,
|
|
7
|
+
categories: [Identifier], // could also be an identifier
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const ErrorTriggerTokens = [ErrorTriggerToken];
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Maps a token name to a type
|
|
14
|
+
* @param {string} token the token name
|
|
15
|
+
*/
|
|
16
|
+
export function mapTokenToType(token) {
|
|
17
|
+
switch (token) {
|
|
18
|
+
case ErrorTriggerToken.name:
|
|
19
|
+
return "keyword";
|
|
20
|
+
default:
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}
|
package/lexer/tokens.js
CHANGED
|
@@ -52,8 +52,16 @@ import {
|
|
|
52
52
|
ControlTokens,
|
|
53
53
|
mapTokenToType as mapControlsTokenToType,
|
|
54
54
|
} from "./control.js";
|
|
55
|
+
import {
|
|
56
|
+
DatadogTokens,
|
|
57
|
+
mapTokenToType as mapDatadogTokenToType,
|
|
58
|
+
} from "./datadog.js";
|
|
55
59
|
import { DbTokens, mapTokenToType as mapDbTokenToType } from "./db.js";
|
|
56
60
|
import { DebugTokens, mapTokenToType as mapDebugTokenToType } from "./debug.js";
|
|
61
|
+
import {
|
|
62
|
+
ErrorTriggerTokens,
|
|
63
|
+
mapTokenToType as mapErrorTriggerTokenToType,
|
|
64
|
+
} from "./error_trigger.js";
|
|
57
65
|
import {
|
|
58
66
|
ExpectFnTokens,
|
|
59
67
|
mapTokenToType as mapExpectTokenToType,
|
|
@@ -399,6 +407,7 @@ export const allTokens = uniq([
|
|
|
399
407
|
...UtilTokens,
|
|
400
408
|
...TableTriggerTokens,
|
|
401
409
|
...WorkspaceTriggerTokens,
|
|
410
|
+
...ErrorTriggerTokens,
|
|
402
411
|
...TaskTokens,
|
|
403
412
|
...WorkflowTestTokens,
|
|
404
413
|
...ApiGroupTokens,
|
|
@@ -412,6 +421,7 @@ export const allTokens = uniq([
|
|
|
412
421
|
...RunTokens,
|
|
413
422
|
...ObjectTokens,
|
|
414
423
|
...StreamTokens,
|
|
424
|
+
...DatadogTokens,
|
|
415
425
|
...DebugTokens,
|
|
416
426
|
...ExpectFnTokens,
|
|
417
427
|
...VarTokens,
|
|
@@ -444,8 +454,10 @@ const tokenMappers = [
|
|
|
444
454
|
mapColumnTokenToType,
|
|
445
455
|
mapCommentTokenToType,
|
|
446
456
|
mapControlsTokenToType,
|
|
457
|
+
mapDatadogTokenToType,
|
|
447
458
|
mapDbTokenToType,
|
|
448
459
|
mapDebugTokenToType,
|
|
460
|
+
mapErrorTriggerTokenToType,
|
|
449
461
|
mapExpectTokenToType,
|
|
450
462
|
mapFunctionTokenToType,
|
|
451
463
|
mapLiteralTokenToType,
|
package/onHover/functions.md
CHANGED
|
@@ -287,6 +287,52 @@ A `task` file defines a scheduled job that runs automatically at specified times
|
|
|
287
287
|
|
|
288
288
|
Tasks are ideal for automating recurring operations like generating reports or syncing data.
|
|
289
289
|
|
|
290
|
+
# error_trigger
|
|
291
|
+
|
|
292
|
+
```xs
|
|
293
|
+
error_trigger "notify on errors" {
|
|
294
|
+
input {
|
|
295
|
+
enum event? {
|
|
296
|
+
values = ["new", "regression", "fixed"]
|
|
297
|
+
}
|
|
298
|
+
int id?
|
|
299
|
+
text signature?
|
|
300
|
+
object error? {
|
|
301
|
+
schema {
|
|
302
|
+
text code?
|
|
303
|
+
text message?
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
stack {
|
|
309
|
+
api.request {
|
|
310
|
+
url = "https://hooks.example.com/alerts"
|
|
311
|
+
method = "POST"
|
|
312
|
+
params = {
|
|
313
|
+
event : $input.event
|
|
314
|
+
message: $input.error.message
|
|
315
|
+
}
|
|
316
|
+
} as $api1
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
An `error_trigger` file defines the workspace's error-notification handler, fired when error signatures are first captured, regress, or are marked fixed. Only one `error_trigger` exists per workspace. It includes:
|
|
322
|
+
|
|
323
|
+
- A name (e.g., `"notify on errors"` or `trigger_on_error`) to identify the trigger,
|
|
324
|
+
|
|
325
|
+
- An `input` block describing the payload the runtime delivers, including:
|
|
326
|
+
- `event`: which event fired the trigger — `"new"` (first capture or re-capture after the ~5 minute snapshot dedup window), `"regression"` (a previously-fixed signature re-occurred), or `"fixed"` (a user marked the signature as fixed),
|
|
327
|
+
- `signature`, `id`: stable identifiers for the error,
|
|
328
|
+
- `error`: the captured error `code` and `message`,
|
|
329
|
+
- `caller`, `statement`: where the error originated (null on `"fixed"` events),
|
|
330
|
+
- `actor`: the user who marked it fixed (only on `"fixed"` events),
|
|
331
|
+
- `count`, `first_seen`, `last_seen`, `fixed_at`: occurrence metadata.
|
|
332
|
+
- A `stack` block defining the actions to take — typically calling out to a webhook, sending an email, or otherwise notifying the team.
|
|
333
|
+
|
|
334
|
+
Use an `error_trigger` to wire workspace-wide alerting on top of the error-logs system without subscribing per object or per event source.
|
|
335
|
+
|
|
290
336
|
# run.job
|
|
291
337
|
|
|
292
338
|
```xs
|
package/package.json
CHANGED
|
@@ -44,6 +44,7 @@ export function nakedStackFn($) {
|
|
|
44
44
|
{ ALT: () => $.SUBRULE($.redisFn) },
|
|
45
45
|
{ ALT: () => $.SUBRULE($.controlFn, { ARGS: [options] }) },
|
|
46
46
|
{ ALT: () => $.SUBRULE($.debugFn) },
|
|
47
|
+
{ ALT: () => $.SUBRULE($.datadogFn) },
|
|
47
48
|
{ ALT: () => $.SUBRULE($.storageFn) },
|
|
48
49
|
{ ALT: () => $.SUBRULE($.streamFn) },
|
|
49
50
|
{ ALT: () => $.SUBRULE($.actionCallFn) },
|
|
@@ -26,12 +26,12 @@ export function objectColumnDefinition($) {
|
|
|
26
26
|
// object[]
|
|
27
27
|
iterable = true;
|
|
28
28
|
$.SUBRULE($.arraySlice);
|
|
29
|
+
});
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
31
|
+
// object? (nullable) or object[]? (nullable array)
|
|
32
|
+
$.OPTION3(() => {
|
|
33
|
+
nullable = true;
|
|
34
|
+
$.CONSUME(Question);
|
|
35
35
|
});
|
|
36
36
|
|
|
37
37
|
// Column name (e.g., "user_id", "optional_column", "required_column")
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { LCurly, RCurly } from "../lexer/control.js";
|
|
2
|
+
import { ErrorTriggerToken } from "../lexer/error_trigger.js";
|
|
3
|
+
import { StringLiteral } from "../lexer/literal.js";
|
|
4
|
+
import { Identifier, NewlineToken } from "../lexer/tokens.js";
|
|
5
|
+
|
|
6
|
+
export function errorTriggerDeclaration($) {
|
|
7
|
+
return () => {
|
|
8
|
+
let hasDescription = false;
|
|
9
|
+
let hasGuid = false;
|
|
10
|
+
let hasHistory = false;
|
|
11
|
+
let hasInput = false;
|
|
12
|
+
let hasStack = false;
|
|
13
|
+
let hasTags = false;
|
|
14
|
+
|
|
15
|
+
$.sectionStack.push("errorTriggerDeclaration");
|
|
16
|
+
// Allow leading comments and newlines before the error_trigger declaration
|
|
17
|
+
$.SUBRULE($.optionalCommentBlockFn);
|
|
18
|
+
|
|
19
|
+
const parent = $.CONSUME(ErrorTriggerToken); // error_trigger
|
|
20
|
+
const nameToken = $.OR([
|
|
21
|
+
{ ALT: () => $.CONSUME(StringLiteral) },
|
|
22
|
+
{ ALT: () => $.CONSUME(Identifier) },
|
|
23
|
+
]);
|
|
24
|
+
$.validateDeclarationName(nameToken, "error_trigger");
|
|
25
|
+
$.CONSUME(LCurly); // "{"
|
|
26
|
+
$.MANY(() => {
|
|
27
|
+
$.AT_LEAST_ONE(() => $.CONSUME(NewlineToken)); // at least one new line
|
|
28
|
+
$.OR2([
|
|
29
|
+
{ ALT: () => $.SUBRULE($.commentBlockFn) },
|
|
30
|
+
{
|
|
31
|
+
GATE: () => !hasDescription,
|
|
32
|
+
ALT: () => {
|
|
33
|
+
hasDescription = true;
|
|
34
|
+
$.SUBRULE($.descriptionFieldAttribute);
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
GATE: () => !hasGuid,
|
|
39
|
+
ALT: () => {
|
|
40
|
+
hasGuid = true;
|
|
41
|
+
$.SUBRULE($.guidFieldAttribute);
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
GATE: () => !hasHistory,
|
|
46
|
+
ALT: () => {
|
|
47
|
+
hasHistory = true;
|
|
48
|
+
$.SUBRULE($.historyClause);
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
GATE: () => !hasInput,
|
|
53
|
+
ALT: () => {
|
|
54
|
+
hasInput = true;
|
|
55
|
+
$.SUBRULE($.inputClause);
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
GATE: () => !hasStack,
|
|
60
|
+
ALT: () => {
|
|
61
|
+
hasStack = true;
|
|
62
|
+
$.SUBRULE($.stackClause);
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
GATE: () => !hasTags,
|
|
67
|
+
ALT: () => {
|
|
68
|
+
hasTags = true;
|
|
69
|
+
$.SUBRULE($.tagsAttribute);
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
]);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
if (!hasInput) {
|
|
76
|
+
$.addMissingError(parent, "{} is missing an input clause");
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!hasStack) {
|
|
80
|
+
$.addMissingError(parent, "{} is missing a stack clause");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
$.MANY1(() => $.CONSUME1(NewlineToken)); // optional new line
|
|
84
|
+
$.CONSUME(RCurly); // "}"
|
|
85
|
+
$.MANY2(() => $.CONSUME2(NewlineToken)); // optional new line
|
|
86
|
+
$.sectionStack.pop();
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DatadogLogBulkToken } from "../../../lexer/datadog.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* datadog.log_bulk {
|
|
5
|
+
* entries = $entries
|
|
6
|
+
* }
|
|
7
|
+
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
8
|
+
*/
|
|
9
|
+
export function datadogLogBulkFn($) {
|
|
10
|
+
const requiredAttrs = ["entries"];
|
|
11
|
+
const optionalAttrs = ["description", "disabled"];
|
|
12
|
+
|
|
13
|
+
return () => {
|
|
14
|
+
$.sectionStack.push("datadogLogBulk");
|
|
15
|
+
const tokenFn = $.CONSUME(DatadogLogBulkToken); // log_bulk
|
|
16
|
+
$.SUBRULE($.functionAttrReq, {
|
|
17
|
+
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
18
|
+
});
|
|
19
|
+
$.sectionStack.pop();
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DatadogLogToken } from "../../../lexer/datadog.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* datadog.log {
|
|
5
|
+
* message = "hi"
|
|
6
|
+
* status = "info"
|
|
7
|
+
* attributes = '{"A":"B"}'|json_decode
|
|
8
|
+
* }
|
|
9
|
+
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
10
|
+
*/
|
|
11
|
+
export function datadogLogFn($) {
|
|
12
|
+
const requiredAttrs = ["message"];
|
|
13
|
+
const optionalAttrs = [
|
|
14
|
+
"status",
|
|
15
|
+
"attributes",
|
|
16
|
+
"service",
|
|
17
|
+
"source",
|
|
18
|
+
"env",
|
|
19
|
+
"hostname",
|
|
20
|
+
"ddtags",
|
|
21
|
+
"tags",
|
|
22
|
+
"timestamp",
|
|
23
|
+
"description",
|
|
24
|
+
"disabled",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
return () => {
|
|
28
|
+
$.sectionStack.push("datadogLog");
|
|
29
|
+
const tokenFn = $.CONSUME(DatadogLogToken); // log
|
|
30
|
+
$.SUBRULE($.functionAttrReq, {
|
|
31
|
+
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
32
|
+
});
|
|
33
|
+
$.sectionStack.pop();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DatadogMetricBulkToken } from "../../../lexer/datadog.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* datadog.metric_bulk {
|
|
5
|
+
* entries = $entries
|
|
6
|
+
* }
|
|
7
|
+
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
8
|
+
*/
|
|
9
|
+
export function datadogMetricBulkFn($) {
|
|
10
|
+
const requiredAttrs = ["entries"];
|
|
11
|
+
const optionalAttrs = ["description", "disabled"];
|
|
12
|
+
|
|
13
|
+
return () => {
|
|
14
|
+
$.sectionStack.push("datadogMetricBulk");
|
|
15
|
+
const tokenFn = $.CONSUME(DatadogMetricBulkToken); // metric_bulk
|
|
16
|
+
$.SUBRULE($.functionAttrReq, {
|
|
17
|
+
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
18
|
+
});
|
|
19
|
+
$.sectionStack.pop();
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DatadogMetricToken } from "../../../lexer/datadog.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* datadog.metric {
|
|
5
|
+
* metric = "requests.count"
|
|
6
|
+
* value = 1
|
|
7
|
+
* type = "count"
|
|
8
|
+
* tags = '{"env":"prod"}'|json_decode
|
|
9
|
+
* }
|
|
10
|
+
* @param {import('../../base_parser.js').XanoBaseParser} $
|
|
11
|
+
*/
|
|
12
|
+
export function datadogMetricFn($) {
|
|
13
|
+
const requiredAttrs = ["metric", "value"];
|
|
14
|
+
const optionalAttrs = [
|
|
15
|
+
"type",
|
|
16
|
+
"tags",
|
|
17
|
+
"service",
|
|
18
|
+
"source",
|
|
19
|
+
"env",
|
|
20
|
+
"hostname",
|
|
21
|
+
"ddtags",
|
|
22
|
+
"timestamp",
|
|
23
|
+
"description",
|
|
24
|
+
"disabled",
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
return () => {
|
|
28
|
+
$.sectionStack.push("datadogMetric");
|
|
29
|
+
const tokenFn = $.CONSUME(DatadogMetricToken); // metric
|
|
30
|
+
$.SUBRULE($.functionAttrReq, {
|
|
31
|
+
ARGS: [tokenFn, requiredAttrs, optionalAttrs],
|
|
32
|
+
});
|
|
33
|
+
$.sectionStack.pop();
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { datadogLogBulkFn } from "./datadogLogBulkFn.js";
|
|
2
|
+
import { datadogLogFn } from "./datadogLogFn.js";
|
|
3
|
+
import { datadogMetricBulkFn } from "./datadogMetricBulkFn.js";
|
|
4
|
+
import { datadogMetricFn } from "./datadogMetricFn.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Registers all the parsers in this folder
|
|
8
|
+
* @param {import('../base_parser.js').XanoBaseParser} $
|
|
9
|
+
*/
|
|
10
|
+
export const register = ($) => {
|
|
11
|
+
$.datadogLogFn = $.RULE("datadogLogFn", datadogLogFn($));
|
|
12
|
+
$.datadogLogBulkFn = $.RULE("datadogLogBulkFn", datadogLogBulkFn($));
|
|
13
|
+
$.datadogMetricFn = $.RULE("datadogMetricFn", datadogMetricFn($));
|
|
14
|
+
$.datadogMetricBulkFn = $.RULE(
|
|
15
|
+
"datadogMetricBulkFn",
|
|
16
|
+
datadogMetricBulkFn($)
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DatadogToken } from "../../lexer/datadog.js";
|
|
2
|
+
import { DotToken } from "../../lexer/tokens.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @param {import('../base_parser.js').XanoBaseParser} $
|
|
6
|
+
*/
|
|
7
|
+
export function datadogFn($) {
|
|
8
|
+
return () => {
|
|
9
|
+
$.sectionStack.push("datadog");
|
|
10
|
+
$.CONSUME(DatadogToken); // "datadog"
|
|
11
|
+
$.CONSUME(DotToken); // "."
|
|
12
|
+
$.OR([
|
|
13
|
+
{ ALT: () => $.SUBRULE($.datadogLogBulkFn) }, // datadog.log_bulk
|
|
14
|
+
{ ALT: () => $.SUBRULE($.datadogLogFn) }, // datadog.log
|
|
15
|
+
{ ALT: () => $.SUBRULE($.datadogMetricBulkFn) }, // datadog.metric_bulk
|
|
16
|
+
{ ALT: () => $.SUBRULE($.datadogMetricFn) }, // datadog.metric
|
|
17
|
+
]);
|
|
18
|
+
$.sectionStack.pop();
|
|
19
|
+
};
|
|
20
|
+
}
|
|
@@ -10,6 +10,8 @@ import { register as register_cloud } from "./cloud/register.js";
|
|
|
10
10
|
import { cloudFn } from "./cloudFn.js";
|
|
11
11
|
import { controlFn } from "./controlFn.js";
|
|
12
12
|
import { register as register_controls } from "./controls/register.js";
|
|
13
|
+
import { register as register_datadog } from "./datadog/register.js";
|
|
14
|
+
import { datadogFn } from "./datadogFn.js";
|
|
13
15
|
import { register as register_db } from "./db/register.js";
|
|
14
16
|
import { dbFn } from "./dbFn.js";
|
|
15
17
|
import { register as register_debug } from "./debug/register.js";
|
|
@@ -56,6 +58,7 @@ export const register = ($) => {
|
|
|
56
58
|
$.arrayFn = $.RULE("arrayFn", arrayFn($));
|
|
57
59
|
$.cloudFn = $.RULE("cloudFn", cloudFn($));
|
|
58
60
|
$.controlFn = $.RULE("controlFn", controlFn($));
|
|
61
|
+
$.datadogFn = $.RULE("datadogFn", datadogFn($));
|
|
59
62
|
$.dbFn = $.RULE("dbFn", dbFn($));
|
|
60
63
|
$.debugFn = $.RULE("debugFn", debugFn($));
|
|
61
64
|
$.mathFn = $.RULE("mathFn", mathFn($));
|
|
@@ -78,6 +81,7 @@ export const register = ($) => {
|
|
|
78
81
|
register_array($);
|
|
79
82
|
register_cloud($);
|
|
80
83
|
register_controls($);
|
|
84
|
+
register_datadog($);
|
|
81
85
|
register_db($);
|
|
82
86
|
register_debug($);
|
|
83
87
|
register_math($);
|
package/parser/parser.js
CHANGED
|
@@ -36,6 +36,9 @@ export function xanoscriptParser(text, scheme, preTokenized = null) {
|
|
|
36
36
|
case "branch":
|
|
37
37
|
parser.branchDeclaration();
|
|
38
38
|
return parser;
|
|
39
|
+
case "error_trigger":
|
|
40
|
+
parser.errorTriggerDeclaration();
|
|
41
|
+
return parser;
|
|
39
42
|
case "db":
|
|
40
43
|
parser.tableDeclaration();
|
|
41
44
|
return parser;
|
package/parser/register.js
CHANGED
|
@@ -6,6 +6,7 @@ import { register as register_attributes } from "./attributes/register.js";
|
|
|
6
6
|
import { branchDeclaration } from "./branch_parser.js";
|
|
7
7
|
import { register as register_clauses } from "./clauses/register.js";
|
|
8
8
|
import { register as register_definitions } from "./definitions/register.js";
|
|
9
|
+
import { errorTriggerDeclaration } from "./error_trigger_parser.js";
|
|
9
10
|
import { functionDeclaration } from "./function_parser.js";
|
|
10
11
|
import { register as register_functions } from "./functions/register.js";
|
|
11
12
|
import { register as register_generic } from "./generic/register.js";
|
|
@@ -50,6 +51,10 @@ export const register = ($) => {
|
|
|
50
51
|
$.queryDeclaration = $.RULE("queryDeclaration", queryDeclaration($));
|
|
51
52
|
$.apiGroupDeclaration = $.RULE("apiGroupDeclaration", apiGroupDeclaration($));
|
|
52
53
|
$.branchDeclaration = $.RULE("branchDeclaration", branchDeclaration($));
|
|
54
|
+
$.errorTriggerDeclaration = $.RULE(
|
|
55
|
+
"errorTriggerDeclaration",
|
|
56
|
+
errorTriggerDeclaration($)
|
|
57
|
+
);
|
|
53
58
|
$.tableDeclaration = $.RULE("tableDeclaration", tableDeclaration($));
|
|
54
59
|
$.mcpServerDeclaration = $.RULE(
|
|
55
60
|
"mcpServerDeclaration",
|
package/utils.js
CHANGED