@dbml/parse 5.4.0 → 5.5.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/LICENSE +0 -0
- package/dist/{tests → __tests__/examples}/binder/binder.test.d.ts +0 -0
- package/dist/{tests → __tests__/examples}/compiler/applyTextEdits.test.d.ts +0 -0
- package/dist/{tests → __tests__/examples}/compiler/renameTable.test.d.ts +0 -0
- package/dist/{tests → __tests__/examples}/interpreter/interpreter.test.d.ts +0 -0
- package/dist/{tests → __tests__/examples}/lexer/lexer.test.d.ts +0 -0
- package/dist/{tests → __tests__/examples}/parser/parser.test.d.ts +0 -0
- package/dist/{tests/NaN_errors/interpreter_NaN.test.d.ts → __tests__/examples/services/definition.test.d.ts} +0 -0
- package/dist/{tests/validator/validator.test.d.ts → __tests__/examples/services/references.test.d.ts} +0 -0
- package/dist/__tests__/examples/services/service_utils.test.d.ts +1 -0
- package/dist/__tests__/examples/services/suggestions.test.d.ts +1 -0
- package/dist/__tests__/examples/validator/validator.test.d.ts +1 -0
- package/dist/__tests__/fuzz/interpreter.test.d.ts +1 -0
- package/dist/__tests__/fuzz/parser.test.d.ts +1 -0
- package/dist/__tests__/fuzz/services.test.d.ts +1 -0
- package/dist/__tests__/properties/lexer.test.d.ts +1 -0
- package/dist/__tests__/properties/parser.test.d.ts +1 -0
- package/dist/__tests__/snapshots/binder/binder.test.d.ts +1 -0
- package/dist/__tests__/snapshots/interpreter/interpreter.test.d.ts +1 -0
- package/dist/__tests__/snapshots/lexer/lexer.test.d.ts +1 -0
- package/dist/__tests__/snapshots/nan/nan.test.d.ts +1 -0
- package/dist/__tests__/snapshots/parser/parser.test.d.ts +1 -0
- package/dist/__tests__/snapshots/validator/validator.test.d.ts +1 -0
- package/dist/__tests__/utils/arbitraries/grammars.d.ts +100 -0
- package/dist/__tests__/utils/arbitraries/index.d.ts +3 -0
- package/dist/__tests__/utils/arbitraries/tokens.d.ts +20 -0
- package/dist/__tests__/utils/arbitraries/utils.d.ts +59 -0
- package/dist/__tests__/utils/compiler.d.ts +13 -0
- package/dist/__tests__/utils/index.d.ts +3 -0
- package/dist/__tests__/utils/mocks.d.ts +16 -0
- package/dist/__tests__/utils/testHelpers.d.ts +16 -0
- package/dist/dbml-parse.js +29 -10
- package/dist/dbml-parse.mjs +8505 -4841
- package/dist/index.d.ts +2 -0
- package/dist/src/compiler/index.d.ts +0 -0
- package/dist/src/compiler/queries/container/element.d.ts +0 -0
- package/dist/src/compiler/queries/container/index.d.ts +0 -0
- package/dist/src/compiler/queries/container/scope.d.ts +0 -0
- package/dist/src/compiler/queries/container/scopeKind.d.ts +0 -0
- package/dist/src/compiler/queries/container/stack.d.ts +0 -0
- package/dist/src/compiler/queries/container/token.d.ts +0 -0
- package/dist/src/compiler/queries/parse.d.ts +0 -0
- package/dist/src/compiler/queries/symbol.d.ts +0 -0
- package/dist/src/compiler/queries/token.d.ts +0 -0
- package/dist/src/compiler/queries/transform/applyTextEdits.d.ts +0 -0
- package/dist/src/compiler/queries/transform/index.d.ts +0 -0
- package/dist/src/compiler/queries/transform/renameTable.d.ts +0 -0
- package/dist/src/compiler/types.d.ts +0 -0
- package/dist/src/constants.d.ts +0 -0
- package/dist/src/core/analyzer/analyzer.d.ts +0 -0
- package/dist/src/core/analyzer/binder/binder.d.ts +4 -3
- package/dist/src/core/analyzer/binder/elementBinder/checks.d.ts +12 -11
- package/dist/src/core/analyzer/binder/elementBinder/custom.d.ts +15 -9
- package/dist/src/core/analyzer/binder/elementBinder/enum.d.ts +15 -11
- package/dist/src/core/analyzer/binder/elementBinder/indexes.d.ts +16 -16
- package/dist/src/core/analyzer/binder/elementBinder/note.d.ts +15 -11
- package/dist/src/core/analyzer/binder/elementBinder/project.d.ts +15 -9
- package/dist/src/core/analyzer/binder/elementBinder/ref.d.ts +16 -16
- package/dist/src/core/analyzer/binder/elementBinder/table.d.ts +20 -48
- package/dist/src/core/analyzer/binder/elementBinder/tableGroup.d.ts +16 -16
- package/dist/src/core/analyzer/binder/elementBinder/tablePartial.d.ts +18 -36
- package/dist/src/core/analyzer/binder/types.d.ts +3 -16
- package/dist/src/core/analyzer/binder/utils.d.ts +18 -2
- package/dist/src/core/analyzer/symbol/factory.d.ts +0 -0
- package/dist/src/core/analyzer/symbol/symbolIndex.d.ts +2 -4
- package/dist/src/core/analyzer/symbol/symbolTable.d.ts +0 -0
- package/dist/src/core/analyzer/symbol/symbols.d.ts +9 -8
- package/dist/src/core/analyzer/symbol/utils.d.ts +3 -3
- package/dist/src/core/analyzer/types.d.ts +0 -0
- package/dist/src/core/analyzer/utils.d.ts +8 -5
- package/dist/src/core/analyzer/validator/elementValidators/checks.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/custom.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/enum.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/indexes.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/note.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/project.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/ref.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/table.d.ts +1 -3
- package/dist/src/core/analyzer/validator/elementValidators/tableGroup.d.ts +0 -0
- package/dist/src/core/analyzer/validator/elementValidators/tablePartial.d.ts +0 -0
- package/dist/src/core/analyzer/validator/types.d.ts +0 -0
- package/dist/src/core/analyzer/validator/utils.d.ts +18 -3
- package/dist/src/core/analyzer/validator/validator.d.ts +0 -0
- package/dist/src/core/errors.d.ts +0 -0
- package/dist/src/core/interpreter/elementInterpreter/enum.d.ts +0 -0
- package/dist/src/core/interpreter/elementInterpreter/project.d.ts +0 -0
- package/dist/src/core/interpreter/elementInterpreter/ref.d.ts +0 -0
- package/dist/src/core/interpreter/elementInterpreter/sticky_note.d.ts +0 -0
- package/dist/src/core/interpreter/elementInterpreter/table.d.ts +0 -0
- package/dist/src/core/interpreter/elementInterpreter/tableGroup.d.ts +0 -0
- package/dist/src/core/interpreter/elementInterpreter/tablePartial.d.ts +0 -0
- package/dist/src/core/interpreter/interpreter.d.ts +0 -0
- package/dist/src/core/interpreter/types.d.ts +1 -1
- package/dist/src/core/interpreter/utils.d.ts +0 -0
- package/dist/src/core/lexer/lexer.d.ts +0 -0
- package/dist/src/core/lexer/tokens.d.ts +0 -1
- package/dist/src/core/lexer/utils.d.ts +0 -0
- package/dist/src/core/option.d.ts +0 -0
- package/dist/src/core/parser/contextStack.d.ts +0 -0
- package/dist/src/core/parser/factory.d.ts +0 -0
- package/dist/src/core/parser/nodes.d.ts +3 -11
- package/dist/src/core/parser/parser.d.ts +0 -1
- package/dist/src/core/parser/utils.d.ts +1 -0
- package/dist/src/core/report.d.ts +0 -0
- package/dist/src/core/serialization/serialize.d.ts +0 -0
- package/dist/src/core/types.d.ts +0 -0
- package/dist/src/core/utils.d.ts +0 -0
- package/dist/src/index.d.ts +0 -0
- package/dist/src/services/definition/provider.d.ts +0 -0
- package/dist/src/services/index.d.ts +0 -0
- package/dist/src/services/references/provider.d.ts +0 -0
- package/dist/src/services/suggestions/provider.d.ts +0 -0
- package/dist/src/services/suggestions/utils.d.ts +0 -0
- package/dist/src/services/types.d.ts +1 -1
- package/dist/src/services/utils.d.ts +0 -0
- package/package.json +5 -5
- package/dist/src/core/analyzer/binder/elementBinder/elementBinder.d.ts +0 -25
- package/dist/tests/jestHelpers.d.ts +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as SymbolFactory } from '../../symbol/factory';
|
|
2
2
|
import { CompileError } from '../../../errors';
|
|
3
|
-
import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode
|
|
3
|
+
import { BlockExpressionNode, ElementDeclarationNode, ExpressionNode, FunctionApplicationNode } from '../../../parser/nodes';
|
|
4
4
|
import { ElementValidator } from '../types';
|
|
5
5
|
import { SyntaxToken } from '../../../lexer/tokens';
|
|
6
6
|
import { default as SymbolTable } from '../../symbol/symbolTable';
|
|
@@ -18,8 +18,6 @@ export default class TableValidator implements ElementValidator {
|
|
|
18
18
|
private validateSettingList;
|
|
19
19
|
registerElement(): CompileError[];
|
|
20
20
|
validateBody(body?: FunctionApplicationNode | BlockExpressionNode): CompileError[];
|
|
21
|
-
validateInjections(injections: PartialInjectionNode[]): CompileError[];
|
|
22
|
-
registerInjection(injection: PartialInjectionNode): CompileError[];
|
|
23
21
|
validateFields(fields: FunctionApplicationNode[]): CompileError[];
|
|
24
22
|
registerField(field: FunctionApplicationNode): CompileError[];
|
|
25
23
|
validateFieldSetting(parts: ExpressionNode[]): CompileError[];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SyntaxToken } from '../../lexer/tokens';
|
|
2
|
-
import { AttributeNode, BlockExpressionNode, ElementDeclarationNode, ListExpressionNode, PrefixExpressionNode, PrimaryExpressionNode, SyntaxNode, TupleExpressionNode, VariableNode } from '../../parser/nodes';
|
|
1
|
+
import { SyntaxToken, SyntaxTokenKind } from '../../lexer/tokens';
|
|
2
|
+
import { AttributeNode, BlockExpressionNode, ElementDeclarationNode, ListExpressionNode, LiteralNode, PrefixExpressionNode, PrimaryExpressionNode, SyntaxNode, TupleExpressionNode, VariableNode } from '../../parser/nodes';
|
|
3
3
|
import { default as CustomValidator } from './elementValidators/custom';
|
|
4
4
|
import { default as EnumValidator } from './elementValidators/enum';
|
|
5
5
|
import { default as IndexesValidator } from './elementValidators/indexes';
|
|
@@ -32,12 +32,27 @@ export declare function hasComplexBody(node: ElementDeclarationNode): node is El
|
|
|
32
32
|
export declare function hasSimpleBody(node: ElementDeclarationNode): node is ElementDeclarationNode & {
|
|
33
33
|
bodyColon: SyntaxToken;
|
|
34
34
|
};
|
|
35
|
+
export declare function isValidPartialInjection(node?: SyntaxNode): node is PrefixExpressionNode & {
|
|
36
|
+
op: {
|
|
37
|
+
value: '~';
|
|
38
|
+
};
|
|
39
|
+
};
|
|
35
40
|
export declare function registerSchemaStack(variables: string[], globalSchema: SymbolTable, symbolFactory: SymbolFactory): SymbolTable;
|
|
36
41
|
export declare function isRelationshipOp(op?: string): boolean;
|
|
37
42
|
export declare function isValidColor(value?: SyntaxNode): boolean;
|
|
38
43
|
export declare function isVoid(value?: SyntaxNode): boolean;
|
|
39
44
|
export declare function isValidDefaultValue(value?: SyntaxNode): boolean;
|
|
40
|
-
export
|
|
45
|
+
export type SignedNumberExpression = (PrimaryExpressionNode & {
|
|
46
|
+
expression: LiteralNode & {
|
|
47
|
+
literal: {
|
|
48
|
+
kind: SyntaxTokenKind.NUMERIC_LITERAL;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}) | (PrefixExpressionNode & {
|
|
52
|
+
op: '-' | '+';
|
|
53
|
+
expression: SignedNumberExpression;
|
|
54
|
+
});
|
|
55
|
+
export declare function isExpressionASignedNumberExpression(value?: SyntaxNode): value is SignedNumberExpression;
|
|
41
56
|
export declare function isUnaryRelationship(value?: SyntaxNode): value is PrefixExpressionNode;
|
|
42
57
|
export declare function isTupleOfVariables(value?: SyntaxNode): value is TupleExpressionNode & {
|
|
43
58
|
elementList: (PrimaryExpressionNode & {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -17,7 +17,7 @@ export interface InterpreterDatabase {
|
|
|
17
17
|
};
|
|
18
18
|
ref: Map<ElementDeclarationNode, Ref>;
|
|
19
19
|
enums: Map<ElementDeclarationNode, Enum>;
|
|
20
|
-
|
|
20
|
+
tableOwnerGroup: {
|
|
21
21
|
[tableid: string]: ElementDeclarationNode;
|
|
22
22
|
};
|
|
23
23
|
tableGroups: Map<ElementDeclarationNode, TableGroup>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -39,8 +39,7 @@ export declare enum SyntaxNodeKind {
|
|
|
39
39
|
PRIMARY_EXPRESSION = "<primary-expression>",
|
|
40
40
|
GROUP_EXPRESSION = "<group-expression>",
|
|
41
41
|
DUMMY = "<dummy>",
|
|
42
|
-
ARRAY = "<array>"
|
|
43
|
-
PARTIAL_INJECTION = "<partial-injection>"
|
|
42
|
+
ARRAY = "<array>"
|
|
44
43
|
}
|
|
45
44
|
export declare class ProgramNode extends SyntaxNode {
|
|
46
45
|
body: ElementDeclarationNode[];
|
|
@@ -129,21 +128,14 @@ export declare class FunctionApplicationNode extends SyntaxNode {
|
|
|
129
128
|
}
|
|
130
129
|
export declare class BlockExpressionNode extends SyntaxNode {
|
|
131
130
|
blockOpenBrace?: SyntaxToken;
|
|
132
|
-
body: (
|
|
131
|
+
body: (ElementDeclarationNode | FunctionApplicationNode)[];
|
|
133
132
|
blockCloseBrace?: SyntaxToken;
|
|
134
133
|
constructor({ blockOpenBrace, body, blockCloseBrace, }: {
|
|
135
134
|
blockOpenBrace?: SyntaxToken;
|
|
136
|
-
body?: (
|
|
135
|
+
body?: (ElementDeclarationNode | FunctionApplicationNode)[];
|
|
137
136
|
blockCloseBrace?: SyntaxToken;
|
|
138
137
|
}, id: SyntaxNodeId);
|
|
139
138
|
}
|
|
140
|
-
export declare class PartialInjectionNode extends SyntaxNode {
|
|
141
|
-
partial?: VariableNode;
|
|
142
|
-
constructor({ op, partial }: {
|
|
143
|
-
op?: SyntaxToken;
|
|
144
|
-
partial?: VariableNode;
|
|
145
|
-
}, id: SyntaxNodeId);
|
|
146
|
-
}
|
|
147
139
|
export declare class ListExpressionNode extends SyntaxNode {
|
|
148
140
|
listOpenBracket?: SyntaxToken;
|
|
149
141
|
elementList: AttributeNode[];
|
|
@@ -49,4 +49,5 @@ type DotDelimitedIdentifier = PrimaryExpressionNode | (AccessExpression & {
|
|
|
49
49
|
export declare function isAccessExpression(node?: SyntaxNode): node is AccessExpression;
|
|
50
50
|
export declare function isDotDelimitedIdentifier(node?: SyntaxNode): node is DotDelimitedIdentifier;
|
|
51
51
|
export declare function extractStringFromIdentifierStream(stream?: IdentiferStreamNode): Option<string>;
|
|
52
|
+
export declare function getElementName(element: ElementDeclarationNode): Option<string>;
|
|
52
53
|
export {};
|
|
File without changes
|
|
File without changes
|
package/dist/src/core/types.d.ts
CHANGED
|
File without changes
|
package/dist/src/core/utils.d.ts
CHANGED
|
File without changes
|
package/dist/src/index.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IPosition, editor, languages, IRange, IDisposable, CancellationToken as ICancellationToken } from 'monaco-editor-core';
|
|
2
2
|
export type Position = IPosition;
|
|
3
3
|
export type TextModel = editor.ITextModel;
|
|
4
4
|
export type ProviderResult<T> = languages.ProviderResult<T>;
|
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "@dbml/parse",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.5.0",
|
|
5
5
|
"description": "DBML parser v2",
|
|
6
6
|
"author": "Holistics <dev@holistics.io>",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"types": "./dist/index.d.ts",
|
|
17
17
|
"exports": {
|
|
18
18
|
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
19
20
|
"import": "./dist/dbml-parse.mjs",
|
|
20
21
|
"require": "./dist/dbml-parse.js"
|
|
21
22
|
}
|
|
@@ -44,9 +45,8 @@
|
|
|
44
45
|
"monaco-editor-core": "^0.44.0",
|
|
45
46
|
"typescript": "^5.9.3",
|
|
46
47
|
"typescript-eslint": "^8.46.3",
|
|
47
|
-
"vite": "^
|
|
48
|
-
"vite-plugin-dts": "^4.5.4"
|
|
49
|
-
"vitest": "^3.1.4"
|
|
48
|
+
"vite": "^7.2.2",
|
|
49
|
+
"vite-plugin-dts": "^4.5.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"lodash-es": "^4.17.21"
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"engines": {
|
|
55
55
|
"node": ">=18"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "dc9d32e973037784935ec6d92d22e751945bb194"
|
|
58
58
|
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ElementDeclarationNode, SyntaxNode } from '../../../parser/nodes';
|
|
2
|
-
import { ArgumentBinderRule, BinderRule, SettingListBinderRule } from '../types';
|
|
3
|
-
import { CompileError } from '../../../errors';
|
|
4
|
-
import { default as SymbolFactory } from '../../symbol/factory';
|
|
5
|
-
export default abstract class ElementBinder {
|
|
6
|
-
protected abstract subfield: {
|
|
7
|
-
arg: ArgumentBinderRule;
|
|
8
|
-
settingList: SettingListBinderRule;
|
|
9
|
-
};
|
|
10
|
-
protected abstract settingList: SettingListBinderRule;
|
|
11
|
-
protected injectionBinderRule?: BinderRule;
|
|
12
|
-
private errors;
|
|
13
|
-
private declarationNode;
|
|
14
|
-
constructor(declarationNode: ElementDeclarationNode, errors: CompileError[]);
|
|
15
|
-
bind(): void;
|
|
16
|
-
private bindSettingList;
|
|
17
|
-
private bindBody;
|
|
18
|
-
private bindSubfield;
|
|
19
|
-
private bindPartialInjection;
|
|
20
|
-
private scanAndBind;
|
|
21
|
-
private bindFragments;
|
|
22
|
-
private resolveIndexStack;
|
|
23
|
-
protected logError(node: SyntaxNode, message: string, ignoreError: boolean): void;
|
|
24
|
-
resolveInjections(symbolFactory: SymbolFactory): void;
|
|
25
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function scanTestNames(_path: any): string[];
|