@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.
Files changed (183) hide show
  1. package/README.md +3 -3
  2. package/dist/analyzer-DlSq3Y3r.d.ts +39 -0
  3. package/dist/arguments-extractor-1acwjQNc.d.ts +38 -0
  4. package/dist/ast-C8sIpKdL.d.ts +51 -0
  5. package/dist/ast-annotations-BiMjkKvz.d.ts +16 -0
  6. package/dist/branded-ZlzIcxzu.d.ts +9 -0
  7. package/dist/calculator-C9W2jkSx.d.ts +39 -0
  8. package/dist/cctext/index.d.ts +2 -1
  9. package/dist/cctext/index.js +2 -42
  10. package/dist/cctext/language-api.d.ts +10 -12
  11. package/dist/cctext/language-api.js +157 -227
  12. package/dist/cctext/language-api.js.map +1 -1
  13. package/dist/cctext/language.d.ts +24 -22
  14. package/dist/cctext/language.js +43 -39
  15. package/dist/cctext/language.js.map +1 -1
  16. package/dist/error-E1LVq_3w.d.ts +87 -0
  17. package/dist/graph/graph.d.ts +2 -62
  18. package/dist/graph/graph.js +339 -382
  19. package/dist/graph/graph.js.map +1 -1
  20. package/dist/graph/index.d.ts +2 -1
  21. package/dist/graph/index.js +2 -384
  22. package/dist/graph-DR8rL2o3.d.ts +64 -0
  23. package/dist/hash-Y8I4c6Al.d.ts +8 -0
  24. package/dist/index-BKZ67WMa.d.ts +1 -0
  25. package/dist/index-BVVgDSdq.d.ts +1 -0
  26. package/dist/index-DmtQKWjk.d.ts +1 -0
  27. package/dist/index-_6s0AX1B.d.ts +1 -0
  28. package/dist/index.d.ts +27 -28
  29. package/dist/index.js +23 -5851
  30. package/dist/lezer-tree-iS7LpLBJ.d.ts +14 -0
  31. package/dist/library/folder-tree.d.ts +22 -20
  32. package/dist/library/folder-tree.js +108 -130
  33. package/dist/library/folder-tree.js.map +1 -1
  34. package/dist/library/index.d.ts +8 -17
  35. package/dist/library/index.js +7 -2800
  36. package/dist/library/library-api.d.ts +3 -1
  37. package/dist/library/library-api.js +9 -8
  38. package/dist/library/library-api.js.map +1 -1
  39. package/dist/library/library.d.ts +2 -56
  40. package/dist/library/library.js +23 -19
  41. package/dist/library/library.js.map +1 -1
  42. package/dist/library/oss-api.d.ts +26 -37
  43. package/dist/library/oss-api.js +257 -1096
  44. package/dist/library/oss-api.js.map +1 -1
  45. package/dist/library/oss-layout-api.d.ts +28 -28
  46. package/dist/library/oss-layout-api.js +239 -316
  47. package/dist/library/oss-layout-api.js.map +1 -1
  48. package/dist/library/oss-layout.d.ts +2 -25
  49. package/dist/library/oss-layout.js +1 -1
  50. package/dist/library/oss.d.ts +87 -89
  51. package/dist/library/oss.js +27 -26
  52. package/dist/library/oss.js.map +1 -1
  53. package/dist/library/rsengine.d.ts +100 -106
  54. package/dist/library/rsengine.js +439 -2599
  55. package/dist/library/rsengine.js.map +1 -1
  56. package/dist/library/rsform-api.d.ts +11 -16
  57. package/dist/library/rsform-api.js +313 -825
  58. package/dist/library/rsform-api.js.map +1 -1
  59. package/dist/library/rsform.d.ts +159 -167
  60. package/dist/library/rsform.js +29 -28
  61. package/dist/library/rsform.js.map +1 -1
  62. package/dist/library/rsmodel-api.d.ts +8 -15
  63. package/dist/library/rsmodel-api.js +172 -813
  64. package/dist/library/rsmodel-api.js.map +1 -1
  65. package/dist/library/rsmodel.d.ts +27 -33
  66. package/dist/library/rsmodel.js +16 -23
  67. package/dist/library/rsmodel.js.map +1 -1
  68. package/dist/library/structure-planner.d.ts +20 -26
  69. package/dist/library/structure-planner.js +106 -474
  70. package/dist/library/structure-planner.js.map +1 -1
  71. package/dist/library-CYun28Xz.d.ts +58 -0
  72. package/dist/oss-layout-3glgAqfn.d.ts +27 -0
  73. package/dist/parser-Bwd8LxJ1.d.ts +7 -0
  74. package/dist/parsing/ast.d.ts +2 -49
  75. package/dist/parsing/ast.js +68 -76
  76. package/dist/parsing/ast.js.map +1 -1
  77. package/dist/parsing/index.d.ts +3 -3
  78. package/dist/parsing/index.js +3 -141
  79. package/dist/parsing/lezer-tree.d.ts +2 -13
  80. package/dist/parsing/lezer-tree.js +50 -43
  81. package/dist/parsing/lezer-tree.js.map +1 -1
  82. package/dist/rslang/api.d.ts +9 -14
  83. package/dist/rslang/api.js +114 -827
  84. package/dist/rslang/api.js.map +1 -1
  85. package/dist/rslang/ast-annotations.d.ts +2 -18
  86. package/dist/rslang/ast-annotations.js +34 -45
  87. package/dist/rslang/ast-annotations.js.map +1 -1
  88. package/dist/rslang/error.d.ts +2 -85
  89. package/dist/rslang/error.js +88 -150
  90. package/dist/rslang/error.js.map +1 -1
  91. package/dist/rslang/eval/calculator.d.ts +2 -43
  92. package/dist/rslang/eval/calculator.js +81 -1636
  93. package/dist/rslang/eval/calculator.js.map +1 -1
  94. package/dist/rslang/eval/evaluation-cache.d.ts +22 -26
  95. package/dist/rslang/eval/evaluation-cache.js +168 -287
  96. package/dist/rslang/eval/evaluation-cache.js.map +1 -1
  97. package/dist/rslang/eval/evaluator.d.ts +59 -63
  98. package/dist/rslang/eval/evaluator.js +602 -1509
  99. package/dist/rslang/eval/evaluator.js.map +1 -1
  100. package/dist/rslang/eval/value-api.d.ts +2 -48
  101. package/dist/rslang/eval/value-api.js +2 -490
  102. package/dist/rslang/eval/value.d.ts +2 -36
  103. package/dist/rslang/eval/value.js +2 -118
  104. package/dist/rslang/index.d.ts +14 -17
  105. package/dist/rslang/index.js +12 -4314
  106. package/dist/rslang/labels.d.ts +6 -6
  107. package/dist/rslang/labels.js +139 -305
  108. package/dist/rslang/labels.js.map +1 -1
  109. package/dist/rslang/parser/expression-generator.d.ts +5 -5
  110. package/dist/rslang/parser/expression-generator.js +248 -446
  111. package/dist/rslang/parser/expression-generator.js.map +1 -1
  112. package/dist/rslang/parser/normalize.d.ts +4 -8
  113. package/dist/rslang/parser/normalize.js +286 -481
  114. package/dist/rslang/parser/normalize.js.map +1 -1
  115. package/dist/rslang/parser/parser.d.ts +2 -5
  116. package/dist/rslang/parser/parser.js +30 -21
  117. package/dist/rslang/parser/parser.js.map +1 -1
  118. package/dist/rslang/parser/parser.terms.d.ts +43 -41
  119. package/dist/rslang/parser/parser.terms.js +44 -83
  120. package/dist/rslang/parser/parser.terms.js.map +1 -1
  121. package/dist/rslang/parser/syntax-errors.d.ts +5 -8
  122. package/dist/rslang/parser/syntax-errors.js +113 -382
  123. package/dist/rslang/parser/syntax-errors.js.map +1 -1
  124. package/dist/rslang/parser/token.d.ts +2 -79
  125. package/dist/rslang/parser/token.js +81 -93
  126. package/dist/rslang/parser/token.js.map +1 -1
  127. package/dist/rslang/semantic/analyzer.d.ts +2 -39
  128. package/dist/rslang/semantic/analyzer.js +186 -2600
  129. package/dist/rslang/semantic/analyzer.js.map +1 -1
  130. package/dist/rslang/semantic/arguments-extractor.d.ts +2 -42
  131. package/dist/rslang/semantic/arguments-extractor.js +202 -361
  132. package/dist/rslang/semantic/arguments-extractor.js.map +1 -1
  133. package/dist/rslang/semantic/type-auditor.d.ts +64 -68
  134. package/dist/rslang/semantic/type-auditor.js +594 -1564
  135. package/dist/rslang/semantic/type-auditor.js.map +1 -1
  136. package/dist/rslang/semantic/typification-api.d.ts +4 -7
  137. package/dist/rslang/semantic/typification-api.js +162 -303
  138. package/dist/rslang/semantic/typification-api.js.map +1 -1
  139. package/dist/rslang/semantic/typification-parser.d.ts +2 -12
  140. package/dist/rslang/semantic/typification-parser.js +165 -219
  141. package/dist/rslang/semantic/typification-parser.js.map +1 -1
  142. package/dist/rslang/semantic/typification.d.ts +2 -119
  143. package/dist/rslang/semantic/typification.js +66 -52
  144. package/dist/rslang/semantic/typification.js.map +1 -1
  145. package/dist/rslang/semantic/value-auditor.d.ts +32 -38
  146. package/dist/rslang/semantic/value-auditor.js +206 -518
  147. package/dist/rslang/semantic/value-auditor.js.map +1 -1
  148. package/dist/rslang/semantic/value-class.d.ts +2 -10
  149. package/dist/rslang/semantic/value-class.js +8 -7
  150. package/dist/rslang/semantic/value-class.js.map +1 -1
  151. package/dist/rslang/typification-graph.d.ts +2 -33
  152. package/dist/rslang/typification-graph.js +94 -306
  153. package/dist/rslang/typification-graph.js.map +1 -1
  154. package/dist/shared/branded.d.ts +2 -7
  155. package/dist/shared/branded.js +1 -1
  156. package/dist/shared/hash.d.ts +2 -6
  157. package/dist/shared/hash.js +13 -13
  158. package/dist/shared/hash.js.map +1 -1
  159. package/dist/shared/index.d.ts +3 -2
  160. package/dist/shared/index.js +2 -18
  161. package/dist/token-DeXAmzwr.d.ts +81 -0
  162. package/dist/typification-Dk-fisgO.d.ts +120 -0
  163. package/dist/typification-graph-6HcZ-rKH.d.ts +30 -0
  164. package/dist/typification-parser-BBVx1RxP.d.ts +13 -0
  165. package/dist/value-B8UtCqaK.js +366 -0
  166. package/dist/value-B8UtCqaK.js.map +1 -0
  167. package/dist/value-CTjX6825.d.ts +33 -0
  168. package/dist/value-api-Bw-SgaYY.d.ts +49 -0
  169. package/dist/value-class-CNI-lqXJ.d.ts +12 -0
  170. package/package.json +8 -8
  171. package/src/library/rsform-api.test.ts +24 -0
  172. package/src/library/rsform-api.ts +12 -4
  173. package/dist/cctext/index.js.map +0 -1
  174. package/dist/graph/index.js.map +0 -1
  175. package/dist/index.js.map +0 -1
  176. package/dist/library/index.js.map +0 -1
  177. package/dist/library/oss-layout.js.map +0 -1
  178. package/dist/parsing/index.js.map +0 -1
  179. package/dist/rslang/eval/value-api.js.map +0 -1
  180. package/dist/rslang/eval/value.js.map +0 -1
  181. package/dist/rslang/index.js.map +0 -1
  182. package/dist/shared/branded.js.map +0 -1
  183. package/dist/shared/index.js.map +0 -1
