@dbml/parse 7.1.2 → 8.0.0-alpha.10

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.
Files changed (202) hide show
  1. package/dist/dbml-parse.js +25 -19
  2. package/dist/dbml-parse.mjs +11321 -7514
  3. package/dist/src/compiler/index.d.ts +93 -53
  4. package/dist/src/compiler/projectLayout/index.d.ts +1 -0
  5. package/dist/src/compiler/projectLayout/layout.d.ts +23 -0
  6. package/dist/src/compiler/queries/canonicalName.d.ts +9 -0
  7. package/dist/src/compiler/queries/container/element.d.ts +2 -1
  8. package/dist/src/compiler/queries/container/index.d.ts +5 -5
  9. package/dist/src/compiler/queries/container/scope.d.ts +3 -2
  10. package/dist/src/compiler/queries/container/scopeKind.d.ts +2 -1
  11. package/dist/src/compiler/queries/container/stack.d.ts +2 -1
  12. package/dist/src/compiler/queries/container/token.d.ts +2 -1
  13. package/dist/src/compiler/queries/files/fileDependencies.d.ts +3 -0
  14. package/dist/src/compiler/queries/files/reachableFiles.d.ts +4 -0
  15. package/dist/src/compiler/queries/files/usableMembers.d.ts +34 -0
  16. package/dist/src/compiler/queries/legacy/parse.d.ts +10 -9
  17. package/dist/src/compiler/queries/legacy/symbol.d.ts +1 -10
  18. package/dist/src/compiler/queries/legacy/token.d.ts +3 -2
  19. package/dist/src/compiler/queries/nodeAtPosition.d.ts +5 -0
  20. package/dist/src/compiler/queries/pipeline/bind.d.ts +5 -0
  21. package/dist/src/compiler/queries/pipeline/index.d.ts +2 -0
  22. package/dist/src/compiler/queries/pipeline/interpret.d.ts +6 -0
  23. package/dist/src/compiler/queries/pipeline/parse.d.ts +12 -0
  24. package/dist/src/compiler/queries/pipeline/validate.d.ts +4 -0
  25. package/dist/src/compiler/queries/resolutionIndex.d.ts +13 -0
  26. package/dist/src/compiler/queries/symbol/lookupMembers.d.ts +4 -0
  27. package/dist/src/compiler/queries/symbol/symbolAliases.d.ts +4 -0
  28. package/dist/src/compiler/queries/symbol/symbolUses.d.ts +4 -0
  29. package/dist/src/compiler/queries/transform/index.d.ts +3 -3
  30. package/dist/src/compiler/queries/transform/renameTable.d.ts +19 -16
  31. package/dist/src/compiler/queries/transform/syncDiagramView.d.ts +19 -6
  32. package/dist/src/compiler/queries/transform/utils.d.ts +5 -4
  33. package/dist/src/compiler/queries/utils.d.ts +6 -0
  34. package/dist/src/constants.d.ts +1 -2
  35. package/dist/src/core/global_modules/checks/bind.d.ts +9 -0
  36. package/dist/src/core/global_modules/checks/index.d.ts +2 -0
  37. package/dist/src/core/global_modules/checks/interpret.d.ts +10 -0
  38. package/dist/src/core/global_modules/diagramView/bind.d.ts +18 -0
  39. package/dist/src/core/global_modules/diagramView/index.d.ts +8 -0
  40. package/dist/src/core/global_modules/diagramView/interpret.d.ts +37 -0
  41. package/dist/src/core/global_modules/enum/bind.d.ts +11 -0
  42. package/dist/src/core/global_modules/enum/index.d.ts +8 -0
  43. package/dist/src/core/global_modules/enum/interpret.d.ts +15 -0
  44. package/dist/src/core/global_modules/index.d.ts +17 -0
  45. package/dist/src/core/global_modules/indexes/bind.d.ts +12 -0
  46. package/dist/src/core/global_modules/indexes/index.d.ts +2 -0
  47. package/dist/src/core/global_modules/indexes/interpret.d.ts +10 -0
  48. package/dist/src/core/global_modules/note/bind.d.ts +11 -0
  49. package/dist/src/core/global_modules/note/index.d.ts +2 -0
  50. package/dist/src/core/global_modules/note/interpret.d.ts +17 -0
  51. package/dist/src/core/global_modules/program/bind.d.ts +17 -0
  52. package/dist/src/core/global_modules/program/index.d.ts +2 -0
  53. package/dist/src/core/global_modules/program/interpret.d.ts +23 -0
  54. package/dist/src/core/global_modules/program/utils.d.ts +3 -0
  55. package/dist/src/core/global_modules/project/bind.d.ts +11 -0
  56. package/dist/src/core/global_modules/project/index.d.ts +2 -0
  57. package/dist/src/core/global_modules/project/interpret.d.ts +16 -0
  58. package/dist/src/core/global_modules/records/bind.d.ts +17 -0
  59. package/dist/src/core/global_modules/records/index.d.ts +2 -0
  60. package/dist/src/core/global_modules/records/interpret.d.ts +13 -0
  61. package/dist/src/core/global_modules/records/utils/constraints/fk.d.ts +13 -0
  62. package/dist/src/core/global_modules/records/utils/constraints/helper.d.ts +26 -0
  63. package/dist/src/core/global_modules/records/utils/constraints/pk.d.ts +6 -0
  64. package/dist/src/core/global_modules/records/utils/constraints/unique.d.ts +5 -0
  65. package/dist/src/core/{interpreter → global_modules}/records/utils/data/sqlTypes.d.ts +0 -8
  66. package/dist/src/core/{interpreter → global_modules}/records/utils/data/values.d.ts +1 -1
  67. package/dist/src/core/global_modules/ref/bind.d.ts +15 -0
  68. package/dist/src/core/global_modules/ref/index.d.ts +7 -0
  69. package/dist/src/core/global_modules/ref/interpret.d.ts +15 -0
  70. package/dist/src/core/global_modules/schema/index.d.ts +2 -0
  71. package/dist/src/core/global_modules/table/bind.d.ts +18 -0
  72. package/dist/src/core/global_modules/table/index.d.ts +9 -0
  73. package/dist/src/core/global_modules/table/interpret.d.ts +26 -0
  74. package/dist/src/core/global_modules/table/utils.d.ts +4 -0
  75. package/dist/src/core/global_modules/tableGroup/bind.d.ts +15 -0
  76. package/dist/src/core/global_modules/tableGroup/index.d.ts +8 -0
  77. package/dist/src/core/global_modules/tableGroup/interpret.d.ts +18 -0
  78. package/dist/src/core/global_modules/tablePartial/bind.d.ts +17 -0
  79. package/dist/src/core/global_modules/tablePartial/index.d.ts +7 -0
  80. package/dist/src/core/global_modules/tablePartial/interpret.d.ts +23 -0
  81. package/dist/src/core/global_modules/types.d.ts +17 -0
  82. package/dist/src/core/global_modules/use/index.d.ts +8 -0
  83. package/dist/src/core/global_modules/utils.d.ts +17 -0
  84. package/dist/src/core/local_modules/checks/index.d.ts +2 -0
  85. package/dist/src/core/local_modules/checks/validate.d.ts +17 -0
  86. package/dist/src/core/local_modules/custom/index.d.ts +2 -0
  87. package/dist/src/core/local_modules/custom/validate.d.ts +14 -0
  88. package/dist/src/core/local_modules/diagramView/index.d.ts +2 -0
  89. package/dist/src/core/local_modules/diagramView/validate.d.ts +24 -0
  90. package/dist/src/core/local_modules/enum/index.d.ts +2 -0
  91. package/dist/src/core/local_modules/enum/validate.d.ts +17 -0
  92. package/dist/src/core/local_modules/index.d.ts +10 -0
  93. package/dist/src/core/local_modules/indexes/index.d.ts +2 -0
  94. package/dist/src/core/local_modules/indexes/validate.d.ts +18 -0
  95. package/dist/src/core/local_modules/note/index.d.ts +2 -0
  96. package/dist/src/core/local_modules/note/validate.d.ts +16 -0
  97. package/dist/src/core/local_modules/program/index.d.ts +2 -0
  98. package/dist/src/core/local_modules/program/validate.d.ts +9 -0
  99. package/dist/src/core/local_modules/project/index.d.ts +2 -0
  100. package/dist/src/core/local_modules/project/validate.d.ts +15 -0
  101. package/dist/src/core/local_modules/records/index.d.ts +2 -0
  102. package/dist/src/core/local_modules/records/validate.d.ts +20 -0
  103. package/dist/src/core/local_modules/ref/index.d.ts +2 -0
  104. package/dist/src/core/local_modules/ref/validate.d.ts +20 -0
  105. package/dist/src/core/local_modules/table/index.d.ts +2 -0
  106. package/dist/src/core/local_modules/table/validate.d.ts +21 -0
  107. package/dist/src/core/local_modules/tableGroup/index.d.ts +2 -0
  108. package/dist/src/core/local_modules/tableGroup/validate.d.ts +19 -0
  109. package/dist/src/core/local_modules/tablePartial/index.d.ts +2 -0
  110. package/dist/src/core/local_modules/tablePartial/validate.d.ts +21 -0
  111. package/dist/src/core/local_modules/types.d.ts +12 -0
  112. package/dist/src/core/local_modules/use/index.d.ts +2 -0
  113. package/dist/src/core/local_modules/use/validate.d.ts +12 -0
  114. package/dist/src/core/parser/parser.d.ts +8 -0
  115. package/dist/src/core/parser/utils.d.ts +2 -49
  116. package/dist/src/core/types/errors.d.ts +9 -5
  117. package/dist/src/core/types/filepath.d.ts +8 -2
  118. package/dist/src/core/types/index.d.ts +2 -0
  119. package/dist/src/core/types/internable.d.ts +0 -12
  120. package/dist/src/core/{analyzer/types.d.ts → types/keywords.d.ts} +6 -2
  121. package/dist/src/core/types/nodes.d.ts +61 -16
  122. package/dist/src/core/types/report.d.ts +3 -3
  123. package/dist/src/core/types/schemaJson.d.ts +14 -5
  124. package/dist/src/core/types/symbol/factory.d.ts +3 -2
  125. package/dist/src/core/types/symbol/index.d.ts +3 -4
  126. package/dist/src/core/types/symbol/metadata.d.ts +80 -0
  127. package/dist/src/core/types/symbol/symbols.d.ts +277 -86
  128. package/dist/src/core/{analyzer/utils.d.ts → utils/expression.d.ts} +10 -21
  129. package/dist/src/core/utils/interpret.d.ts +16 -0
  130. package/dist/src/core/utils/numbers.d.ts +1 -1
  131. package/dist/src/core/utils/span.d.ts +2 -4
  132. package/dist/src/core/utils/tokens.d.ts +15 -0
  133. package/dist/src/core/utils/validate.d.ts +103 -0
  134. package/dist/src/index.d.ts +13 -9
  135. package/dist/src/services/diagnostics/provider.d.ts +7 -6
  136. package/dist/src/services/index.d.ts +2 -1
  137. package/dist/src/services/monarch.d.ts +4 -3
  138. package/dist/src/services/suggestions/crossFile.d.ts +6 -0
  139. package/dist/src/services/suggestions/provider.d.ts +4 -1
  140. package/dist/src/services/suggestions/recordRowSnippet.d.ts +2 -1
  141. package/dist/src/services/suggestions/use.d.ts +5 -0
  142. package/dist/src/services/suggestions/utils/index.d.ts +10 -0
  143. package/dist/src/services/suggestions/utils/useMerger.d.ts +29 -0
  144. package/dist/src/services/types.d.ts +4 -0
  145. package/dist/src/services/utils.d.ts +4 -1
  146. package/package.json +4 -3
  147. package/dist/src/core/analyzer/analyzer.d.ts +0 -10
  148. package/dist/src/core/analyzer/binder/binder.d.ts +0 -10
  149. package/dist/src/core/analyzer/binder/elementBinder/checks.d.ts +0 -13
  150. package/dist/src/core/analyzer/binder/elementBinder/custom.d.ts +0 -16
  151. package/dist/src/core/analyzer/binder/elementBinder/diagramView.d.ts +0 -20
  152. package/dist/src/core/analyzer/binder/elementBinder/enum.d.ts +0 -16
  153. package/dist/src/core/analyzer/binder/elementBinder/indexes.d.ts +0 -17
  154. package/dist/src/core/analyzer/binder/elementBinder/note.d.ts +0 -16
  155. package/dist/src/core/analyzer/binder/elementBinder/project.d.ts +0 -16
  156. package/dist/src/core/analyzer/binder/elementBinder/records.d.ts +0 -22
  157. package/dist/src/core/analyzer/binder/elementBinder/ref.d.ts +0 -17
  158. package/dist/src/core/analyzer/binder/elementBinder/table.d.ts +0 -21
  159. package/dist/src/core/analyzer/binder/elementBinder/tableGroup.d.ts +0 -17
  160. package/dist/src/core/analyzer/binder/elementBinder/tablePartial.d.ts +0 -19
  161. package/dist/src/core/analyzer/binder/types.d.ts +0 -4
  162. package/dist/src/core/analyzer/binder/utils.d.ts +0 -33
  163. package/dist/src/core/analyzer/validator/elementValidators/checks.d.ts +0 -26
  164. package/dist/src/core/analyzer/validator/elementValidators/custom.d.ts +0 -23
  165. package/dist/src/core/analyzer/validator/elementValidators/diagramView.d.ts +0 -31
  166. package/dist/src/core/analyzer/validator/elementValidators/enum.d.ts +0 -28
  167. package/dist/src/core/analyzer/validator/elementValidators/indexes.d.ts +0 -27
  168. package/dist/src/core/analyzer/validator/elementValidators/note.d.ts +0 -25
  169. package/dist/src/core/analyzer/validator/elementValidators/project.d.ts +0 -24
  170. package/dist/src/core/analyzer/validator/elementValidators/records.d.ts +0 -29
  171. package/dist/src/core/analyzer/validator/elementValidators/ref.d.ts +0 -26
  172. package/dist/src/core/analyzer/validator/elementValidators/table.d.ts +0 -28
  173. package/dist/src/core/analyzer/validator/elementValidators/tableGroup.d.ts +0 -27
  174. package/dist/src/core/analyzer/validator/elementValidators/tablePartial.d.ts +0 -28
  175. package/dist/src/core/analyzer/validator/types.d.ts +0 -7
  176. package/dist/src/core/analyzer/validator/utils.d.ts +0 -65
  177. package/dist/src/core/analyzer/validator/validator.d.ts +0 -10
  178. package/dist/src/core/interpreter/elementInterpreter/diagramView.d.ts +0 -13
  179. package/dist/src/core/interpreter/elementInterpreter/enum.d.ts +0 -12
  180. package/dist/src/core/interpreter/elementInterpreter/project.d.ts +0 -12
  181. package/dist/src/core/interpreter/elementInterpreter/ref.d.ts +0 -14
  182. package/dist/src/core/interpreter/elementInterpreter/sticky_note.d.ts +0 -14
  183. package/dist/src/core/interpreter/elementInterpreter/table.d.ts +0 -22
  184. package/dist/src/core/interpreter/elementInterpreter/tableGroup.d.ts +0 -15
  185. package/dist/src/core/interpreter/elementInterpreter/tablePartial.d.ts +0 -19
  186. package/dist/src/core/interpreter/interpreter.d.ts +0 -10
  187. package/dist/src/core/interpreter/records/index.d.ts +0 -10
  188. package/dist/src/core/interpreter/records/utils/constraints/fk.d.ts +0 -3
  189. package/dist/src/core/interpreter/records/utils/constraints/helper.d.ts +0 -11
  190. package/dist/src/core/interpreter/records/utils/constraints/pk.d.ts +0 -3
  191. package/dist/src/core/interpreter/records/utils/constraints/unique.d.ts +0 -3
  192. package/dist/src/core/interpreter/types.d.ts +0 -47
  193. package/dist/src/core/interpreter/utils.d.ts +0 -37
  194. package/dist/src/core/types/symbol/symbolIndex.d.ts +0 -33
  195. package/dist/src/core/types/symbol/symbolTable.d.ts +0 -12
  196. package/dist/src/core/types/symbol/utils.d.ts +0 -4
  197. package/dist/src/core/utils/array.d.ts +0 -1
  198. package/dist/src/core/utils/enum.d.ts +0 -1
  199. package/dist/src/services/suggestions/utils.d.ts +0 -34
  200. /package/dist/src/core/{interpreter → global_modules}/records/utils/constraints/index.d.ts +0 -0
  201. /package/dist/src/core/{interpreter → global_modules}/records/utils/data/index.d.ts +0 -0
  202. /package/dist/src/core/{interpreter → global_modules}/records/utils/index.d.ts +0 -0
