@dbml/parse 7.1.2 → 8.0.0-alpha.4
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/dbml-parse.js +29 -19
- package/dist/dbml-parse.mjs +11098 -7342
- package/dist/src/compiler/index.d.ts +88 -52
- package/dist/src/compiler/projectLayout/index.d.ts +1 -0
- package/dist/src/compiler/projectLayout/layout.d.ts +27 -0
- package/dist/src/compiler/queries/canonicalName.d.ts +9 -0
- package/dist/src/compiler/queries/container/element.d.ts +2 -1
- package/dist/src/compiler/queries/container/scope.d.ts +3 -2
- package/dist/src/compiler/queries/container/scopeKind.d.ts +2 -1
- package/dist/src/compiler/queries/container/stack.d.ts +2 -1
- package/dist/src/compiler/queries/container/token.d.ts +2 -1
- package/dist/src/compiler/queries/files/fileDependencies.d.ts +3 -0
- package/dist/src/compiler/queries/files/reachableFiles.d.ts +3 -0
- package/dist/src/compiler/queries/files/usableMembers.d.ts +34 -0
- package/dist/src/compiler/queries/legacy/parse.d.ts +10 -9
- package/dist/src/compiler/queries/legacy/symbol.d.ts +1 -10
- package/dist/src/compiler/queries/legacy/token.d.ts +3 -2
- package/dist/src/compiler/queries/nodeAtPosition.d.ts +5 -0
- package/dist/src/compiler/queries/pipeline/bind.d.ts +5 -0
- package/dist/src/compiler/queries/pipeline/index.d.ts +2 -0
- package/dist/src/compiler/queries/pipeline/interpret.d.ts +6 -0
- package/dist/src/compiler/queries/pipeline/parse.d.ts +12 -0
- package/dist/src/compiler/queries/pipeline/validate.d.ts +4 -0
- package/dist/src/compiler/queries/resolutionIndex.d.ts +11 -0
- package/dist/src/compiler/queries/symbol/lookupMembers.d.ts +4 -0
- package/dist/src/compiler/queries/symbol/symbolAliases.d.ts +4 -0
- package/dist/src/compiler/queries/symbol/symbolUses.d.ts +4 -0
- package/dist/src/compiler/queries/transform/index.d.ts +1 -1
- package/dist/src/compiler/queries/transform/renameTable.d.ts +21 -16
- package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +19 -6
- package/dist/src/compiler/queries/transform/utils.d.ts +5 -4
- package/dist/src/compiler/queries/utils.d.ts +6 -0
- package/dist/src/constants.d.ts +1 -2
- package/dist/src/core/global_modules/checks/bind.d.ts +9 -0
- package/dist/src/core/global_modules/checks/index.d.ts +2 -0
- package/dist/src/core/global_modules/checks/interpret.d.ts +10 -0
- package/dist/src/core/global_modules/diagramView/bind.d.ts +18 -0
- package/dist/src/core/global_modules/diagramView/index.d.ts +8 -0
- package/dist/src/core/global_modules/diagramView/interpret.d.ts +37 -0
- package/dist/src/core/global_modules/enum/bind.d.ts +11 -0
- package/dist/src/core/global_modules/enum/index.d.ts +8 -0
- package/dist/src/core/global_modules/enum/interpret.d.ts +15 -0
- package/dist/src/core/global_modules/index.d.ts +17 -0
- package/dist/src/core/global_modules/indexes/bind.d.ts +12 -0
- package/dist/src/core/global_modules/indexes/index.d.ts +2 -0
- package/dist/src/core/global_modules/indexes/interpret.d.ts +10 -0
- package/dist/src/core/global_modules/note/bind.d.ts +11 -0
- package/dist/src/core/global_modules/note/index.d.ts +2 -0
- package/dist/src/core/global_modules/note/interpret.d.ts +17 -0
- package/dist/src/core/global_modules/program/bind.d.ts +17 -0
- package/dist/src/core/global_modules/program/index.d.ts +2 -0
- package/dist/src/core/global_modules/program/interpret.d.ts +23 -0
- package/dist/src/core/global_modules/program/utils.d.ts +3 -0
- package/dist/src/core/global_modules/project/bind.d.ts +11 -0
- package/dist/src/core/global_modules/project/index.d.ts +2 -0
- package/dist/src/core/global_modules/project/interpret.d.ts +16 -0
- package/dist/src/core/global_modules/records/bind.d.ts +17 -0
- package/dist/src/core/global_modules/records/index.d.ts +2 -0
- package/dist/src/core/global_modules/records/interpret.d.ts +13 -0
- package/dist/src/core/global_modules/records/utils/constraints/fk.d.ts +13 -0
- package/dist/src/core/global_modules/records/utils/constraints/helper.d.ts +26 -0
- package/dist/src/core/global_modules/records/utils/constraints/pk.d.ts +6 -0
- package/dist/src/core/global_modules/records/utils/constraints/unique.d.ts +5 -0
- package/dist/src/core/{interpreter → global_modules}/records/utils/data/sqlTypes.d.ts +0 -8
- package/dist/src/core/{interpreter → global_modules}/records/utils/data/values.d.ts +1 -1
- package/dist/src/core/global_modules/ref/bind.d.ts +15 -0
- package/dist/src/core/global_modules/ref/index.d.ts +7 -0
- package/dist/src/core/global_modules/ref/interpret.d.ts +15 -0
- package/dist/src/core/global_modules/schema/index.d.ts +2 -0
- package/dist/src/core/global_modules/table/bind.d.ts +18 -0
- package/dist/src/core/global_modules/table/index.d.ts +9 -0
- package/dist/src/core/global_modules/table/interpret.d.ts +26 -0
- package/dist/src/core/global_modules/table/utils.d.ts +4 -0
- package/dist/src/core/global_modules/tableGroup/bind.d.ts +15 -0
- package/dist/src/core/global_modules/tableGroup/index.d.ts +8 -0
- package/dist/src/core/global_modules/tableGroup/interpret.d.ts +18 -0
- package/dist/src/core/global_modules/tablePartial/bind.d.ts +17 -0
- package/dist/src/core/global_modules/tablePartial/index.d.ts +7 -0
- package/dist/src/core/global_modules/tablePartial/interpret.d.ts +23 -0
- package/dist/src/core/global_modules/types.d.ts +17 -0
- package/dist/src/core/global_modules/use/index.d.ts +8 -0
- package/dist/src/core/global_modules/utils.d.ts +17 -0
- package/dist/src/core/local_modules/checks/index.d.ts +2 -0
- package/dist/src/core/local_modules/checks/validate.d.ts +17 -0
- package/dist/src/core/local_modules/custom/index.d.ts +2 -0
- package/dist/src/core/local_modules/custom/validate.d.ts +14 -0
- package/dist/src/core/local_modules/diagramView/index.d.ts +2 -0
- package/dist/src/core/local_modules/diagramView/validate.d.ts +24 -0
- package/dist/src/core/local_modules/enum/index.d.ts +2 -0
- package/dist/src/core/local_modules/enum/validate.d.ts +17 -0
- package/dist/src/core/local_modules/index.d.ts +10 -0
- package/dist/src/core/local_modules/indexes/index.d.ts +2 -0
- package/dist/src/core/local_modules/indexes/validate.d.ts +18 -0
- package/dist/src/core/local_modules/note/index.d.ts +2 -0
- package/dist/src/core/local_modules/note/validate.d.ts +16 -0
- package/dist/src/core/local_modules/program/index.d.ts +2 -0
- package/dist/src/core/local_modules/program/validate.d.ts +9 -0
- package/dist/src/core/local_modules/project/index.d.ts +2 -0
- package/dist/src/core/local_modules/project/validate.d.ts +15 -0
- package/dist/src/core/local_modules/records/index.d.ts +2 -0
- package/dist/src/core/local_modules/records/validate.d.ts +20 -0
- package/dist/src/core/local_modules/ref/index.d.ts +2 -0
- package/dist/src/core/local_modules/ref/validate.d.ts +20 -0
- package/dist/src/core/local_modules/table/index.d.ts +2 -0
- package/dist/src/core/local_modules/table/validate.d.ts +21 -0
- package/dist/src/core/local_modules/tableGroup/index.d.ts +2 -0
- package/dist/src/core/local_modules/tableGroup/validate.d.ts +19 -0
- package/dist/src/core/local_modules/tablePartial/index.d.ts +2 -0
- package/dist/src/core/local_modules/tablePartial/validate.d.ts +21 -0
- package/dist/src/core/local_modules/types.d.ts +12 -0
- package/dist/src/core/local_modules/use/index.d.ts +2 -0
- package/dist/src/core/local_modules/use/validate.d.ts +12 -0
- package/dist/src/core/parser/parser.d.ts +6 -0
- package/dist/src/core/parser/utils.d.ts +2 -49
- package/dist/src/core/types/errors.d.ts +9 -5
- package/dist/src/core/types/filepath.d.ts +8 -2
- package/dist/src/core/types/index.d.ts +2 -0
- package/dist/src/core/{analyzer/types.d.ts → types/keywords.d.ts} +6 -2
- package/dist/src/core/types/module.d.ts +1 -2
- package/dist/src/core/types/nodes.d.ts +61 -16
- package/dist/src/core/types/report.d.ts +3 -3
- package/dist/src/core/types/schemaJson.d.ts +14 -5
- package/dist/src/core/types/symbol/factory.d.ts +3 -2
- package/dist/src/core/types/symbol/index.d.ts +2 -3
- package/dist/src/core/types/symbol/metadata.d.ts +80 -0
- package/dist/src/core/types/symbol/symbols.d.ts +277 -86
- package/dist/src/core/{analyzer/utils.d.ts → utils/expression.d.ts} +10 -21
- package/dist/src/core/utils/interpret.d.ts +16 -0
- package/dist/src/core/utils/numbers.d.ts +1 -1
- package/dist/src/core/utils/span.d.ts +2 -4
- package/dist/src/core/utils/tokens.d.ts +15 -0
- package/dist/src/core/utils/validate.d.ts +103 -0
- package/dist/src/index.d.ts +13 -9
- package/dist/src/services/diagnostics/provider.d.ts +7 -6
- package/dist/src/services/index.d.ts +1 -0
- package/dist/src/services/monarch.d.ts +3 -2
- package/dist/src/services/suggestions/crossFile.d.ts +6 -0
- package/dist/src/services/suggestions/provider.d.ts +4 -1
- package/dist/src/services/suggestions/recordRowSnippet.d.ts +2 -1
- package/dist/src/services/suggestions/use.d.ts +5 -0
- package/dist/src/services/suggestions/utils/index.d.ts +10 -0
- package/dist/src/services/suggestions/utils/useMerger.d.ts +28 -0
- package/dist/src/services/types.d.ts +4 -0
- package/dist/src/services/utils.d.ts +4 -1
- package/package.json +2 -2
- package/dist/src/core/analyzer/analyzer.d.ts +0 -10
- package/dist/src/core/analyzer/binder/binder.d.ts +0 -10
- package/dist/src/core/analyzer/binder/elementBinder/checks.d.ts +0 -13
- package/dist/src/core/analyzer/binder/elementBinder/custom.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/diagramView.d.ts +0 -20
- package/dist/src/core/analyzer/binder/elementBinder/enum.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/indexes.d.ts +0 -17
- package/dist/src/core/analyzer/binder/elementBinder/note.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/project.d.ts +0 -16
- package/dist/src/core/analyzer/binder/elementBinder/records.d.ts +0 -22
- package/dist/src/core/analyzer/binder/elementBinder/ref.d.ts +0 -17
- package/dist/src/core/analyzer/binder/elementBinder/table.d.ts +0 -21
- package/dist/src/core/analyzer/binder/elementBinder/tableGroup.d.ts +0 -17
- package/dist/src/core/analyzer/binder/elementBinder/tablePartial.d.ts +0 -19
- package/dist/src/core/analyzer/binder/types.d.ts +0 -4
- package/dist/src/core/analyzer/binder/utils.d.ts +0 -33
- package/dist/src/core/analyzer/validator/elementValidators/checks.d.ts +0 -26
- package/dist/src/core/analyzer/validator/elementValidators/custom.d.ts +0 -23
- package/dist/src/core/analyzer/validator/elementValidators/diagramView.d.ts +0 -31
- package/dist/src/core/analyzer/validator/elementValidators/enum.d.ts +0 -28
- package/dist/src/core/analyzer/validator/elementValidators/indexes.d.ts +0 -27
- package/dist/src/core/analyzer/validator/elementValidators/note.d.ts +0 -25
- package/dist/src/core/analyzer/validator/elementValidators/project.d.ts +0 -24
- package/dist/src/core/analyzer/validator/elementValidators/records.d.ts +0 -29
- package/dist/src/core/analyzer/validator/elementValidators/ref.d.ts +0 -26
- package/dist/src/core/analyzer/validator/elementValidators/table.d.ts +0 -28
- package/dist/src/core/analyzer/validator/elementValidators/tableGroup.d.ts +0 -27
- package/dist/src/core/analyzer/validator/elementValidators/tablePartial.d.ts +0 -28
- package/dist/src/core/analyzer/validator/types.d.ts +0 -7
- package/dist/src/core/analyzer/validator/utils.d.ts +0 -65
- package/dist/src/core/analyzer/validator/validator.d.ts +0 -10
- package/dist/src/core/interpreter/elementInterpreter/diagramView.d.ts +0 -13
- package/dist/src/core/interpreter/elementInterpreter/enum.d.ts +0 -12
- package/dist/src/core/interpreter/elementInterpreter/project.d.ts +0 -12
- package/dist/src/core/interpreter/elementInterpreter/ref.d.ts +0 -14
- package/dist/src/core/interpreter/elementInterpreter/sticky_note.d.ts +0 -14
- package/dist/src/core/interpreter/elementInterpreter/table.d.ts +0 -22
- package/dist/src/core/interpreter/elementInterpreter/tableGroup.d.ts +0 -15
- package/dist/src/core/interpreter/elementInterpreter/tablePartial.d.ts +0 -19
- package/dist/src/core/interpreter/interpreter.d.ts +0 -10
- package/dist/src/core/interpreter/records/index.d.ts +0 -10
- package/dist/src/core/interpreter/records/utils/constraints/fk.d.ts +0 -3
- package/dist/src/core/interpreter/records/utils/constraints/helper.d.ts +0 -11
- package/dist/src/core/interpreter/records/utils/constraints/pk.d.ts +0 -3
- package/dist/src/core/interpreter/records/utils/constraints/unique.d.ts +0 -3
- package/dist/src/core/interpreter/types.d.ts +0 -47
- package/dist/src/core/interpreter/utils.d.ts +0 -37
- package/dist/src/core/types/symbol/symbolIndex.d.ts +0 -33
- package/dist/src/core/types/symbol/symbolTable.d.ts +0 -12
- package/dist/src/core/types/symbol/utils.d.ts +0 -4
- package/dist/src/core/utils/array.d.ts +0 -1
- package/dist/src/core/utils/enum.d.ts +0 -1
- package/dist/src/services/suggestions/utils.d.ts +0 -34
- /package/dist/src/core/{interpreter → global_modules}/records/utils/constraints/index.d.ts +0 -0
- /package/dist/src/core/{interpreter → global_modules}/records/utils/data/index.d.ts +0 -0
- /package/dist/src/core/{interpreter → global_modules}/records/utils/index.d.ts +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ElementKind } from '../analyzer/types';
|
|
2
|
-
import { Position } from '.';
|
|
3
1
|
import { Filepath } from './filepath';
|
|
4
2
|
import { Internable } from './internable';
|
|
5
|
-
import {
|
|
3
|
+
import { ElementKind } from './keywords';
|
|
4
|
+
import { ImportKind, SymbolKind } from './symbol';
|
|
5
|
+
import { Position } from './position';
|
|
6
6
|
import { SyntaxToken } from './tokens';
|
|
7
7
|
export type SyntaxNodeId = number;
|
|
8
8
|
export type InternedSyntaxNode = string;
|
|
@@ -22,19 +22,25 @@ export declare class SyntaxNode implements Internable<InternedSyntaxNode> {
|
|
|
22
22
|
end: Readonly<number>;
|
|
23
23
|
fullEnd: Readonly<number>;
|
|
24
24
|
parentNode?: SyntaxNode;
|
|
25
|
-
symbol?: NodeSymbol;
|
|
26
|
-
referee?: NodeSymbol;
|
|
27
25
|
constructor(id: SyntaxNodeId, kind: SyntaxNodeKind, filepath: Filepath, args: Readonly<SyntaxToken | SyntaxNode | undefined>[]);
|
|
28
26
|
intern(): InternedSyntaxNode;
|
|
27
|
+
get parent(): ElementDeclarationNode | ProgramNode | undefined;
|
|
29
28
|
parentOfKind<T extends SyntaxNode>(cls: (new (...args: any[]) => T)): T | undefined;
|
|
30
29
|
strictlyContains(otherNode: SyntaxNode): boolean;
|
|
30
|
+
strictlyContains(otherToken: SyntaxToken): boolean;
|
|
31
|
+
strictlyContains(offset: number): boolean;
|
|
31
32
|
containsEq(otherNode: SyntaxNode): boolean;
|
|
33
|
+
containsEq(otherToken: SyntaxToken): boolean;
|
|
34
|
+
containsEq(offset: number): boolean;
|
|
32
35
|
}
|
|
33
36
|
export declare enum SyntaxNodeKind {
|
|
34
37
|
PROGRAM = "<program>",
|
|
35
38
|
ELEMENT_DECLARATION = "<element-declaration>",
|
|
39
|
+
USE_DECLARATION = "<use-declaration>",
|
|
40
|
+
USE_SPECIFIER = "<use-specifier>",
|
|
41
|
+
USE_SPECIFIER_LIST = "<use-specifier-list>",
|
|
36
42
|
ATTRIBUTE = "<attribute>",
|
|
37
|
-
IDENTIFIER_STREAM = "<
|
|
43
|
+
IDENTIFIER_STREAM = "<identifier-stream>",
|
|
38
44
|
LITERAL = "<literal>",
|
|
39
45
|
VARIABLE = "<variable>",
|
|
40
46
|
PREFIX_EXPRESSION = "<prefix-expression>",
|
|
@@ -49,19 +55,58 @@ export declare enum SyntaxNodeKind {
|
|
|
49
55
|
PRIMARY_EXPRESSION = "<primary-expression>",
|
|
50
56
|
GROUP_EXPRESSION = "<group-expression>",
|
|
51
57
|
COMMA_EXPRESSION = "<comma-expression>",
|
|
52
|
-
WILDCARD = "<wildcard>",
|
|
53
58
|
EMPTY = "<dummy>",
|
|
54
|
-
ARRAY = "<array>"
|
|
59
|
+
ARRAY = "<array>",
|
|
60
|
+
WILDCARD = "<wildcard>"
|
|
55
61
|
}
|
|
56
62
|
export declare class ProgramNode extends SyntaxNode {
|
|
57
|
-
body: ElementDeclarationNode[];
|
|
63
|
+
body: (UseDeclarationNode | ElementDeclarationNode)[];
|
|
58
64
|
eof?: SyntaxToken;
|
|
59
65
|
source: string;
|
|
60
66
|
constructor({ body, eof, source, }: {
|
|
61
|
-
body?: ElementDeclarationNode[];
|
|
67
|
+
body?: (UseDeclarationNode | ElementDeclarationNode)[];
|
|
62
68
|
eof?: SyntaxToken;
|
|
63
69
|
source: string;
|
|
64
70
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
71
|
+
get declarations(): ElementDeclarationNode[];
|
|
72
|
+
get uses(): UseDeclarationNode[];
|
|
73
|
+
}
|
|
74
|
+
export declare class UseDeclarationNode extends SyntaxNode {
|
|
75
|
+
useKeyword?: SyntaxToken;
|
|
76
|
+
specifiers?: UseSpecifierListNode | WildcardNode;
|
|
77
|
+
fromKeyword?: SyntaxToken;
|
|
78
|
+
importPath?: SyntaxToken;
|
|
79
|
+
constructor({ useKeyword, specifiers, fromKeyword, importPath, }: {
|
|
80
|
+
useKeyword?: SyntaxToken;
|
|
81
|
+
specifiers?: UseSpecifierListNode | WildcardNode;
|
|
82
|
+
fromKeyword?: SyntaxToken;
|
|
83
|
+
importPath?: SyntaxToken;
|
|
84
|
+
}, id: SyntaxNodeId, filepath: Filepath);
|
|
85
|
+
get isReuse(): boolean;
|
|
86
|
+
}
|
|
87
|
+
export declare class UseSpecifierNode extends SyntaxNode {
|
|
88
|
+
importKind?: SyntaxToken;
|
|
89
|
+
name?: NormalExpressionNode;
|
|
90
|
+
asKeyword?: SyntaxToken;
|
|
91
|
+
alias?: NormalExpressionNode;
|
|
92
|
+
constructor({ importKind, name, asKeyword, alias, }: {
|
|
93
|
+
importKind?: SyntaxToken;
|
|
94
|
+
name?: NormalExpressionNode;
|
|
95
|
+
asKeyword?: SyntaxToken;
|
|
96
|
+
alias?: NormalExpressionNode;
|
|
97
|
+
}, id: SyntaxNodeId, filepath: Filepath);
|
|
98
|
+
isKind(...importKinds: ImportKind[]): boolean;
|
|
99
|
+
getSymbolKind(): SymbolKind | undefined;
|
|
100
|
+
}
|
|
101
|
+
export declare class UseSpecifierListNode extends SyntaxNode {
|
|
102
|
+
openBrace?: SyntaxToken;
|
|
103
|
+
specifiers: UseSpecifierNode[];
|
|
104
|
+
closeBrace?: SyntaxToken;
|
|
105
|
+
constructor({ openBrace, specifiers, closeBrace, }: {
|
|
106
|
+
openBrace?: SyntaxToken;
|
|
107
|
+
specifiers?: UseSpecifierNode[];
|
|
108
|
+
closeBrace?: SyntaxToken;
|
|
109
|
+
}, id: SyntaxNodeId, filepath: Filepath);
|
|
65
110
|
}
|
|
66
111
|
export declare class ElementDeclarationNode extends SyntaxNode {
|
|
67
112
|
type?: SyntaxToken;
|
|
@@ -70,7 +115,6 @@ export declare class ElementDeclarationNode extends SyntaxNode {
|
|
|
70
115
|
alias?: NormalExpressionNode;
|
|
71
116
|
attributeList?: ListExpressionNode;
|
|
72
117
|
bodyColon?: SyntaxToken;
|
|
73
|
-
parent?: ElementDeclarationNode | ProgramNode;
|
|
74
118
|
body?: FunctionApplicationNode | BlockExpressionNode;
|
|
75
119
|
constructor({ type, name, as, alias, attributeList, bodyColon, body, }: {
|
|
76
120
|
type?: SyntaxToken;
|
|
@@ -82,21 +126,22 @@ export declare class ElementDeclarationNode extends SyntaxNode {
|
|
|
82
126
|
body?: BlockExpressionNode | FunctionApplicationNode;
|
|
83
127
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
84
128
|
isKind(...kinds: ElementKind[]): boolean;
|
|
129
|
+
getElementKind(): ElementKind | undefined;
|
|
85
130
|
}
|
|
86
|
-
export declare class
|
|
131
|
+
export declare class IdentifierStreamNode extends SyntaxNode {
|
|
87
132
|
identifiers: SyntaxToken[];
|
|
88
133
|
constructor({ identifiers, }: {
|
|
89
134
|
identifiers?: SyntaxToken[];
|
|
90
135
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
91
136
|
}
|
|
92
137
|
export declare class AttributeNode extends SyntaxNode {
|
|
93
|
-
name?:
|
|
138
|
+
name?: IdentifierStreamNode | PrimaryExpressionNode;
|
|
94
139
|
colon?: SyntaxToken;
|
|
95
|
-
value?: NormalExpressionNode |
|
|
140
|
+
value?: NormalExpressionNode | IdentifierStreamNode;
|
|
96
141
|
constructor({ name, colon, value, }: {
|
|
97
|
-
name?:
|
|
142
|
+
name?: IdentifierStreamNode | PrimaryExpressionNode;
|
|
98
143
|
colon?: SyntaxToken;
|
|
99
|
-
value?: NormalExpressionNode |
|
|
144
|
+
value?: NormalExpressionNode | IdentifierStreamNode;
|
|
100
145
|
}, id: SyntaxNodeId, filepath: Filepath);
|
|
101
146
|
}
|
|
102
147
|
export type NormalExpressionNode = PrefixExpressionNode | InfixExpressionNode | PostfixExpressionNode | BlockExpressionNode | ListExpressionNode | TupleExpressionNode | CommaExpressionNode | CallExpressionNode | PrimaryExpressionNode | FunctionExpressionNode | EmptyNode | ArrayNode;
|
|
@@ -7,12 +7,12 @@ export default class Report<T> {
|
|
|
7
7
|
constructor(value: T, errors?: CompileError[], warnings?: CompileWarning[]);
|
|
8
8
|
filter<S extends symbol>(filteredValue: S): Report<undefined | Exclude<T, S>>;
|
|
9
9
|
hasValue<S>(value: S): this is Report<S>;
|
|
10
|
-
getFiltered<S extends symbol>(
|
|
10
|
+
getFiltered<S extends symbol | undefined | null>(...filteredValues: S[]): Exclude<T, S> | undefined;
|
|
11
11
|
getValue(): T;
|
|
12
12
|
getErrors(): CompileError[];
|
|
13
13
|
getWarnings(): CompileWarning[];
|
|
14
|
-
chainFiltered<S extends symbol, U>(
|
|
14
|
+
chainFiltered<S extends symbol | undefined | null, U>(fn: (_: Exclude<T, S>) => Report<U>, ...filteredValues: S[]): Report<U | undefined>;
|
|
15
15
|
chain<U>(fn: (_: T) => Report<U>): Report<U>;
|
|
16
|
-
mapFiltered<S extends symbol, U>(
|
|
16
|
+
mapFiltered<S extends symbol | undefined | null, U>(fn: (_: Exclude<T, S>) => U, ...filteredValues: S[]): Report<U | undefined>;
|
|
17
17
|
map<U>(fn: (_: T) => U): Report<U>;
|
|
18
18
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { Filepath } from './filepath';
|
|
2
2
|
import { Position } from './position';
|
|
3
|
+
export declare enum AliasKind {
|
|
4
|
+
Table = "table"
|
|
5
|
+
}
|
|
3
6
|
export interface TokenPosition {
|
|
4
7
|
start: Position;
|
|
5
8
|
end: Position;
|
|
@@ -8,11 +11,19 @@ export interface TokenPosition {
|
|
|
8
11
|
export interface ElementRef {
|
|
9
12
|
name: string;
|
|
10
13
|
schemaName: string | null;
|
|
14
|
+
filepath: Filepath;
|
|
11
15
|
visibleNames: {
|
|
12
16
|
schemaName: string | null;
|
|
13
17
|
name: string;
|
|
14
18
|
}[];
|
|
15
19
|
}
|
|
20
|
+
export interface DatabaseExternals {
|
|
21
|
+
tables: ElementRef[];
|
|
22
|
+
enums: ElementRef[];
|
|
23
|
+
tableGroups: ElementRef[];
|
|
24
|
+
tablePartials: ElementRef[];
|
|
25
|
+
notes: ElementRef[];
|
|
26
|
+
}
|
|
16
27
|
/**
|
|
17
28
|
* FilterConfig is a tri-state filter:
|
|
18
29
|
* - [] (empty array) = show all
|
|
@@ -51,12 +62,12 @@ export interface Database {
|
|
|
51
62
|
project?: Project;
|
|
52
63
|
tablePartials: TablePartial[];
|
|
53
64
|
records: TableRecord[];
|
|
65
|
+
externals: DatabaseExternals;
|
|
54
66
|
diagramViews: DiagramView[];
|
|
55
67
|
token?: TokenPosition;
|
|
56
68
|
}
|
|
57
69
|
export interface MasterDatabase {
|
|
58
70
|
files: Record<string, Database>;
|
|
59
|
-
items: Database;
|
|
60
71
|
}
|
|
61
72
|
export interface Table {
|
|
62
73
|
name: string;
|
|
@@ -186,13 +197,10 @@ export interface TableGroupField {
|
|
|
186
197
|
name: string;
|
|
187
198
|
schemaName: string | null;
|
|
188
199
|
}
|
|
189
|
-
export type AliasKind = 'table' | 'enum' | 'tablegroup' | 'tablepartial' | 'note';
|
|
190
200
|
export interface Alias {
|
|
191
201
|
name: string;
|
|
192
202
|
kind: AliasKind;
|
|
193
203
|
value: {
|
|
194
|
-
elementName: string;
|
|
195
|
-
/** @deprecated Use elementName instead */
|
|
196
204
|
tableName: string;
|
|
197
205
|
schemaName: string | null;
|
|
198
206
|
};
|
|
@@ -218,9 +226,10 @@ export type RecordValueType = 'string' | 'bool' | 'integer' | 'real' | 'date' |
|
|
|
218
226
|
export interface RecordValue {
|
|
219
227
|
value: any;
|
|
220
228
|
type: RecordValueType;
|
|
229
|
+
token: TokenPosition;
|
|
221
230
|
}
|
|
222
231
|
export interface TableRecord {
|
|
223
|
-
schemaName: string |
|
|
232
|
+
schemaName: string | null;
|
|
224
233
|
tableName: string;
|
|
225
234
|
columns: string[];
|
|
226
235
|
values: RecordValue[][];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Filepath } from '../filepath';
|
|
1
2
|
import { NodeSymbol, NodeSymbolId, NodeSymbolIdGenerator } from '.';
|
|
2
3
|
export default class SymbolFactory {
|
|
3
4
|
private generator;
|
|
4
5
|
constructor(generator: NodeSymbolIdGenerator);
|
|
5
6
|
create<T extends NodeSymbol, A>(Type: {
|
|
6
|
-
new (args: A, id: NodeSymbolId): T;
|
|
7
|
-
}, args: A): T;
|
|
7
|
+
new (args: A, id: NodeSymbolId, filepath: Filepath): T;
|
|
8
|
+
}, args: A, filepath: Filepath): T;
|
|
8
9
|
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { default as Compiler } from '../../../compiler';
|
|
2
|
+
import { AttributeNode, ElementDeclarationNode, SyntaxNode } from '../nodes';
|
|
3
|
+
import { ColumnSymbol, NodeSymbol, TablePartialSymbol, TableSymbol } from '../symbol';
|
|
4
|
+
import { Internable } from '../internable';
|
|
5
|
+
export declare enum MetadataKind {
|
|
6
|
+
Ref = "ref",
|
|
7
|
+
PartialRef = "partial ref",
|
|
8
|
+
TableChecks = "table checks",
|
|
9
|
+
Indexes = "indexes",
|
|
10
|
+
Records = "records",
|
|
11
|
+
Project = "project"
|
|
12
|
+
}
|
|
13
|
+
declare const __nodeMetadataBrand: unique symbol;
|
|
14
|
+
export type NodeMetadataId = number & {
|
|
15
|
+
readonly [__nodeMetadataBrand]: true;
|
|
16
|
+
};
|
|
17
|
+
declare const __internedNodeMetadataBrand: unique symbol;
|
|
18
|
+
export type InternedNodeMetadata = string & {
|
|
19
|
+
readonly [__internedNodeMetadataBrand]: true;
|
|
20
|
+
};
|
|
21
|
+
export declare abstract class NodeMetadata implements Internable<InternedNodeMetadata> {
|
|
22
|
+
private static id;
|
|
23
|
+
abstract readonly kind: MetadataKind;
|
|
24
|
+
declaration: SyntaxNode;
|
|
25
|
+
id: NodeMetadataId;
|
|
26
|
+
constructor(declaration: SyntaxNode);
|
|
27
|
+
intern(): InternedNodeMetadata;
|
|
28
|
+
abstract owners(compiler: Compiler): NodeSymbol[];
|
|
29
|
+
}
|
|
30
|
+
export declare class RefMetadata extends NodeMetadata {
|
|
31
|
+
declaration: ElementDeclarationNode | AttributeNode;
|
|
32
|
+
readonly kind = MetadataKind.Ref;
|
|
33
|
+
constructor(declaration: ElementDeclarationNode | AttributeNode);
|
|
34
|
+
container(compiler: Compiler): TableSymbol | undefined;
|
|
35
|
+
leftColumns(compiler: Compiler): ColumnSymbol[];
|
|
36
|
+
rightColumns(compiler: Compiler): ColumnSymbol[];
|
|
37
|
+
leftTable(compiler: Compiler): TableSymbol | undefined;
|
|
38
|
+
rightTable(compiler: Compiler): TableSymbol | undefined;
|
|
39
|
+
op(_compiler: Compiler): '>' | '<' | '-' | '<>' | undefined;
|
|
40
|
+
leftToken(): SyntaxNode;
|
|
41
|
+
rightToken(): SyntaxNode;
|
|
42
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
43
|
+
}
|
|
44
|
+
export declare class PartialRefMetadata extends NodeMetadata {
|
|
45
|
+
readonly kind = MetadataKind.PartialRef;
|
|
46
|
+
constructor(declaration: SyntaxNode);
|
|
47
|
+
container(compiler: Compiler): TablePartialSymbol | undefined;
|
|
48
|
+
leftColumns(compiler: Compiler): ColumnSymbol[];
|
|
49
|
+
rightColumns(compiler: Compiler): ColumnSymbol[];
|
|
50
|
+
leftTablePartial(compiler: Compiler): TablePartialSymbol | undefined;
|
|
51
|
+
rightTable(compiler: Compiler): TableSymbol | TablePartialSymbol | undefined;
|
|
52
|
+
op(_compiler: Compiler): '>' | '<' | '-' | '<>' | undefined;
|
|
53
|
+
leftToken(): SyntaxNode;
|
|
54
|
+
rightToken(): SyntaxNode;
|
|
55
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
56
|
+
}
|
|
57
|
+
export declare class TableChecksMetadata extends NodeMetadata {
|
|
58
|
+
readonly kind = MetadataKind.TableChecks;
|
|
59
|
+
private ownerTable;
|
|
60
|
+
constructor(declaration: ElementDeclarationNode);
|
|
61
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
62
|
+
}
|
|
63
|
+
export declare class IndexesMetadata extends NodeMetadata {
|
|
64
|
+
readonly kind = MetadataKind.Indexes;
|
|
65
|
+
private ownerTable;
|
|
66
|
+
constructor(declaration: SyntaxNode);
|
|
67
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
68
|
+
}
|
|
69
|
+
export declare class RecordsMetadata extends NodeMetadata {
|
|
70
|
+
readonly kind = MetadataKind.Records;
|
|
71
|
+
constructor(declaration: SyntaxNode);
|
|
72
|
+
table(compiler: Compiler): TableSymbol | undefined;
|
|
73
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
74
|
+
}
|
|
75
|
+
export declare class ProjectMetadata extends NodeMetadata {
|
|
76
|
+
readonly kind = MetadataKind.Project;
|
|
77
|
+
constructor(declaration: SyntaxNode);
|
|
78
|
+
owners(compiler: Compiler): NodeSymbol[];
|
|
79
|
+
}
|
|
80
|
+
export {};
|