@@ -1,74 +1,88 @@
1
- // src/rslang/semantic/typification.ts
2
- var TypeID = {
3
- anyTypification: 1,
4
- integer: 2,
5
- basic: 3,
6
- tuple: 4,
7
- collection: 5,
8
- logic: 6,
9
- function: 7,
10
- predicate: 8
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
- var TypeClass = {
13
- logic: 1,
14
- typification: 2,
15
- function: 3,
16
- predicate: 4
13
+ /** Represents type class. */
14
+ const TypeClass = {
15
+ logic: 1,
16
+ typification: 2,
17
+ function: 3,
18
+ predicate: 4
17
19
  };
18
- var LogicT = { typeID: TypeID.logic };
19
- var IntegerT = {
20
- typeID: TypeID.integer,
21
- isOrdered: true,
22
- isArithmetic: true,
23
- isIntegerCompatible: true
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
- return path;
31
+ return path;
27
32
  }
28
- var AnyTypificationT = { typeID: TypeID.anyTypification };
29
- var EmptySetT = bool(AnyTypificationT);
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
- return { typeID: TypeID.basic, baseID: alias };
39
+ return {
40
+ typeID: TypeID.basic,
41
+ baseID: alias
42
+ };
32
43
  }
44
+ /** Create constant element typification. */
33
45
  function constant(alias) {
34
- return { typeID: TypeID.basic, baseID: alias, isOrdered: true, isArithmetic: true, isIntegerCompatible: true };
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
- return { typeID: TypeID.collection, base };
56
+ return {
57
+ typeID: TypeID.collection,
58
+ base
59
+ };
38
60
  }
61
+ /** Create tuple typification. */
39
62
  function tuple(factors) {
40
- if (factors.length < 2) {
41
- throw new Error("Tuple with less than two factors is not allowed");
42
- }
43
- return { typeID: TypeID.tuple, factors };
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
- return target.base;
71
+ return target.base;
47
72
  }
73
+ /** Extract component from tuple. */
48
74
  function component(target, index) {
49
- return target.factors[index - 1] ?? null;
75
+ return target.factors[index - 1] ?? null;
50
76
  }
77
+ /** Checks if given type is typification. */
51
78
  function isTypification(type) {
52
- return type?.typeID === TypeID.basic || type?.typeID === TypeID.anyTypification || type?.typeID === TypeID.integer || type?.typeID === TypeID.collection || type?.typeID === TypeID.tuple;
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
- return alias.length > 0 && alias.startsWith("R") && alias[1] !== "0";
83
+ return alias.length > 0 && alias.startsWith("R") && alias[1] !== "0";
56
84
  }
57
- export {
58
- AnyTypificationT,
59
- EmptySetT,
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":";AAOO,IAAM,SAAS;AAAA,EACpB,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AACb;AAIO,IAAM,YAAY;AAAA,EACvB,OAAO;AAAA,EACP,cAAc;AAAA,EACd,UAAU;AAAA,EACV,WAAW;AACb;AAIO,IAAM,SAAS,EAAE,QAAQ,OAAO,MAAM;AAGtC,IAAM,WAAW;AAAA,EACtB,QAAQ,OAAO;AAAA,EACf,WAAW;AAAA,EACX,cAAc;AAAA,EACd,qBAAqB;AACvB;AAMO,SAAS,aAAa,MAA0B;AACrD,SAAO;AACT;AAGO,IAAM,mBAAmB,EAAE,QAAQ,OAAO,gBAAgB;AAG1D,IAAM,YAAY,KAAK,gBAAgB;AAkFvC,SAAS,MAAM,OAA4B;AAChD,SAAO,EAAE,QAAQ,OAAO,OAAO,QAAQ,MAAM;AAC/C;AAGO,SAAS,SAAS,OAA4B;AACnD,SAAO,EAAE,QAAQ,OAAO,OAAO,QAAQ,OAAO,WAAW,MAAM,cAAc,MAAM,qBAAqB,KAAK;AAC/G;AAGO,SAAS,KAAK,MAAuC;AAC1D,SAAO,EAAE,QAAQ,OAAO,YAAY,KAAK;AAC3C;AAGO,SAAS,MAAM,SAAuC;AAC3D,MAAI,QAAQ,SAAS,GAAG;AACtB,UAAM,IAAI,MAAM,iDAAiD;AAAA,EACnE;AACA,SAAO,EAAE,QAAQ,OAAO,OAAO,QAAQ;AACzC;AAGO,SAAS,OAAO,QAAyC;AAC9D,SAAO,OAAO;AAChB;AAGO,SAAS,UAAU,QAAsB,OAAoC;AAClF,SAAO,OAAO,QAAQ,QAAQ,CAAC,KAAK;AACtC;AAGO,SAAS,eAAe,MAAsC;AACnE,SACE,MAAM,WAAW,OAAO,SACxB,MAAM,WAAW,OAAO,mBACxB,MAAM,WAAW,OAAO,WACxB,MAAM,WAAW,OAAO,cACxB,MAAM,WAAW,OAAO;AAE5B;AAGO,SAAS,UAAU,OAAwB;AAChD,SAAO,MAAM,SAAS,KAAK,MAAM,WAAW,GAAG,KAAK,MAAM,CAAC,MAAM;AACnE;","names":[]}
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 '../../parsing/ast.js';
2
- import { ErrorReporter } from '../error.js';
3
- import { ValueClassContext, ValueClass } from './value-class.js';
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
- private context;
16
- private annotateErrors;
17
- private reporter?;
18
- constructor(context: ValueClassContext);
19
- /**
20
- * Runs value audit on the AST. Returns the value class on success, null on failure.
21
- */
22
- run(ast: AstNode, reporter?: ErrorReporter, annotateErrors?: boolean): ValueClass | null;
23
- private dispatchVisit;
24
- private onError;
25
- private visitChild;
26
- private visitAllAndReturn;
27
- private assertChildIsValue;
28
- private assertAllValues;
29
- private visitFunctionDefinition;
30
- private visitFunctionCall;
31
- private visitGlobal;
32
- private visitQuantifier;
33
- private visitSetexprPredicate;
34
- private visitDeclarative;
35
- private visitImperative;
36
- private visitIterateOrAssign;
37
- private visitDecart;
38
- private visitBoolean;
39
- private visitFilter;
40
- private visitSetexprBinary;
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