@@ -0,0 +1,8 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { UseSpecifierNode } from '../../types/nodes';
3
+ import { UseSymbol } from '../../types/symbol';
4
+ import { GlobalModule } from '../types';
5
+ export declare const useUtils: {
6
+ visibleName(compiler: Compiler, nodeOrSymbol: UseSpecifierNode | UseSymbol): string[] | undefined;
7
+ };
8
+ export declare const useModule: GlobalModule;
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../compiler';
2
+ import { RelationCardinality } from '../types';
3
+ import { PrimaryExpressionNode, SyntaxNode, VariableNode } from '../types/nodes';
4
+ import { default as Report } from '../types/report';
5
+ import { NodeSymbol } from '../types/symbol';
6
+ export declare function shouldInterpretNode(compiler: Compiler, node: SyntaxNode): boolean;
7
+ export declare function getNodeMemberSymbols(compiler: Compiler, node: SyntaxNode): Report<NodeSymbol[]>;
8
+ export declare function scanNonListNodeForBinding(node?: SyntaxNode): {
9
+ variables: (PrimaryExpressionNode & {
10
+ expression: VariableNode;
11
+ })[];
12
+ tupleElements: (PrimaryExpressionNode & {
13
+ expression: VariableNode;
14
+ })[];
15
+ }[];
16
+ export declare function nodeRefereeOfLeftExpression(compiler: Compiler, node: SyntaxNode): NodeSymbol | undefined;
17
+ export declare function getMultiplicities(op: string): [RelationCardinality, RelationCardinality] | undefined;
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const checksModule: LocalModule;
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class ChecksValidator {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateName;
11
+ private validateAlias;
12
+ private validateSettingList;
13
+ private validateBody;
14
+ private validateFields;
15
+ private validateFieldSetting;
16
+ private validateSubElements;
17
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const customModule: LocalModule;
@@ -0,0 +1,14 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../types/nodes';
4
+ export default class CustomValidator {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateName;
11
+ private validateAlias;
12
+ private validateSettingList;
13
+ validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
14
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const diagramViewModule: LocalModule;
@@ -0,0 +1,24 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError, CompileWarning } from '../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../types/nodes';
4
+ export default class DiagramViewValidator {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): {
9
+ errors: CompileError[];
10
+ warnings: CompileWarning[];
11
+ };
12
+ private validateContext;
13
+ private validateName;
14
+ private validateAlias;
15
+ private validateSettingList;
16
+ validateBody(body?: FunctionApplicationNode | BlockExpressionNode): {
17
+ errors: CompileError[];
18
+ warnings: CompileWarning[];
19
+ };
20
+ validateFields(fields: FunctionApplicationNode[]): CompileError[];
21
+ private validateSubElements;
22
+ private validateSubBlock;
23
+ validateSubBlockFields(sub: ElementDeclarationNode): CompileError[];
24
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const enumModule: LocalModule;
@@ -0,0 +1,17 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class EnumValidator {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateName;
11
+ private validateAlias;
12
+ private validateSettingList;
13
+ private validateBody;
14
+ private validateFields;
15
+ private validateFieldSettings;
16
+ private validateSubElements;
17
+ }
@@ -0,0 +1,10 @@
1
+ import { default as Compiler } from '../../compiler';
2
+ import { Unhandled } from '../types/module';
3
+ import { SyntaxNode } from '../types/nodes';
4
+ import { default as Report } from '../types/report';
5
+ import { LocalModule, Settings } from './types';
6
+ export declare const modules: LocalModule[];
7
+ export declare function validateNode(this: Compiler, node: SyntaxNode): Report<void> | Report<Unhandled>;
8
+ export declare function nodeSettings(this: Compiler, node: SyntaxNode): Report<Settings> | Report<Unhandled>;
9
+ export declare function nodeFullname(this: Compiler, node: SyntaxNode): Report<string[] | undefined> | Report<Unhandled>;
10
+ export declare function nodeAlias(this: Compiler, node: SyntaxNode): Report<string | undefined> | Report<Unhandled>;
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const indexesModule: LocalModule;
@@ -0,0 +1,18 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode, SyntaxNode } from '../../types/nodes';
4
+ export default class IndexesValidator {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateName;
11
+ private validateAlias;
12
+ private validateSettingList;
13
+ private validateBody;
14
+ private validateFields;
15
+ private validateFieldSetting;
16
+ private validateSubElements;
17
+ }
18
+ export declare function isValidIndexesType(value?: SyntaxNode): boolean;
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const noteModule: LocalModule;
@@ -0,0 +1,16 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../types/nodes';
4
+ export default class NoteValidator {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateName;
11
+ private validateAlias;
12
+ private validateSettingList;
13
+ validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
14
+ validateFields(fields: FunctionApplicationNode[]): CompileError[];
15
+ private validateSubElements;
16
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const programModule: LocalModule;
@@ -0,0 +1,9 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { ProgramNode } from '../../types/nodes';
3
+ import { default as Report } from '../../types/report';
4
+ export default class ProgramValidator {
5
+ private ast;
6
+ private compiler;
7
+ constructor(compiler: Compiler, ast: ProgramNode);
8
+ validate(): Report<ProgramNode>;
9
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const projectModule: LocalModule;
@@ -0,0 +1,15 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode } from '../../types/nodes';
4
+ export default class ProjectValidator {
5
+ private declarationNode;
6
+ private compiler;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateName;
11
+ private validateAlias;
12
+ private validateSettingList;
13
+ private validateBody;
14
+ private validateSubElements;
15
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const recordsModule: LocalModule;
@@ -0,0 +1,20 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode } from '../../types/nodes';
4
+ export default class RecordsValidator {
5
+ private declarationNode;
6
+ private compiler;
7
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateName;
11
+ private validateTopLevelName;
12
+ private validateInsideTableName;
13
+ private validateAlias;
14
+ private validateSettingList;
15
+ validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
16
+ private validateDataRows;
17
+ private validateDataRow;
18
+ private isValidRecordValue;
19
+ private validateSubElements;
20
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const refModule: LocalModule;
@@ -0,0 +1,20 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../types/nodes';
4
+ import { default as Report } from '../../types/report';
5
+ import { Settings } from '../../utils/validate';
6
+ export default class RefValidator {
7
+ private declarationNode;
8
+ private compiler;
9
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
10
+ validate(): CompileError[];
11
+ private validateContext;
12
+ private validateName;
13
+ private validateAlias;
14
+ private validateSettingList;
15
+ validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
16
+ validateFields(fields: FunctionApplicationNode[]): CompileError[];
17
+ validateFieldSettings(settings: ListExpressionNode): CompileError[];
18
+ private validateSubElements;
19
+ }
20
+ export declare function validateFieldSettings(settings: ListExpressionNode): Report<Settings>;
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const tableModule: LocalModule;
@@ -0,0 +1,21 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode, ExpressionNode, ListExpressionNode } from '../../types/nodes';
4
+ import { default as Report } from '../../types/report';
5
+ import { Settings } from '../../utils/validate';
6
+ export default class TableValidator {
7
+ private declarationNode;
8
+ private compiler;
9
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
10
+ validate(): CompileError[];
11
+ private validateContext;
12
+ private validateName;
13
+ private validateAlias;
14
+ private validateSettingList;
15
+ private validateBody;
16
+ private validateFields;
17
+ private validateFieldSetting;
18
+ private validateSubElements;
19
+ }
20
+ export declare function validateTableSettings(settingList?: ListExpressionNode): Report<Settings>;
21
+ export declare function validateFieldSetting(parts: ExpressionNode[]): Report<Settings>;
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const tableGroupModule: LocalModule;
@@ -0,0 +1,19 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { BlockExpressionNode, ElementDeclarationNode, FunctionApplicationNode, ListExpressionNode } from '../../types/nodes';
4
+ import { default as Report } from '../../types/report';
5
+ import { Settings } from '../../utils/validate';
6
+ export default class TableGroupValidator {
7
+ private declarationNode;
8
+ private compiler;
9
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
10
+ validate(): CompileError[];
11
+ private validateContext;
12
+ private validateName;
13
+ private validateAlias;
14
+ private validateSettingList;
15
+ validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
16
+ validateFields(fields: FunctionApplicationNode[]): CompileError[];
17
+ private validateSubElements;
18
+ }
19
+ export declare function validateSettingList(settingList?: ListExpressionNode): Report<Settings>;
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const tablePartialModule: LocalModule;
@@ -0,0 +1,21 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { ElementDeclarationNode, ExpressionNode, ListExpressionNode } from '../../types/nodes';
4
+ import { default as Report } from '../../types/report';
5
+ import { Settings } from '../../utils/validate';
6
+ export default class TablePartialValidator {
7
+ private compiler;
8
+ private declarationNode;
9
+ constructor(compiler: Compiler, declarationNode: ElementDeclarationNode);
10
+ validate(): CompileError[];
11
+ private validateContext;
12
+ private validateName;
13
+ private validateAlias;
14
+ private validateSettingList;
15
+ private validateBody;
16
+ private validateFields;
17
+ private validateFieldSetting;
18
+ private validateSubElements;
19
+ }
20
+ export declare function validateTablePartialSettings(settingList?: ListExpressionNode): Report<Settings>;
21
+ export declare function validateFieldSetting(parts: ExpressionNode[]): Report<Settings>;
@@ -0,0 +1,12 @@
1
+ import { default as Compiler } from '../../compiler';
2
+ import { Module, PassThrough } from '../types/module';
3
+ import { SyntaxNode } from '../types/nodes';
4
+ import { default as Report } from '../types/report';
5
+ import { Settings } from '../utils/validate';
6
+ export type { Settings };
7
+ export interface LocalModule extends Module {
8
+ validateNode?(compiler: Compiler, node: SyntaxNode): Report<void> | Report<PassThrough>;
9
+ nodeFullname?(compiler: Compiler, node: SyntaxNode): Report<string[] | undefined> | Report<PassThrough>;
10
+ nodeAlias?(compiler: Compiler, node: SyntaxNode): Report<string | undefined> | Report<PassThrough>;
11
+ nodeSettings?(compiler: Compiler, node: SyntaxNode): Report<Settings> | Report<PassThrough>;
12
+ }
@@ -0,0 +1,2 @@
1
+ import { LocalModule } from '../types';
2
+ export declare const useModule: LocalModule;
@@ -0,0 +1,12 @@
1
+ import { default as Compiler } from '../../../compiler';
2
+ import { CompileError } from '../../types/errors';
3
+ import { UseDeclarationNode } from '../../types/nodes';
4
+ export default class UseDeclarationValidator {
5
+ private compiler;
6
+ private declarationNode;
7
+ constructor(compiler: Compiler, declarationNode: UseDeclarationNode);
8
+ validate(): CompileError[];
9
+ private validateContext;
10
+ private validateBody;
11
+ private validateSpecifier;
12
+ }
@@ -9,6 +9,7 @@ export default class Parser {
9
9
  private contextStack;
10
10
  private nodeFactory;
11
11
  private source;
12
+ private filepath;
12
13
  constructor(source: string, tokens: SyntaxToken[], nodeIdGenerator: SyntaxNodeIdGenerator, filepath: Filepath);
13
14
  private isAtEnd;
14
15
  private advance;
@@ -24,7 +25,13 @@ export default class Parser {
24
25
  ast: ProgramNode;
25
26
  tokens: SyntaxToken[];
26
27
  }>;
28
+ private assignParents;
27
29
  private program;
30
+ private useDeclaration;
31
+ private useSpecifierList;
32
+ private synchronizeUseSpecifierList;
33
+ private useSpecifier;
34
+ private synchronizeUseSpecifier;
28
35
  private synchronizeProgram;
29
36
  private elementDeclaration;
30
37
  private synchronizeElementDeclarationName;
@@ -39,6 +46,7 @@ export default class Parser {
39
46
  private leftExpression_bp;
40
47
  private extractOperand;
41
48
  private functionExpression;
49
+ private wildcardExpression;
42
50
  private blockExpression;
43
51
  private canBeField;
44
52
  private synchronizeBlock;
@@ -1,53 +1,6 @@
1
1
  import { default as NodeFactory } from './factory';
2
- import { CommaExpressionNode, ElementDeclarationNode, ExpressionNode, IdentiferStreamNode, InfixExpressionNode, LiteralNode, NormalExpressionNode, PrimaryExpressionNode, SyntaxNode, VariableNode } from '../types/nodes';
3
- import { SyntaxToken, SyntaxTokenKind } from '../types/tokens';
2
+ import { CommaExpressionNode, ElementDeclarationNode, ExpressionNode, NormalExpressionNode, SyntaxNode } from '../types/nodes';
3
+ import { SyntaxToken } from '../types/tokens';
4
4
  export declare function convertFuncAppToElem(_callee: ExpressionNode | CommaExpressionNode | undefined, _args: (NormalExpressionNode | CommaExpressionNode)[], factory: NodeFactory): ElementDeclarationNode | undefined;
5
- export declare function isAsKeyword(token?: SyntaxToken): token is SyntaxToken & {
6
- kind: SyntaxTokenKind.IDENTIFIER;
7
- value: 'as';
8
- };
9
5
  export declare function markInvalid(nodeOrToken?: SyntaxNode | SyntaxToken): void;
10
- export declare function isInvalidToken(token?: SyntaxToken): boolean;
11
6
  export declare function getMemberChain(node: SyntaxNode): Readonly<(SyntaxNode | SyntaxToken)[]>;
12
- export declare function extractVariableNode(value?: unknown): SyntaxToken | undefined;
13
- export declare function isExpressionAQuotedString(value?: unknown): value is PrimaryExpressionNode & ({
14
- expression: VariableNode & {
15
- variable: SyntaxToken & {
16
- kind: SyntaxTokenKind.QUOTED_STRING;
17
- };
18
- };
19
- } | {
20
- expression: LiteralNode & {
21
- literal: SyntaxToken & {
22
- kind: SyntaxTokenKind.STRING_LITERAL;
23
- };
24
- };
25
- });
26
- export declare function isExpressionAVariableNode(value?: unknown): value is PrimaryExpressionNode & {
27
- expression: VariableNode & {
28
- variable: SyntaxToken;
29
- };
30
- };
31
- export declare function isWildcardExpression(node: SyntaxNode | undefined): boolean;
32
- export declare function isExpressionAnIdentifierNode(value?: unknown): value is PrimaryExpressionNode & {
33
- expression: VariableNode & {
34
- variable: {
35
- kind: SyntaxTokenKind.IDENTIFIER;
36
- };
37
- };
38
- };
39
- type AccessExpression = InfixExpressionNode & {
40
- leftExpression: SyntaxNode;
41
- rightExpression: SyntaxNode;
42
- op: SyntaxToken & {
43
- value: '.';
44
- };
45
- };
46
- type DotDelimitedIdentifier = PrimaryExpressionNode | (AccessExpression & {
47
- rightExpression: AccessExpression | PrimaryExpressionNode;
48
- });
49
- export declare function isAccessExpression(node?: SyntaxNode): node is AccessExpression;
50
- export declare function isDotDelimitedIdentifier(node?: SyntaxNode): node is DotDelimitedIdentifier;
51
- export declare function extractStringFromIdentifierStream(stream?: IdentiferStreamNode): string | undefined;
52
- export declare function getElementNameString(element?: ElementDeclarationNode): string | undefined;
53
- export {};
@@ -1,6 +1,6 @@
1
+ import { Filepath } from './filepath';
1
2
  import { SyntaxNode } from './nodes';
2
3
  import { SyntaxToken } from './tokens';
3
- import { Filepath } from './filepath';
4
4
  export declare enum CompileErrorCode {
5
5
  UNKNOWN_SYMBOL = 1000,
6
6
  UNEXPECTED_SYMBOL = 1001,
@@ -96,11 +96,15 @@ export declare enum CompileErrorCode {
96
96
  INVALID_RECORDS_FIELD = 3079,
97
97
  DUPLICATE_COLUMN_REFERENCES_IN_RECORDS = 3080,
98
98
  DUPLICATE_RECORDS_FOR_TABLE = 3081,
99
- INVALID_DIAGRAMVIEW_CONTEXT = 3082,
100
- DUPLICATE_DIAGRAMVIEW_NAME = 3083,
101
- INVALID_DIAGRAMVIEW_FIELD = 3084,
102
- DUPLICATE_DIAGRAMVIEW_FIELD = 3085,
99
+ INVALID_USE_CONTEXT = 3082,
100
+ INVALID_USE_SPECIFIER_KIND = 3083,
101
+ INVALID_USE_SPECIFIER_NAME = 3084,
102
+ INVALID_DIAGRAMVIEW_CONTEXT = 3085,
103
+ DUPLICATE_DIAGRAMVIEW_NAME = 3086,
104
+ INVALID_DIAGRAMVIEW_FIELD = 3087,
105
+ DUPLICATE_DIAGRAMVIEW_FIELD = 3088,
103
106
  BINDING_ERROR = 4000,
107
+ NONEXISTENT_MODULE = 4001,
104
108
  UNSUPPORTED = 5000,
105
109
  CIRCULAR_REF = 5001,
106
110
  SAME_ENDPOINT = 5002,
@@ -4,8 +4,11 @@ export type FilepathId = string & {
4
4
  [__filepathIdBrand]: true;
5
5
  };
6
6
  export declare class Filepath implements Internable<FilepathId> {
7
+ private readonly protocol?;
7
8
  private readonly path;
8
- constructor(absolutePath: string);
9
+ constructor(absolutePath: string, options?: {
10
+ protocol?: string;
11
+ });
9
12
  intern(): FilepathId;
10
13
  static from(absolutePath: string): Filepath;
11
14
  static resolve(fromDir: string, relativePath: string): Filepath;
@@ -19,7 +22,10 @@ export declare class Filepath implements Internable<FilepathId> {
19
22
  relativeTo(baseDir: string): string;
20
23
  toString(): string;
21
24
  equals(other: Filepath): boolean;
22
- toUri(): string;
25
+ isParentOf(other: Filepath): boolean;
26
+ toUri(options?: {
27
+ protocol?: string;
28
+ }): string;
23
29
  static isRelative(p: string): boolean;
24
30
  }
25
31
  export declare function resolveImportFilepath(currentFilepath: Filepath, relativePath: string): Filepath | undefined;
@@ -1,3 +1,4 @@
1
+ export * from './module';
1
2
  export * from './errors';
2
3
  export * from './report';
3
4
  export * from './position';
@@ -5,3 +6,4 @@ export * from './filepath';
5
6
  export * from './internable';
6
7
  export * from './symbol';
7
8
  export * from './schemaJson';
9
+ export * from './keywords';
@@ -6,15 +6,3 @@ export declare function intern<T extends Primitive, Id extends Primitive>(value:
6
6
  export declare function intern<Id extends Primitive>(value: Internable<Id>): Id;
7
7
  export declare function intern<T extends Primitive>(value: T): T;
8
8
  export declare function intern<T extends Primitive>(value: T[]): string;
9
- export declare class InternedMap<K extends Internable<P>, V, P extends Primitive = ReturnType<K['intern']>> {
10
- private readonly map;
11
- constructor();
12
- get(key: K): V | undefined;
13
- set(key: K, value: V): this;
14
- has(key: K): boolean;
15
- delete(key: K): boolean;
16
- get size(): number;
17
- entries(): IterableIterator<[P, V]>;
18
- [Symbol.iterator](): IterableIterator<[P, V]>;
19
- merge(other: InternedMap<K, V, P>): this;
20
- }
@@ -7,9 +7,13 @@ export declare enum ElementKind {
7
7
  Indexes = "indexes",
8
8
  TableGroup = "tablegroup",
9
9
  TablePartial = "tablepartial",
10
- Check = "checks",
10
+ Checks = "checks",
11
11
  Records = "records",
12
- DiagramView = "diagramview"
12
+ DiagramView = "diagramview",
13
+ DiagramViewTables = "tables",
14
+ DiagramViewNotes = "notes",
15
+ DiagramViewTableGroups = "tablegroups",
16
+ DiagramViewSchemas = "schemas"
13
17
  }
14
18
  export declare enum SettingName {
15
19
  Color = "color",