@cloudcare/codemirror-dql 0.0.55 → 0.0.57
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/dist/cjs/lint/hybrid.js +19 -3
- package/dist/cjs/lint/hybrid.js.map +1 -1
- package/dist/cjs/parser/parser.d.ts +104 -2
- package/dist/cjs/parser/parser.js +3083 -25
- package/dist/cjs/parser/parser.js.map +1 -1
- package/dist/esm/lint/hybrid.js +19 -3
- package/dist/esm/lint/hybrid.js.map +1 -1
- package/dist/esm/parser/parser.d.ts +104 -2
- package/dist/esm/parser/parser.js +2728 -26
- package/dist/esm/parser/parser.js.map +1 -1
- package/package.json +3 -3
package/dist/cjs/lint/hybrid.js
CHANGED
|
@@ -7,9 +7,25 @@ var HybridLint = /** @class */ (function () {
|
|
|
7
7
|
}
|
|
8
8
|
HybridLint.prototype.DQL = function () {
|
|
9
9
|
return function (view) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
try {
|
|
11
|
+
var parser = new parser_1.Parser(view.state);
|
|
12
|
+
parser.analyze();
|
|
13
|
+
return parser.getDiagnostics();
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (error instanceof RangeError) {
|
|
17
|
+
return [
|
|
18
|
+
{
|
|
19
|
+
severity: 'warning',
|
|
20
|
+
source: 'DQL syntax',
|
|
21
|
+
message: 'syntax analysis stopped because the query is too deeply nested',
|
|
22
|
+
from: 0,
|
|
23
|
+
to: Math.min(1, view.state.doc.length),
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
}
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
13
29
|
};
|
|
14
30
|
};
|
|
15
31
|
return HybridLint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hybrid.js","sourceRoot":"","sources":["../../../src/lint/hybrid.ts"],"names":[],"mappings":";;;AAGA,oCAAmC;AAEnC;IAAA;
|
|
1
|
+
{"version":3,"file":"hybrid.js","sourceRoot":"","sources":["../../../src/lint/hybrid.ts"],"names":[],"mappings":";;;AAGA,oCAAmC;AAEnC;IAAA;IAuBA,CAAC;IAtBQ,wBAAG,GAAV;QACE,OAAO,UAAC,IAAgB;YACtB,IAAI,CAAC;gBACH,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBACtC,MAAM,CAAC,OAAO,EAAE,CAAC;gBACjB,OAAO,MAAM,CAAC,cAAc,EAAE,CAAC;YACjC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;oBAChC,OAAO;wBACL;4BACE,QAAQ,EAAE,SAAS;4BACnB,MAAM,EAAE,YAAY;4BACpB,OAAO,EAAE,gEAAgE;4BACzE,IAAI,EAAE,CAAC;4BACP,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC;yBACvC;qBACF,CAAC;gBACJ,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC,CAAC;IACJ,CAAC;IACH,iBAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,gCAAU"}
|
|
@@ -1,14 +1,116 @@
|
|
|
1
1
|
import { Diagnostic } from '@codemirror/lint';
|
|
2
2
|
import { SyntaxNode } from '@lezer/common';
|
|
3
3
|
import { EditorState } from '@codemirror/state';
|
|
4
|
+
export declare const dqlSyntaxContexts: Readonly<Record<string, string>>;
|
|
4
5
|
export declare class Parser {
|
|
5
6
|
private readonly tree;
|
|
6
7
|
private readonly state;
|
|
8
|
+
private readonly deadline;
|
|
9
|
+
private readonly treeComplete;
|
|
7
10
|
private readonly diagnostics;
|
|
8
|
-
|
|
11
|
+
private repairDepth;
|
|
12
|
+
private mismatchRepairDepth;
|
|
13
|
+
private terminalRepairUsed;
|
|
14
|
+
private delimiterIssue;
|
|
15
|
+
private quotedQueryDelimiterInfo;
|
|
16
|
+
private caseResultDiagnostics;
|
|
17
|
+
private caseResultRecoveryErrors;
|
|
18
|
+
constructor(state: EditorState, deadline?: number);
|
|
9
19
|
getDiagnostics(): Diagnostic[];
|
|
10
20
|
analyze(): void;
|
|
21
|
+
private pushIncompleteAnalysisWarning;
|
|
22
|
+
private getCompleteTree;
|
|
11
23
|
private diagnoseAllErrorNodes;
|
|
24
|
+
private describeError;
|
|
25
|
+
private makeUnexpectedTokenDiagnostic;
|
|
26
|
+
private findSyntaxContext;
|
|
27
|
+
private makeDiagnostic;
|
|
28
|
+
private makeDiagnosticRepairing;
|
|
29
|
+
private makeDiagnosticRepairingAt;
|
|
30
|
+
private diagnoseAfterInsertion;
|
|
31
|
+
private diagnoseAfterInsertions;
|
|
32
|
+
private diagnoseAfterReplacement;
|
|
33
|
+
private diagnoseAfterDeletion;
|
|
34
|
+
private diagnoseAfterBulkDelimiterRecovery;
|
|
35
|
+
private diagnoseAfterBulkUnexpectedClosingRecovery;
|
|
36
|
+
private diagnoseAfterTerminalInsertion;
|
|
37
|
+
private findStringNewlineRepairs;
|
|
38
|
+
private findLexicalQuotedQueryWrapperDelimiters;
|
|
39
|
+
private findLexicalQuotedQueryClosing;
|
|
40
|
+
private nextNonTriviaCharacter;
|
|
41
|
+
private findMatchingRepairs;
|
|
42
|
+
private mapDiagnosticsThroughChanges;
|
|
43
|
+
private findLikelyNamespaceSeparatorInsertions;
|
|
44
|
+
private findBulkDelimiterRecoveryChanges;
|
|
45
|
+
private isSameDiagnostic;
|
|
46
|
+
private appendDiagnostics;
|
|
47
|
+
private mapRepairedPosition;
|
|
48
|
+
private mapRepairedPositionAfterInsertions;
|
|
49
|
+
private makeDiagnosticAt;
|
|
50
|
+
private nodeText;
|
|
51
|
+
private isAdjacentToComma;
|
|
52
|
+
private isCommaSequence;
|
|
53
|
+
private isCommaOnlyList;
|
|
54
|
+
private commaSequenceGroup;
|
|
55
|
+
private describeConsecutiveCommaError;
|
|
56
|
+
private hasMissingValueBeforeComma;
|
|
57
|
+
private findCaseExprEndingAt;
|
|
58
|
+
private siblingSkippingLineComments;
|
|
59
|
+
private hasErroredSibling;
|
|
60
|
+
private maskLineComments;
|
|
61
|
+
private maskStringsAndLineComments;
|
|
62
|
+
private containsError;
|
|
63
|
+
private looksLikeProjectionAfterMissingColon;
|
|
64
|
+
private containsNode;
|
|
65
|
+
private findAncestor;
|
|
66
|
+
private caseGroup;
|
|
67
|
+
private findCaseResultDiagnostics;
|
|
68
|
+
private nodeRangeKey;
|
|
69
|
+
private isOperator;
|
|
70
|
+
private getDelimiterIssue;
|
|
71
|
+
private makeDelimiterDiagnostic;
|
|
72
|
+
private isRelatedDelimiterError;
|
|
73
|
+
private quoteName;
|
|
74
|
+
private findQuotedQueryDelimiterInfo;
|
|
75
|
+
private findFallbackQuotedQueryRange;
|
|
76
|
+
private findFallbackQuotedQueryRangeFromOpening;
|
|
77
|
+
private isFallbackQuotedQueryRange;
|
|
78
|
+
private isQueryPayload;
|
|
79
|
+
private diagnoseFallbackQuotedQueries;
|
|
80
|
+
private repairScopedDelimiterMismatches;
|
|
81
|
+
private findFirstDelimiterMismatch;
|
|
82
|
+
private formsOuterQuotedQuery;
|
|
83
|
+
private findDelimiterIssue;
|
|
84
|
+
private hasPrecedingErrorEndingAt;
|
|
85
|
+
private countFutureClosersAtCurrentDepth;
|
|
86
|
+
private chooseQuoteRepairAt;
|
|
87
|
+
private findVerifiedQuotedQueryRepairAt;
|
|
88
|
+
private scoreQuoteRepairCandidate;
|
|
89
|
+
private pickQuoteRepair;
|
|
90
|
+
private findQuotedQueryRepairCandidate;
|
|
91
|
+
private chooseMismatchRecovery;
|
|
92
|
+
private delimiterBalanceCost;
|
|
93
|
+
private findStringNewlineRecovery;
|
|
12
94
|
checkAST(node: SyntaxNode | null): void;
|
|
13
|
-
private
|
|
95
|
+
private checkDuplicateQueryClauses;
|
|
96
|
+
private checkDuplicateShowClauses;
|
|
97
|
+
private checkIntegerClause;
|
|
98
|
+
private checkTimeRangeShape;
|
|
99
|
+
private checkBareRollup;
|
|
100
|
+
private checkRollupFunctionCall;
|
|
101
|
+
private checkFunctionCall;
|
|
102
|
+
private checkOuterFunctionCall;
|
|
103
|
+
private checkProjectionAlias;
|
|
104
|
+
private checkFilterSubqueryOperator;
|
|
105
|
+
private checkFieldName;
|
|
106
|
+
private checkCaseFunction;
|
|
107
|
+
private checkCaseResults;
|
|
108
|
+
private checkShowFunctionRequirements;
|
|
109
|
+
private pushSemanticDiagnostic;
|
|
110
|
+
private pushSemanticDiagnosticAt;
|
|
111
|
+
private directChildren;
|
|
112
|
+
private numericValue;
|
|
113
|
+
private splitTopLevelSegments;
|
|
114
|
+
private describeUnknownFunction;
|
|
115
|
+
private containsFunctionCallStartingAt;
|
|
14
116
|
}
|