@rsconcept/domain 1.0.0 → 1.1.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/README.md +3 -3
- package/dist/analyzer-DlSq3Y3r.d.ts +39 -0
- package/dist/arguments-extractor-1acwjQNc.d.ts +38 -0
- package/dist/ast-C8sIpKdL.d.ts +51 -0
- package/dist/ast-annotations-BiMjkKvz.d.ts +16 -0
- package/dist/branded-ZlzIcxzu.d.ts +9 -0
- package/dist/calculator-C9W2jkSx.d.ts +39 -0
- package/dist/cctext/index.d.ts +2 -1
- package/dist/cctext/index.js +2 -42
- package/dist/cctext/language-api.d.ts +10 -12
- package/dist/cctext/language-api.js +157 -227
- package/dist/cctext/language-api.js.map +1 -1
- package/dist/cctext/language.d.ts +24 -22
- package/dist/cctext/language.js +43 -39
- package/dist/cctext/language.js.map +1 -1
- package/dist/error-E1LVq_3w.d.ts +87 -0
- package/dist/graph/graph.d.ts +2 -62
- package/dist/graph/graph.js +339 -382
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/index.d.ts +2 -1
- package/dist/graph/index.js +2 -384
- package/dist/graph-DR8rL2o3.d.ts +64 -0
- package/dist/hash-Y8I4c6Al.d.ts +8 -0
- package/dist/index-BKZ67WMa.d.ts +1 -0
- package/dist/index-BVVgDSdq.d.ts +1 -0
- package/dist/index-DmtQKWjk.d.ts +1 -0
- package/dist/index-_6s0AX1B.d.ts +1 -0
- package/dist/index.d.ts +27 -28
- package/dist/index.js +23 -5851
- package/dist/lezer-tree-iS7LpLBJ.d.ts +14 -0
- package/dist/library/folder-tree.d.ts +22 -20
- package/dist/library/folder-tree.js +108 -130
- package/dist/library/folder-tree.js.map +1 -1
- package/dist/library/index.d.ts +8 -17
- package/dist/library/index.js +7 -2800
- package/dist/library/library-api.d.ts +3 -1
- package/dist/library/library-api.js +9 -8
- package/dist/library/library-api.js.map +1 -1
- package/dist/library/library.d.ts +2 -56
- package/dist/library/library.js +23 -19
- package/dist/library/library.js.map +1 -1
- package/dist/library/oss-api.d.ts +26 -37
- package/dist/library/oss-api.js +257 -1096
- package/dist/library/oss-api.js.map +1 -1
- package/dist/library/oss-layout-api.d.ts +28 -28
- package/dist/library/oss-layout-api.js +239 -316
- package/dist/library/oss-layout-api.js.map +1 -1
- package/dist/library/oss-layout.d.ts +2 -25
- package/dist/library/oss-layout.js +1 -1
- package/dist/library/oss.d.ts +87 -89
- package/dist/library/oss.js +27 -26
- package/dist/library/oss.js.map +1 -1
- package/dist/library/rsengine.d.ts +100 -106
- package/dist/library/rsengine.js +439 -2599
- package/dist/library/rsengine.js.map +1 -1
- package/dist/library/rsform-api.d.ts +11 -16
- package/dist/library/rsform-api.js +313 -825
- package/dist/library/rsform-api.js.map +1 -1
- package/dist/library/rsform.d.ts +159 -167
- package/dist/library/rsform.js +29 -28
- package/dist/library/rsform.js.map +1 -1
- package/dist/library/rsmodel-api.d.ts +8 -15
- package/dist/library/rsmodel-api.js +172 -813
- package/dist/library/rsmodel-api.js.map +1 -1
- package/dist/library/rsmodel.d.ts +27 -33
- package/dist/library/rsmodel.js +16 -23
- package/dist/library/rsmodel.js.map +1 -1
- package/dist/library/structure-planner.d.ts +20 -26
- package/dist/library/structure-planner.js +106 -474
- package/dist/library/structure-planner.js.map +1 -1
- package/dist/library-CYun28Xz.d.ts +58 -0
- package/dist/oss-layout-3glgAqfn.d.ts +27 -0
- package/dist/parser-Bwd8LxJ1.d.ts +7 -0
- package/dist/parsing/ast.d.ts +2 -49
- package/dist/parsing/ast.js +68 -76
- package/dist/parsing/ast.js.map +1 -1
- package/dist/parsing/index.d.ts +3 -3
- package/dist/parsing/index.js +3 -141
- package/dist/parsing/lezer-tree.d.ts +2 -13
- package/dist/parsing/lezer-tree.js +50 -43
- package/dist/parsing/lezer-tree.js.map +1 -1
- package/dist/rslang/api.d.ts +9 -14
- package/dist/rslang/api.js +114 -827
- package/dist/rslang/api.js.map +1 -1
- package/dist/rslang/ast-annotations.d.ts +2 -18
- package/dist/rslang/ast-annotations.js +34 -45
- package/dist/rslang/ast-annotations.js.map +1 -1
- package/dist/rslang/error.d.ts +2 -85
- package/dist/rslang/error.js +88 -150
- package/dist/rslang/error.js.map +1 -1
- package/dist/rslang/eval/calculator.d.ts +2 -43
- package/dist/rslang/eval/calculator.js +81 -1636
- package/dist/rslang/eval/calculator.js.map +1 -1
- package/dist/rslang/eval/evaluation-cache.d.ts +22 -26
- package/dist/rslang/eval/evaluation-cache.js +168 -287
- package/dist/rslang/eval/evaluation-cache.js.map +1 -1
- package/dist/rslang/eval/evaluator.d.ts +59 -63
- package/dist/rslang/eval/evaluator.js +602 -1509
- package/dist/rslang/eval/evaluator.js.map +1 -1
- package/dist/rslang/eval/value-api.d.ts +2 -48
- package/dist/rslang/eval/value-api.js +2 -490
- package/dist/rslang/eval/value.d.ts +2 -36
- package/dist/rslang/eval/value.js +2 -118
- package/dist/rslang/index.d.ts +14 -17
- package/dist/rslang/index.js +12 -4314
- package/dist/rslang/labels.d.ts +6 -6
- package/dist/rslang/labels.js +139 -305
- package/dist/rslang/labels.js.map +1 -1
- package/dist/rslang/parser/expression-generator.d.ts +5 -5
- package/dist/rslang/parser/expression-generator.js +248 -446
- package/dist/rslang/parser/expression-generator.js.map +1 -1
- package/dist/rslang/parser/normalize.d.ts +4 -8
- package/dist/rslang/parser/normalize.js +286 -481
- package/dist/rslang/parser/normalize.js.map +1 -1
- package/dist/rslang/parser/parser.d.ts +2 -5
- package/dist/rslang/parser/parser.js +30 -21
- package/dist/rslang/parser/parser.js.map +1 -1
- package/dist/rslang/parser/parser.terms.d.ts +43 -41
- package/dist/rslang/parser/parser.terms.js +44 -83
- package/dist/rslang/parser/parser.terms.js.map +1 -1
- package/dist/rslang/parser/syntax-errors.d.ts +5 -8
- package/dist/rslang/parser/syntax-errors.js +113 -382
- package/dist/rslang/parser/syntax-errors.js.map +1 -1
- package/dist/rslang/parser/token.d.ts +2 -79
- package/dist/rslang/parser/token.js +81 -93
- package/dist/rslang/parser/token.js.map +1 -1
- package/dist/rslang/semantic/analyzer.d.ts +2 -39
- package/dist/rslang/semantic/analyzer.js +186 -2600
- package/dist/rslang/semantic/analyzer.js.map +1 -1
- package/dist/rslang/semantic/arguments-extractor.d.ts +2 -42
- package/dist/rslang/semantic/arguments-extractor.js +202 -361
- package/dist/rslang/semantic/arguments-extractor.js.map +1 -1
- package/dist/rslang/semantic/type-auditor.d.ts +64 -68
- package/dist/rslang/semantic/type-auditor.js +594 -1564
- package/dist/rslang/semantic/type-auditor.js.map +1 -1
- package/dist/rslang/semantic/typification-api.d.ts +4 -7
- package/dist/rslang/semantic/typification-api.js +162 -303
- package/dist/rslang/semantic/typification-api.js.map +1 -1
- package/dist/rslang/semantic/typification-parser.d.ts +2 -12
- package/dist/rslang/semantic/typification-parser.js +165 -219
- package/dist/rslang/semantic/typification-parser.js.map +1 -1
- package/dist/rslang/semantic/typification.d.ts +2 -119
- package/dist/rslang/semantic/typification.js +66 -52
- package/dist/rslang/semantic/typification.js.map +1 -1
- package/dist/rslang/semantic/value-auditor.d.ts +32 -38
- package/dist/rslang/semantic/value-auditor.js +206 -518
- package/dist/rslang/semantic/value-auditor.js.map +1 -1
- package/dist/rslang/semantic/value-class.d.ts +2 -10
- package/dist/rslang/semantic/value-class.js +8 -7
- package/dist/rslang/semantic/value-class.js.map +1 -1
- package/dist/rslang/typification-graph.d.ts +2 -33
- package/dist/rslang/typification-graph.js +94 -306
- package/dist/rslang/typification-graph.js.map +1 -1
- package/dist/shared/branded.d.ts +2 -7
- package/dist/shared/branded.js +1 -1
- package/dist/shared/hash.d.ts +2 -6
- package/dist/shared/hash.js +13 -13
- package/dist/shared/hash.js.map +1 -1
- package/dist/shared/index.d.ts +3 -2
- package/dist/shared/index.js +2 -18
- package/dist/token-DeXAmzwr.d.ts +81 -0
- package/dist/typification-Dk-fisgO.d.ts +120 -0
- package/dist/typification-graph-6HcZ-rKH.d.ts +30 -0
- package/dist/typification-parser-BBVx1RxP.d.ts +13 -0
- package/dist/value-B8UtCqaK.js +366 -0
- package/dist/value-B8UtCqaK.js.map +1 -0
- package/dist/value-CTjX6825.d.ts +33 -0
- package/dist/value-api-Bw-SgaYY.d.ts +49 -0
- package/dist/value-class-CNI-lqXJ.d.ts +12 -0
- package/package.json +8 -8
- package/src/library/rsform-api.test.ts +24 -0
- package/src/library/rsform-api.ts +12 -4
- package/dist/cctext/index.js.map +0 -1
- package/dist/graph/index.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/library/index.js.map +0 -1
- package/dist/library/oss-layout.js.map +0 -1
- package/dist/parsing/index.js.map +0 -1
- package/dist/rslang/eval/value-api.js.map +0 -1
- package/dist/rslang/eval/value.js.map +0 -1
- package/dist/rslang/index.js.map +0 -1
- package/dist/shared/branded.js.map +0 -1
- package/dist/shared/index.js.map +0 -1
|
@@ -1,74 +1,88 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
//#region src/rslang/semantic/typification.ts
|
|
2
|
+
/** Typification structure enumeration. */
|
|
3
|
+
const TypeID = {
|
|
4
|
+
anyTypification: 1,
|
|
5
|
+
integer: 2,
|
|
6
|
+
basic: 3,
|
|
7
|
+
tuple: 4,
|
|
8
|
+
collection: 5,
|
|
9
|
+
logic: 6,
|
|
10
|
+
function: 7,
|
|
11
|
+
predicate: 8
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/** Represents type class. */
|
|
14
|
+
const TypeClass = {
|
|
15
|
+
logic: 1,
|
|
16
|
+
typification: 2,
|
|
17
|
+
function: 3,
|
|
18
|
+
predicate: 4
|
|
17
19
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
/** Logic type object. */
|
|
21
|
+
const LogicT = { typeID: TypeID.logic };
|
|
22
|
+
/** Integer type object. */
|
|
23
|
+
const IntegerT = {
|
|
24
|
+
typeID: TypeID.integer,
|
|
25
|
+
isOrdered: true,
|
|
26
|
+
isArithmetic: true,
|
|
27
|
+
isIntegerCompatible: true
|
|
24
28
|
};
|
|
29
|
+
/** Creates type path. */
|
|
25
30
|
function makeTypePath(path) {
|
|
26
|
-
|
|
31
|
+
return path;
|
|
27
32
|
}
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
/** AnyTyped type object. */
|
|
34
|
+
const AnyTypificationT = { typeID: TypeID.anyTypification };
|
|
35
|
+
/** Empty set typification. */
|
|
36
|
+
const EmptySetT = bool(AnyTypificationT);
|
|
37
|
+
/** Create basic element typification. */
|
|
30
38
|
function basic(alias) {
|
|
31
|
-
|
|
39
|
+
return {
|
|
40
|
+
typeID: TypeID.basic,
|
|
41
|
+
baseID: alias
|
|
42
|
+
};
|
|
32
43
|
}
|
|
44
|
+
/** Create constant element typification. */
|
|
33
45
|
function constant(alias) {
|
|
34
|
-
|
|
46
|
+
return {
|
|
47
|
+
typeID: TypeID.basic,
|
|
48
|
+
baseID: alias,
|
|
49
|
+
isOrdered: true,
|
|
50
|
+
isArithmetic: true,
|
|
51
|
+
isIntegerCompatible: true
|
|
52
|
+
};
|
|
35
53
|
}
|
|
54
|
+
/** Create boolean typification. */
|
|
36
55
|
function bool(base) {
|
|
37
|
-
|
|
56
|
+
return {
|
|
57
|
+
typeID: TypeID.collection,
|
|
58
|
+
base
|
|
59
|
+
};
|
|
38
60
|
}
|
|
61
|
+
/** Create tuple typification. */
|
|
39
62
|
function tuple(factors) {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
63
|
+
if (factors.length < 2) throw new Error("Tuple with less than two factors is not allowed");
|
|
64
|
+
return {
|
|
65
|
+
typeID: TypeID.tuple,
|
|
66
|
+
factors
|
|
67
|
+
};
|
|
44
68
|
}
|
|
69
|
+
/** Remove boolean from typification. */
|
|
45
70
|
function debool(target) {
|
|
46
|
-
|
|
71
|
+
return target.base;
|
|
47
72
|
}
|
|
73
|
+
/** Extract component from tuple. */
|
|
48
74
|
function component(target, index) {
|
|
49
|
-
|
|
75
|
+
return target.factors[index - 1] ?? null;
|
|
50
76
|
}
|
|
77
|
+
/** Checks if given type is typification. */
|
|
51
78
|
function isTypification(type) {
|
|
52
|
-
|
|
79
|
+
return type?.typeID === TypeID.basic || type?.typeID === TypeID.anyTypification || type?.typeID === TypeID.integer || type?.typeID === TypeID.collection || type?.typeID === TypeID.tuple;
|
|
53
80
|
}
|
|
81
|
+
/** Checks if given type is radical. */
|
|
54
82
|
function isRadical(alias) {
|
|
55
|
-
|
|
83
|
+
return alias.length > 0 && alias.startsWith("R") && alias[1] !== "0";
|
|
56
84
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
IntegerT,
|
|
61
|
-
LogicT,
|
|
62
|
-
TypeClass,
|
|
63
|
-
TypeID,
|
|
64
|
-
basic,
|
|
65
|
-
bool,
|
|
66
|
-
component,
|
|
67
|
-
constant,
|
|
68
|
-
debool,
|
|
69
|
-
isRadical,
|
|
70
|
-
isTypification,
|
|
71
|
-
makeTypePath,
|
|
72
|
-
tuple
|
|
73
|
-
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { AnyTypificationT, EmptySetT, IntegerT, LogicT, TypeClass, TypeID, basic, bool, component, constant, debool, isRadical, isTypification, makeTypePath, tuple };
|
|
87
|
+
|
|
74
88
|
//# sourceMappingURL=typification.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/rslang/semantic/typification.ts"],"sourcesContent":["/*\n * Module: Typification for RSLang.\n */\n\nimport { type Branded } from '../../shared';\n\n/** Typification structure enumeration. */\nexport const TypeID = {\n anyTypification: 1,\n integer: 2,\n basic: 3,\n tuple: 4,\n collection: 5,\n logic: 6,\n function: 7,\n predicate: 8\n} as const;\nexport type TypeID = (typeof TypeID)[keyof typeof TypeID];\n\n/** Represents type class. */\nexport const TypeClass = {\n logic: 1,\n typification: 2,\n function: 3,\n predicate: 4\n} as const;\nexport type TypeClass = (typeof TypeClass)[keyof typeof TypeClass];\n\n/** Logic type object. */\nexport const LogicT = { typeID: TypeID.logic } as const;\n\n/** Integer type object. */\nexport const IntegerT = {\n typeID: TypeID.integer,\n isOrdered: true,\n isArithmetic: true,\n isIntegerCompatible: true\n} as const;\n\n/** Type transformation path. */\nexport type TypePath = Branded<number[], 'TypePath'>;\n\n/** Creates type path. */\nexport function makeTypePath(path: number[]): TypePath {\n return path as TypePath;\n}\n\n/** AnyTyped type object. */\nexport const AnyTypificationT = { typeID: TypeID.anyTypification } as const;\n\n/** Empty set typification. */\nexport const EmptySetT = bool(AnyTypificationT);\n\n/** Parametrized typification. */\nexport type Parametrized = EchelonFunctional | EchelonPredicate;\n\n/** General expression types. */\nexport type ExpressionType =\n | EchelonLogic\n | EchelonBase\n | EchelonTuple\n | EchelonCollection\n | EchelonFunctional\n | EchelonPredicate\n | EchelonAnyTyped\n | EchelonInteger;\n\n/** Setexpr type. */\nexport type Typification = EchelonBase | EchelonAnyTyped | EchelonInteger | EchelonCollection | EchelonTuple;\n\n/** Typification context. */\nexport type TypeContext = Map<string, ExpressionType>;\n\n/** Functional argument. */\nexport interface Argument {\n readonly alias: string;\n readonly type: Typification;\n}\n\n/** Type: Logic. */\nexport interface EchelonLogic {\n readonly typeID: typeof TypeID.logic;\n}\n\n/** Type: AnyTyped. */\nexport interface EchelonAnyTyped {\n readonly typeID: typeof TypeID.anyTypification;\n}\n\n/** Type: Integer. */\nexport interface EchelonInteger {\n readonly typeID: typeof TypeID.integer;\n readonly isOrdered: true;\n readonly isArithmetic: true;\n readonly isIntegerCompatible: true;\n}\n\n/** Type: Element of basic set. */\nexport interface EchelonBase {\n readonly typeID: typeof TypeID.basic;\n readonly baseID: string;\n readonly isOrdered?: boolean;\n readonly isArithmetic?: boolean;\n readonly isIntegerCompatible?: boolean;\n}\n\n/** Type: Tuple. */\nexport interface EchelonTuple {\n readonly typeID: typeof TypeID.tuple;\n readonly factors: readonly Typification[];\n}\n\n/** Type: Collection. */\nexport interface EchelonCollection {\n readonly typeID: typeof TypeID.collection;\n readonly base: Typification;\n}\n\n/** Type: Functional. */\nexport interface EchelonFunctional {\n readonly typeID: typeof TypeID.function;\n readonly result: Typification;\n readonly args: readonly Argument[];\n}\n\n/** Type: Predicate. */\nexport interface EchelonPredicate {\n readonly typeID: typeof TypeID.predicate;\n readonly result: EchelonLogic;\n readonly args: readonly Argument[];\n}\n\n/** Create basic element typification. */\nexport function basic(alias: string): EchelonBase {\n return { typeID: TypeID.basic, baseID: alias };\n}\n\n/** Create constant element typification. */\nexport function constant(alias: string): EchelonBase {\n return { typeID: TypeID.basic, baseID: alias, isOrdered: true, isArithmetic: true, isIntegerCompatible: true };\n}\n\n/** Create boolean typification. */\nexport function bool(base: Typification): EchelonCollection {\n return { typeID: TypeID.collection, base };\n}\n\n/** Create tuple typification. */\nexport function tuple(factors: Typification[]): EchelonTuple {\n if (factors.length < 2) {\n throw new Error('Tuple with less than two factors is not allowed');\n }\n return { typeID: TypeID.tuple, factors };\n}\n\n/** Remove boolean from typification. */\nexport function debool(target: EchelonCollection): Typification {\n return target.base;\n}\n\n/** Extract component from tuple. */\nexport function component(target: EchelonTuple, index: number): Typification | null {\n return target.factors[index - 1] ?? null;\n}\n\n/** Checks if given type is typification. */\nexport function isTypification(type: ExpressionType | null): boolean {\n return (\n type?.typeID === TypeID.basic ||\n type?.typeID === TypeID.anyTypification ||\n type?.typeID === TypeID.integer ||\n type?.typeID === TypeID.collection ||\n type?.typeID === TypeID.tuple\n );\n}\n\n/** Checks if given type is radical. */\nexport function isRadical(alias: string): boolean {\n return alias.length > 0 && alias.startsWith('R') && alias[1] !== '0';\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"typification.js","names":[],"sources":["../../../src/rslang/semantic/typification.ts"],"sourcesContent":["/*\n * Module: Typification for RSLang.\n */\n\nimport { type Branded } from '../../shared';\n\n/** Typification structure enumeration. */\nexport const TypeID = {\n anyTypification: 1,\n integer: 2,\n basic: 3,\n tuple: 4,\n collection: 5,\n logic: 6,\n function: 7,\n predicate: 8\n} as const;\nexport type TypeID = (typeof TypeID)[keyof typeof TypeID];\n\n/** Represents type class. */\nexport const TypeClass = {\n logic: 1,\n typification: 2,\n function: 3,\n predicate: 4\n} as const;\nexport type TypeClass = (typeof TypeClass)[keyof typeof TypeClass];\n\n/** Logic type object. */\nexport const LogicT = { typeID: TypeID.logic } as const;\n\n/** Integer type object. */\nexport const IntegerT = {\n typeID: TypeID.integer,\n isOrdered: true,\n isArithmetic: true,\n isIntegerCompatible: true\n} as const;\n\n/** Type transformation path. */\nexport type TypePath = Branded<number[], 'TypePath'>;\n\n/** Creates type path. */\nexport function makeTypePath(path: number[]): TypePath {\n return path as TypePath;\n}\n\n/** AnyTyped type object. */\nexport const AnyTypificationT = { typeID: TypeID.anyTypification } as const;\n\n/** Empty set typification. */\nexport const EmptySetT = bool(AnyTypificationT);\n\n/** Parametrized typification. */\nexport type Parametrized = EchelonFunctional | EchelonPredicate;\n\n/** General expression types. */\nexport type ExpressionType =\n | EchelonLogic\n | EchelonBase\n | EchelonTuple\n | EchelonCollection\n | EchelonFunctional\n | EchelonPredicate\n | EchelonAnyTyped\n | EchelonInteger;\n\n/** Setexpr type. */\nexport type Typification = EchelonBase | EchelonAnyTyped | EchelonInteger | EchelonCollection | EchelonTuple;\n\n/** Typification context. */\nexport type TypeContext = Map<string, ExpressionType>;\n\n/** Functional argument. */\nexport interface Argument {\n readonly alias: string;\n readonly type: Typification;\n}\n\n/** Type: Logic. */\nexport interface EchelonLogic {\n readonly typeID: typeof TypeID.logic;\n}\n\n/** Type: AnyTyped. */\nexport interface EchelonAnyTyped {\n readonly typeID: typeof TypeID.anyTypification;\n}\n\n/** Type: Integer. */\nexport interface EchelonInteger {\n readonly typeID: typeof TypeID.integer;\n readonly isOrdered: true;\n readonly isArithmetic: true;\n readonly isIntegerCompatible: true;\n}\n\n/** Type: Element of basic set. */\nexport interface EchelonBase {\n readonly typeID: typeof TypeID.basic;\n readonly baseID: string;\n readonly isOrdered?: boolean;\n readonly isArithmetic?: boolean;\n readonly isIntegerCompatible?: boolean;\n}\n\n/** Type: Tuple. */\nexport interface EchelonTuple {\n readonly typeID: typeof TypeID.tuple;\n readonly factors: readonly Typification[];\n}\n\n/** Type: Collection. */\nexport interface EchelonCollection {\n readonly typeID: typeof TypeID.collection;\n readonly base: Typification;\n}\n\n/** Type: Functional. */\nexport interface EchelonFunctional {\n readonly typeID: typeof TypeID.function;\n readonly result: Typification;\n readonly args: readonly Argument[];\n}\n\n/** Type: Predicate. */\nexport interface EchelonPredicate {\n readonly typeID: typeof TypeID.predicate;\n readonly result: EchelonLogic;\n readonly args: readonly Argument[];\n}\n\n/** Create basic element typification. */\nexport function basic(alias: string): EchelonBase {\n return { typeID: TypeID.basic, baseID: alias };\n}\n\n/** Create constant element typification. */\nexport function constant(alias: string): EchelonBase {\n return { typeID: TypeID.basic, baseID: alias, isOrdered: true, isArithmetic: true, isIntegerCompatible: true };\n}\n\n/** Create boolean typification. */\nexport function bool(base: Typification): EchelonCollection {\n return { typeID: TypeID.collection, base };\n}\n\n/** Create tuple typification. */\nexport function tuple(factors: Typification[]): EchelonTuple {\n if (factors.length < 2) {\n throw new Error('Tuple with less than two factors is not allowed');\n }\n return { typeID: TypeID.tuple, factors };\n}\n\n/** Remove boolean from typification. */\nexport function debool(target: EchelonCollection): Typification {\n return target.base;\n}\n\n/** Extract component from tuple. */\nexport function component(target: EchelonTuple, index: number): Typification | null {\n return target.factors[index - 1] ?? null;\n}\n\n/** Checks if given type is typification. */\nexport function isTypification(type: ExpressionType | null): boolean {\n return (\n type?.typeID === TypeID.basic ||\n type?.typeID === TypeID.anyTypification ||\n type?.typeID === TypeID.integer ||\n type?.typeID === TypeID.collection ||\n type?.typeID === TypeID.tuple\n );\n}\n\n/** Checks if given type is radical. */\nexport function isRadical(alias: string): boolean {\n return alias.length > 0 && alias.startsWith('R') && alias[1] !== '0';\n}\n"],"mappings":";;AAOA,MAAa,SAAS;CACpB,iBAAiB;CACjB,SAAS;CACT,OAAO;CACP,OAAO;CACP,YAAY;CACZ,OAAO;CACP,UAAU;CACV,WAAW;AACb;;AAIA,MAAa,YAAY;CACvB,OAAO;CACP,cAAc;CACd,UAAU;CACV,WAAW;AACb;;AAIA,MAAa,SAAS,EAAE,QAAQ,OAAO,MAAM;;AAG7C,MAAa,WAAW;CACtB,QAAQ,OAAO;CACf,WAAW;CACX,cAAc;CACd,qBAAqB;AACvB;;AAMA,SAAgB,aAAa,MAA0B;CACrD,OAAO;AACT;;AAGA,MAAa,mBAAmB,EAAE,QAAQ,OAAO,gBAAgB;;AAGjE,MAAa,YAAY,KAAK,gBAAgB;;AAkF9C,SAAgB,MAAM,OAA4B;CAChD,OAAO;EAAE,QAAQ,OAAO;EAAO,QAAQ;CAAM;AAC/C;;AAGA,SAAgB,SAAS,OAA4B;CACnD,OAAO;EAAE,QAAQ,OAAO;EAAO,QAAQ;EAAO,WAAW;EAAM,cAAc;EAAM,qBAAqB;CAAK;AAC/G;;AAGA,SAAgB,KAAK,MAAuC;CAC1D,OAAO;EAAE,QAAQ,OAAO;EAAY;CAAK;AAC3C;;AAGA,SAAgB,MAAM,SAAuC;CAC3D,IAAI,QAAQ,SAAS,GACnB,MAAM,IAAI,MAAM,iDAAiD;CAEnE,OAAO;EAAE,QAAQ,OAAO;EAAO;CAAQ;AACzC;;AAGA,SAAgB,OAAO,QAAyC;CAC9D,OAAO,OAAO;AAChB;;AAGA,SAAgB,UAAU,QAAsB,OAAoC;CAClF,OAAO,OAAO,QAAQ,QAAQ,MAAM;AACtC;;AAGA,SAAgB,eAAe,MAAsC;CACnE,OACE,MAAM,WAAW,OAAO,SACxB,MAAM,WAAW,OAAO,mBACxB,MAAM,WAAW,OAAO,WACxB,MAAM,WAAW,OAAO,cACxB,MAAM,WAAW,OAAO;AAE5B;;AAGA,SAAgB,UAAU,OAAwB;CAChD,OAAO,MAAM,SAAS,KAAK,MAAM,WAAW,GAAG,KAAK,MAAM,OAAO;AACnE"}
|
|
@@ -1,43 +1,37 @@
|
|
|
1
|
-
import { AstNode } from
|
|
2
|
-
import { ErrorReporter } from
|
|
3
|
-
import { ValueClassContext, ValueClass } from
|
|
4
|
-
import '@lezer/common';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Module: Value auditor for AST value class checking.
|
|
8
|
-
*
|
|
9
|
-
* Determines whether an expression yields a concrete value (computable)
|
|
10
|
-
* or a property (e.g., depends on a quantified variable).
|
|
11
|
-
*/
|
|
1
|
+
import { t as AstNode } from "../../ast-C8sIpKdL.js";
|
|
2
|
+
import { t as ErrorReporter } from "../../error-E1LVq_3w.js";
|
|
3
|
+
import { n as ValueClassContext, t as ValueClass } from "../../value-class-CNI-lqXJ.js";
|
|
12
4
|
|
|
5
|
+
//#region src/rslang/semantic/value-auditor.d.ts
|
|
13
6
|
/** Value auditor for AST value class checking. */
|
|
14
7
|
declare class ValueAuditor {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
8
|
+
private context;
|
|
9
|
+
private annotateErrors;
|
|
10
|
+
private reporter?;
|
|
11
|
+
constructor(context: ValueClassContext);
|
|
12
|
+
/**
|
|
13
|
+
* Runs value audit on the AST. Returns the value class on success, null on failure.
|
|
14
|
+
*/
|
|
15
|
+
run(ast: AstNode, reporter?: ErrorReporter, annotateErrors?: boolean): ValueClass | null;
|
|
16
|
+
private dispatchVisit;
|
|
17
|
+
private onError;
|
|
18
|
+
private visitChild;
|
|
19
|
+
private visitAllAndReturn;
|
|
20
|
+
private assertChildIsValue;
|
|
21
|
+
private assertAllValues;
|
|
22
|
+
private visitFunctionDefinition;
|
|
23
|
+
private visitFunctionCall;
|
|
24
|
+
private visitGlobal;
|
|
25
|
+
private visitQuantifier;
|
|
26
|
+
private visitSetexprPredicate;
|
|
27
|
+
private visitDeclarative;
|
|
28
|
+
private visitImperative;
|
|
29
|
+
private visitIterateOrAssign;
|
|
30
|
+
private visitDecart;
|
|
31
|
+
private visitBoolean;
|
|
32
|
+
private visitFilter;
|
|
33
|
+
private visitSetexprBinary;
|
|
41
34
|
}
|
|
42
|
-
|
|
35
|
+
//#endregion
|
|
43
36
|
export { ValueAuditor };
|
|
37
|
+
//# sourceMappingURL=value-auditor.d.ts.map
|