@xano/xanoscript-language-server 11.11.0 → 11.12.1
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/.claude/memory/feedback_no_git.md +11 -0
- package/.claude/settings.local.json +13 -28
- package/lexer/cast.js +3 -3
- package/lexer/control.js +0 -2
- package/lexer/literal.js +2 -2
- package/lexer/security.js +2 -2
- package/package.json +1 -1
- package/parser/addon_parser.js +2 -1
- package/parser/agent_parser.js +2 -1
- package/parser/agent_trigger_parser.js +2 -1
- package/parser/api_group_parser.js +2 -1
- package/parser/attributes/columnDefaultValueAttribute.js +10 -3
- package/parser/attributes/inputFilterFn.js +11 -4
- package/parser/base_parser.js +11 -0
- package/parser/branch_parser.js +2 -1
- package/parser/clauses/flexibleStringClause.js +2 -2
- package/parser/clauses/nakedStackFn.js +43 -36
- package/parser/clauses/nakedStackFn.spec.js +10 -0
- package/parser/clauses/responseClause.spec.js +5 -0
- package/parser/definitions/columnDefinition.js +7 -2
- package/parser/function_parser.js +1 -0
- package/parser/function_parser.spec.js +14 -0
- package/parser/functions/array/arrayNoValueAs.js +1 -1
- package/parser/functions/array/arrayPopFn.js +1 -3
- package/parser/functions/controls/forEachFn.spec.js +8 -0
- package/parser/functions/controls/preconditionFn.js +3 -0
- package/parser/functions/db/dbExternalDirectQueryFn.js +1 -0
- package/parser/functions/db/dbQueryFn.spec.js +31 -0
- package/parser/functions/schema/schemaParseConstantFn.js +11 -10
- package/parser/functions/varFn.js +14 -2
- package/parser/functions/varFn.spec.js +20 -12
- package/parser/generic/asVariable.spec.js +12 -8
- package/parser/generic/assignableVariableAs.js +50 -11
- package/parser/generic/assignableVariableAs.spec.js +29 -7
- package/parser/generic/assignableVariableProperty.js +22 -10
- package/parser/generic/assignableVariableProperty.spec.js +21 -12
- package/parser/generic/expressionFn.js +9 -2
- package/parser/generic/expressionFn.spec.js +5 -0
- package/parser/generic/filterNames.js +9 -0
- package/parser/mcp_server_parser.js +2 -1
- package/parser/mcp_server_trigger_parser.js +2 -1
- package/parser/middleware_parser.js +2 -1
- package/parser/multidoc.js +38 -17
- package/parser/multidoc.spec.js +7 -1
- package/parser/query_parser.js +12 -3
- package/parser/query_parser.spec.js +14 -3
- package/parser/realtime_channel_parser.js +2 -1
- package/parser/realtime_trigger_parser.js +2 -1
- package/parser/run_parser.js +4 -2
- package/parser/table_parser.js +2 -1
- package/parser/table_trigger_parser.js +2 -1
- package/parser/task_parser.js +2 -1
- package/parser/task_parser.spec.js +11 -0
- package/parser/tests/function/function_parser.spec.js +4 -4
- package/parser/tests/multidoc/multidoc_parser.spec.js +55 -0
- package/parser/tests/multidoc/valid_sources/function_stack.xs +130603 -0
- package/parser/tests/query/query_parser.spec.js +3 -3
- package/parser/tool_parser.js +14 -4
- package/parser/tool_parser.spec.js +19 -6
- package/parser/workflow_test_parser.js +2 -1
- package/parser/workspace_parser.js +2 -1
- package/parser/workspace_trigger_parser.js +2 -1
|
@@ -9,13 +9,13 @@ describe("Xanoscript Query Parser", () => {
|
|
|
9
9
|
it("parses all the valid sources", () => {
|
|
10
10
|
const errors = [];
|
|
11
11
|
const files = readdirSync(
|
|
12
|
-
join(dirname("./"), "parser/tests/query/valid_sources")
|
|
12
|
+
join(dirname("./"), "parser/tests/query/valid_sources"),
|
|
13
13
|
);
|
|
14
14
|
|
|
15
15
|
files.forEach((file) => {
|
|
16
16
|
const source = readFileSync(
|
|
17
17
|
join(dirname("./"), "parser/tests/query/valid_sources", file),
|
|
18
|
-
"utf8"
|
|
18
|
+
"utf8",
|
|
19
19
|
);
|
|
20
20
|
const parser = xanoscriptParser(source);
|
|
21
21
|
|
|
@@ -27,7 +27,7 @@ describe("Xanoscript Query Parser", () => {
|
|
|
27
27
|
error.previousToken.image,
|
|
28
28
|
{
|
|
29
29
|
length: 20,
|
|
30
|
-
}
|
|
30
|
+
},
|
|
31
31
|
)})`
|
|
32
32
|
: "N/A",
|
|
33
33
|
file: error.token
|
package/parser/tool_parser.js
CHANGED
|
@@ -21,10 +21,11 @@ export function toolDeclaration($) {
|
|
|
21
21
|
$.SUBRULE($.optionalCommentBlockFn);
|
|
22
22
|
|
|
23
23
|
const parent = $.CONSUME(ToolToken);
|
|
24
|
-
$.OR([
|
|
24
|
+
const nameToken = $.OR([
|
|
25
25
|
{ ALT: () => $.CONSUME(StringLiteral) },
|
|
26
26
|
{ ALT: () => $.CONSUME(Identifier) },
|
|
27
27
|
]);
|
|
28
|
+
$.validateDeclarationName(nameToken, "tool");
|
|
28
29
|
$.CONSUME(LCurly); // "{"
|
|
29
30
|
$.MANY(() => {
|
|
30
31
|
$.AT_LEAST_ONE(() => $.CONSUME(NewlineToken)); // at least one new line
|
|
@@ -110,15 +111,24 @@ export function toolDeclaration($) {
|
|
|
110
111
|
});
|
|
111
112
|
|
|
112
113
|
if (!hasInput) {
|
|
113
|
-
$.addMissingError(
|
|
114
|
+
$.addMissingError(
|
|
115
|
+
parent,
|
|
116
|
+
`{} ${nameToken.image} is missing an input clause`,
|
|
117
|
+
);
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
if (!hasStack) {
|
|
117
|
-
$.addMissingError(
|
|
121
|
+
$.addMissingError(
|
|
122
|
+
parent,
|
|
123
|
+
`{} ${nameToken.image} is missing a stack clause`,
|
|
124
|
+
);
|
|
118
125
|
}
|
|
119
126
|
|
|
120
127
|
if (!hasResponse) {
|
|
121
|
-
$.addMissingError(
|
|
128
|
+
$.addMissingError(
|
|
129
|
+
parent,
|
|
130
|
+
`{} ${nameToken.image} is missing a response clause`,
|
|
131
|
+
);
|
|
122
132
|
}
|
|
123
133
|
|
|
124
134
|
$.MANY1(() => $.CONSUME1(NewlineToken)); // optional new line
|
|
@@ -19,15 +19,28 @@ describe("tool_parser", () => {
|
|
|
19
19
|
|
|
20
20
|
it("should parse a basic a string tool url", () => {
|
|
21
21
|
const parser = xanoscriptParser(`tool "foo/bar" {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
input {
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
stack {
|
|
26
|
+
}
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
response = null
|
|
29
|
+
}`);
|
|
30
|
+
|
|
31
|
+
expect(parser.errors).to.be.empty;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it("should parse a tool with a string as a response", () => {
|
|
35
|
+
const parser = xanoscriptParser(`tool silent_exception {
|
|
36
|
+
input {
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
stack {
|
|
40
|
+
}
|
|
30
41
|
|
|
42
|
+
response = "something is wrong"
|
|
43
|
+
}`);
|
|
31
44
|
expect(parser.errors).to.be.empty;
|
|
32
45
|
});
|
|
33
46
|
|
|
@@ -16,10 +16,11 @@ export function workflowTestDeclaration($) {
|
|
|
16
16
|
$.SUBRULE($.optionalCommentBlockFn);
|
|
17
17
|
|
|
18
18
|
const parent = $.CONSUME(WorkflowTestToken);
|
|
19
|
-
$.OR([
|
|
19
|
+
const nameToken = $.OR([
|
|
20
20
|
{ ALT: () => $.CONSUME(StringLiteral) },
|
|
21
21
|
{ ALT: () => $.CONSUME(Identifier) },
|
|
22
22
|
]);
|
|
23
|
+
$.validateDeclarationName(nameToken, "workflow_test");
|
|
23
24
|
$.CONSUME(LCurly); // "{"
|
|
24
25
|
$.MANY(() => {
|
|
25
26
|
$.AT_LEAST_ONE(() => $.CONSUME(NewlineToken)); // at least one new line
|
|
@@ -9,10 +9,11 @@ export function workspaceDeclaration($) {
|
|
|
9
9
|
$.SUBRULE($.optionalCommentBlockFn);
|
|
10
10
|
|
|
11
11
|
const parent = $.CONSUME(WorkspaceToken); // workspace
|
|
12
|
-
$.OR([
|
|
12
|
+
const nameToken = $.OR([
|
|
13
13
|
{ ALT: () => $.CONSUME(StringLiteral) },
|
|
14
14
|
{ ALT: () => $.CONSUME(Identifier) },
|
|
15
15
|
]);
|
|
16
|
+
$.validateDeclarationName(nameToken, "workspace");
|
|
16
17
|
|
|
17
18
|
$.SUBRULE($.schemaParseAttributeFn, {
|
|
18
19
|
ARGS: [
|
|
@@ -23,10 +23,11 @@ export function workspaceTriggerDeclaration($) {
|
|
|
23
23
|
$.SUBRULE($.optionalCommentBlockFn);
|
|
24
24
|
|
|
25
25
|
const parent = $.CONSUME(WorkspaceTriggerToken); // workspace_trigger
|
|
26
|
-
$.OR([
|
|
26
|
+
const nameToken = $.OR([
|
|
27
27
|
{ ALT: () => $.CONSUME(StringLiteral) },
|
|
28
28
|
{ ALT: () => $.CONSUME(Identifier) },
|
|
29
29
|
]);
|
|
30
|
+
$.validateDeclarationName(nameToken, "workspace_trigger");
|
|
30
31
|
$.CONSUME(LCurly); // "{"
|
|
31
32
|
$.MANY(() => {
|
|
32
33
|
$.AT_LEAST_ONE(() => $.CONSUME(NewlineToken)); // at least one new line
|