@rsconcept/domain 2.1.2 → 2.3.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/dist/api-Bf0f_uiI.d.ts +57 -0
- package/dist/diagnostics-CljEzVBV.js +1245 -0
- package/dist/diagnostics-CljEzVBV.js.map +1 -0
- package/dist/{diagnostics-EaIt3zIw.d.ts → diagnostics-Dac5sJhO.d.ts} +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/library/diagnostics.d.ts +1 -1
- package/dist/library/diagnostics.js +1 -1
- package/dist/library/index.d.ts +2 -2
- package/dist/library/index.js +1 -1
- package/dist/library/oss-api.d.ts +1 -1
- package/dist/library/oss-api.js +4 -4
- package/dist/library/oss-api.js.map +1 -1
- package/dist/library/rsengine.d.ts +1 -1
- package/dist/library/rsengine.js +2 -2
- package/dist/library/rsform-api/index.d.ts +299 -0
- package/dist/library/rsform-api/index.js +2 -0
- package/dist/library/rsform.d.ts +2 -2
- package/dist/library/rsform.js.map +1 -1
- package/dist/library/rsmodel-api.d.ts +1 -1
- package/dist/library/rsmodel-api.js +4 -2
- package/dist/library/rsmodel-api.js.map +1 -1
- package/dist/library/rsmodel.d.ts +1 -1
- package/dist/library/structure-planner.d.ts +1 -1
- package/dist/library/structure-planner.js +2 -2
- package/dist/rslang/api.d.ts +2 -58
- package/dist/rslang/api.js +1 -1
- package/dist/rslang/index.js +1 -1
- package/dist/rslang/parser/syntax-errors/index.js +1 -1
- package/dist/rslang/semantic/analyzer.js +2 -2
- package/dist/{syntax-errors-DwPXhpVe.js → syntax-errors-BN_bqTaX.js} +2 -2
- package/dist/{syntax-errors-DwPXhpVe.js.map → syntax-errors-BN_bqTaX.js.map} +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/library/index.ts +1 -0
- package/src/library/oss-api.ts +5 -2
- package/src/library/rsform-api/alias.ts +160 -0
- package/src/library/rsform-api/analysis.ts +157 -0
- package/src/library/rsform-api/attribution.ts +87 -0
- package/src/library/rsform-api/cst-type.ts +216 -0
- package/src/library/rsform-api/expression.ts +73 -0
- package/src/library/rsform-api/formal-graph.test.ts +72 -0
- package/src/library/rsform-api/formal-graph.ts +195 -0
- package/src/library/rsform-api/index.ts +53 -0
- package/src/library/rsform-api/semantic-relations.ts +117 -0
- package/src/library/rsform-api/stats.ts +170 -0
- package/src/library/rsform-api/structure.ts +93 -0
- package/src/library/rsform-api/substitution.ts +82 -0
- package/src/library/rsform-api/synthesis.test.ts +126 -0
- package/src/library/rsform-api/synthesis.ts +166 -0
- package/src/library/rsform-api/text-resolution.test.ts +86 -0
- package/src/library/rsform-api/text-resolution.ts +152 -0
- package/src/library/rsform-api/transforms.test.ts +161 -0
- package/src/library/rsform-api/transforms.ts +42 -0
- package/src/library/rsform-api/types.ts +38 -0
- package/src/library/rsform.ts +3 -3
- package/src/library/rsmodel-api.ts +7 -1
- package/dist/diagnostics-CY9sKggB.js +0 -658
- package/dist/diagnostics-CY9sKggB.js.map +0 -1
- package/dist/library/rsform-api.d.ts +0 -103
- package/dist/library/rsform-api.js +0 -2
- package/src/library/rsform-api.ts +0 -755
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { t as Graph } from "../../graph-CL73WdW1.js";
|
|
2
|
+
import { t as AstNode } from "../../ast-C8sIpKdL.js";
|
|
3
|
+
import { g as TypeClass, y as TypePath } from "../../typification-9lNu9R4k.js";
|
|
4
|
+
import { t as ValueClass } from "../../value-class-CNI-lqXJ.js";
|
|
5
|
+
import { r as AnalysisFull } from "../../analyzer-fNhkwO-6.js";
|
|
6
|
+
import { r as LibraryItem } from "../../library-CYun28Xz.js";
|
|
7
|
+
import { C as RSFormStats, S as RSForm, T as TermForm, _ as Attribution, b as CstStatus, g as ArgumentValue, v as Constituenta, w as Substitution, x as CstType, y as CstClass } from "../../diagnostics-Dac5sJhO.js";
|
|
8
|
+
import { t as AliasMapping } from "../../api-Bf0f_uiI.js";
|
|
9
|
+
|
|
10
|
+
//#region src/library/rsform-api/types.d.ts
|
|
11
|
+
/** Minimal constituent fields required to restore order. */
|
|
12
|
+
interface OrderableConstituenta {
|
|
13
|
+
id: number;
|
|
14
|
+
alias: string;
|
|
15
|
+
cst_type: CstType;
|
|
16
|
+
definition_formal: string;
|
|
17
|
+
}
|
|
18
|
+
/** Semantic parent/children derived from formal definitions (backend SemanticInfo). */
|
|
19
|
+
interface SemanticRelations {
|
|
20
|
+
/** Parent id for each constituenta (self when none). */
|
|
21
|
+
parentOf: Map<number, number>;
|
|
22
|
+
/** Semantic children ids for each constituenta. */
|
|
23
|
+
childrenOf: Map<number, number[]>;
|
|
24
|
+
}
|
|
25
|
+
/** Constituent fields needed to resolve term/definition entity references. */
|
|
26
|
+
interface ResolvableConstituenta {
|
|
27
|
+
id: number;
|
|
28
|
+
alias: string;
|
|
29
|
+
term_raw: string;
|
|
30
|
+
term_resolved: string;
|
|
31
|
+
term_forms: TermForm[];
|
|
32
|
+
definition_raw: string;
|
|
33
|
+
definition_resolved: string;
|
|
34
|
+
}
|
|
35
|
+
/** Constituent fields needed to allocate or reset aliases by type. */
|
|
36
|
+
interface AliasTypedConstituenta {
|
|
37
|
+
alias: string;
|
|
38
|
+
cst_type: CstType;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region src/library/rsform-api/alias.d.ts
|
|
42
|
+
/** Fields of {@link Constituenta} updated in place by alias mapping. */
|
|
43
|
+
interface ConstituentaMappableFields {
|
|
44
|
+
alias: string;
|
|
45
|
+
definition_formal: string;
|
|
46
|
+
typification_manual: string;
|
|
47
|
+
term_raw: string;
|
|
48
|
+
definition_raw: string;
|
|
49
|
+
}
|
|
50
|
+
/** Build alias mapping from template argument bindings. */
|
|
51
|
+
declare function argumentValuesToMapping(args: ArgumentValue[]): AliasMapping;
|
|
52
|
+
/** Validate alias format for a given {@link CstType} (prefix + digits, min length 2). */
|
|
53
|
+
declare function validateAliasFormat(alias: string, type: CstType): boolean;
|
|
54
|
+
/** Validate new alias against {@link CstType} and {@link RSForm}. */
|
|
55
|
+
declare function validateNewAlias(alias: string, type: CstType, schema: RSForm): boolean;
|
|
56
|
+
/** Generate alias for new {@link Constituenta} of a given {@link CstType} for current {@link RSForm}. */
|
|
57
|
+
declare function generateAlias(type: CstType, schema: RSForm, takenAliases?: string[]): string;
|
|
58
|
+
/**
|
|
59
|
+
* Remap formal expressions and terminological entity references in constituent fields.
|
|
60
|
+
* Mutates each element of `items` in place; pass owned or cloned data only.
|
|
61
|
+
*/
|
|
62
|
+
declare function applyMappingToConstituents<T extends ConstituentaMappableFields>(items: T[], mapping: AliasMapping, changeAliases: boolean): void;
|
|
63
|
+
/** Highest numeric alias suffix for {@link type} among {@link items} (0 when none). */
|
|
64
|
+
declare function maxAliasIndex(items: readonly AliasTypedConstituenta[], type: CstType): number;
|
|
65
|
+
/**
|
|
66
|
+
* Build alias → new-alias mapping that renumbers each type sequentially in list order.
|
|
67
|
+
* Matches backend {@code RSFormCached.reset_aliases}.
|
|
68
|
+
*/
|
|
69
|
+
declare function buildSequentialAliasMapping(items: readonly AliasTypedConstituenta[]): AliasMapping;
|
|
70
|
+
/**
|
|
71
|
+
* Allocate fresh aliases for {@link source} constituents being imported into a non-empty receiver.
|
|
72
|
+
* Returns an empty mapping when the receiver has no items (aliases kept as-is).
|
|
73
|
+
*/
|
|
74
|
+
declare function allocateImportAliases(receiver: readonly AliasTypedConstituenta[], source: readonly AliasTypedConstituenta[]): AliasMapping;
|
|
75
|
+
/** Remove alias from expression. */
|
|
76
|
+
declare function removeAliasReference(expression: string, alias: string): string;
|
|
77
|
+
/** Add alias to expression. */
|
|
78
|
+
declare function addAliasReference(expression: string, alias: string): string;
|
|
79
|
+
//#endregion
|
|
80
|
+
//#region src/library/rsform-api/analysis.d.ts
|
|
81
|
+
declare function getAnalysisFor(expression: string, cstType: CstType, schema: RSForm, alias?: string): AnalysisFull;
|
|
82
|
+
/**
|
|
83
|
+
* When an untyped / bare F·P reference names a constituent on a definition cycle with the
|
|
84
|
+
* current expression, replace that error with {@link RSDiagnosticCode.schemaDependencyCycle}.
|
|
85
|
+
*
|
|
86
|
+
* Covers both semantic `globalNotTyped` (e.g. `F3[σ]`) and parser `globalFuncWithoutArgs`
|
|
87
|
+
* (bare `P1` / `F1` treated as a call without arguments).
|
|
88
|
+
*
|
|
89
|
+
* Uses a draft dependency graph: incoming edges of the edited constituent are taken from
|
|
90
|
+
* `expression`, so Check works before Save.
|
|
91
|
+
*/
|
|
92
|
+
declare function refineAnalysisForDependencyCycles(analysis: AnalysisFull, expression: string, schema: RSForm, alias?: string): AnalysisFull;
|
|
93
|
+
//#endregion
|
|
94
|
+
//#region src/library/rsform-api/attribution.d.ts
|
|
95
|
+
/**
|
|
96
|
+
* Remap attributions when constituents are substituted (original → replacement).
|
|
97
|
+
* Drops self-loops and duplicates. Matches sandbox / backend substitute attribution rewrite.
|
|
98
|
+
*/
|
|
99
|
+
declare function remapAttributionsUnderSubstitution(attributions: readonly Attribution[], origToSub: ReadonlyMap<number, number>): Attribution[];
|
|
100
|
+
/**
|
|
101
|
+
* Copy attributions whose both endpoints are in {@link sourceIdSet}, remapping ids via {@link idMap}.
|
|
102
|
+
* Appends onto a clone of {@link existing} with dedupe. Used by schema embedding / insert.
|
|
103
|
+
*/
|
|
104
|
+
declare function importAttributions(sourceAttributions: readonly Attribution[], sourceIdSet: ReadonlySet<number>, idMap: Readonly<Record<number, number>>, existing?: readonly Attribution[]): Attribution[];
|
|
105
|
+
/** Drop attributions that reference any id in {@link deletedIds}. */
|
|
106
|
+
declare function filterAttributions(attributions: readonly Attribution[], deletedIds: ReadonlySet<number>): Attribution[];
|
|
107
|
+
//#endregion
|
|
108
|
+
//#region src/library/rsform-api/cst-type.d.ts
|
|
109
|
+
/** Prefix for alias indicating {@link CstType}. */
|
|
110
|
+
declare function getCstTypePrefix(type: CstType): string;
|
|
111
|
+
/** Guess {@link CstType} from user input hint. */
|
|
112
|
+
declare function guessCstType(hint: string): CstType | null;
|
|
113
|
+
/** Infers the {@link CstClass} based on the provided {@link CstType} and template status. */
|
|
114
|
+
declare function inferClass(type: CstType, isTemplate?: boolean): CstClass;
|
|
115
|
+
/** Check if {@link Constituenta} is a template or a category. */
|
|
116
|
+
declare function isTemplateCst(cst: Constituenta): boolean;
|
|
117
|
+
/** Evaluate if {@link CstType} is basic concept. */
|
|
118
|
+
declare function isBasicConcept(type: CstType): boolean;
|
|
119
|
+
/** Evaluate if {@link CstType} is base set or constant set. */
|
|
120
|
+
declare function isBaseSet(type: CstType): boolean;
|
|
121
|
+
/** Evaluate if {@link CstType} is a function. */
|
|
122
|
+
declare function isFunctional(type: CstType): boolean;
|
|
123
|
+
/** Evaluate if {@link CstType} is logical. */
|
|
124
|
+
declare function isLogical(type: CstType): boolean;
|
|
125
|
+
/** Evaluate if {@link CstType} can have manual typification. */
|
|
126
|
+
declare function canHaveManualTypification(type: CstType): boolean;
|
|
127
|
+
/** Checks whether a constituenta type supports formal definitions. */
|
|
128
|
+
declare function canHaveFormalDefinition(cstType: CstType): boolean;
|
|
129
|
+
/** Returns expected {@link TypeClass} of formal definition for {@link CstType}. */
|
|
130
|
+
declare function typeClassForCstType(cstType: CstType): TypeClass;
|
|
131
|
+
/** Evaluate if {@link Constituenta} can be used produce structure. */
|
|
132
|
+
declare function canProduceStructure(cst: Constituenta): boolean;
|
|
133
|
+
//#endregion
|
|
134
|
+
//#region src/library/rsform-api/expression.d.ts
|
|
135
|
+
/** Infers the status of an expression based on parsing and value information. */
|
|
136
|
+
declare function inferStatus(parse: boolean, value?: ValueClass | null): CstStatus;
|
|
137
|
+
/** Infers type of constituent for a given template and arguments. */
|
|
138
|
+
declare function inferTemplatedType(templateType: CstType, args: ArgumentValue[]): CstType;
|
|
139
|
+
/**
|
|
140
|
+
* Normalize a RSLang expression for duplicate comparison.
|
|
141
|
+
*
|
|
142
|
+
* Returns `null` for basic concepts without formal definitions. Pass a pre-parsed `ast`
|
|
143
|
+
* when the expression was already analyzed to avoid re-parsing.
|
|
144
|
+
*/
|
|
145
|
+
declare function normalizeExpression(expression: string, cst_type: CstType, ast?: AstNode | null): string | null;
|
|
146
|
+
/** Checks if given expression is a template. */
|
|
147
|
+
declare function inferTemplate(expression: string): boolean;
|
|
148
|
+
/** Apply filter based on start {@link Constituenta} type. */
|
|
149
|
+
declare function applyFilterCategory(start: Constituenta, items: Constituenta[]): Constituenta[];
|
|
150
|
+
//#endregion
|
|
151
|
+
//#region src/library/rsform-api/formal-graph.d.ts
|
|
152
|
+
/**
|
|
153
|
+
* Build the formal dependency graph: supplier → dependent.
|
|
154
|
+
* Matches backend {@code RSForm.graph_formal}.
|
|
155
|
+
*/
|
|
156
|
+
declare function buildFormalDependencyGraph(items: readonly OrderableConstituenta[]): Graph<number>;
|
|
157
|
+
/**
|
|
158
|
+
* Reorder constituents: formal topology hard, semantic children sticky when ready,
|
|
159
|
+
* otherwise stable against type/kernel preferred ranks.
|
|
160
|
+
*
|
|
161
|
+
* One Kahn pass over the formal dependency graph.
|
|
162
|
+
*/
|
|
163
|
+
declare function restoreConstituentOrder<T extends OrderableConstituenta>(items: readonly T[], graph?: Graph<number>, relations?: SemanticRelations): T[];
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region src/library/rsform-api/stats.d.ts
|
|
166
|
+
/** Checks if {@link Constituenta} is a schema issue. */
|
|
167
|
+
declare function isSchemaIssue(cst: Constituenta): boolean;
|
|
168
|
+
/** Calculate statistics for {@link RSForm}. */
|
|
169
|
+
declare function calculateSchemaStats(target: RSForm): RSFormStats;
|
|
170
|
+
//#endregion
|
|
171
|
+
//#region src/library/rsform-api/structure.d.ts
|
|
172
|
+
/**
|
|
173
|
+
* Id to pass as `insert_after` when creating a new {@link Constituenta} spawned by `targetId`:
|
|
174
|
+
* after the last existing child of that spawner, or after the spawner itself if none.
|
|
175
|
+
*/
|
|
176
|
+
declare function inferNewSpawnPosition(schema: RSForm, targetId: number): number;
|
|
177
|
+
/** Finds {@link Constituenta} by structure path. */
|
|
178
|
+
declare function findCstByStructure(schema: RSForm, target: Constituenta, path: TypePath): Constituenta | null;
|
|
179
|
+
/** Retrieves name for piece of target {@link Constituenta} structure. */
|
|
180
|
+
declare function getStructureName(schema: RSForm, target: Constituenta, path: TypePath): string;
|
|
181
|
+
//#endregion
|
|
182
|
+
//#region src/library/rsform-api/substitution.d.ts
|
|
183
|
+
/** Result of applying substitutions to a schema fragment. */
|
|
184
|
+
interface SubstitutionResult<T> {
|
|
185
|
+
items: T[];
|
|
186
|
+
attributions: Attribution[];
|
|
187
|
+
deletedIds: Set<number>;
|
|
188
|
+
/** Replacement constituent ids (survivors referenced by substitutions). */
|
|
189
|
+
replacementIds: number[];
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Apply constituenta substitutions: remap attributions, drop originals, rewrite aliases in survivors.
|
|
193
|
+
* Does not resolve texts — call {@link resolveAllConstituentTexts} afterwards.
|
|
194
|
+
*/
|
|
195
|
+
declare function applyConstituentSubstitutions<T extends ConstituentaMappableFields & {
|
|
196
|
+
id: number;
|
|
197
|
+
alias: string;
|
|
198
|
+
}>(items: readonly T[], attributions: readonly Attribution[], substitutions: readonly Substitution[]): SubstitutionResult<T>;
|
|
199
|
+
/**
|
|
200
|
+
* Remap substitution endpoints after source constituents were inserted under new ids.
|
|
201
|
+
* If {@link original} was imported, map it; otherwise map {@link substitution}.
|
|
202
|
+
*/
|
|
203
|
+
declare function remapSubstitutionsAfterImport(substitutions: readonly Substitution[], sourceIdSet: ReadonlySet<number>, idMap: Readonly<Record<number, number>>): Substitution[];
|
|
204
|
+
//#endregion
|
|
205
|
+
//#region src/library/rsform-api/synthesis.d.ts
|
|
206
|
+
/** Constituent shape required for embedding / synthesis transforms. */
|
|
207
|
+
type SynthesizableConstituenta = ConstituentaMappableFields & ResolvableConstituenta & AliasTypedConstituenta & {
|
|
208
|
+
id: number;
|
|
209
|
+
alias: string;
|
|
210
|
+
cst_type: CstType;
|
|
211
|
+
};
|
|
212
|
+
/** Input for {@link inlineSynthesis}. */
|
|
213
|
+
interface InlineSynthesisInput<T extends SynthesizableConstituenta> {
|
|
214
|
+
/** Receiver schema constituents (order preserved; imports append). */
|
|
215
|
+
receiverItems: readonly T[];
|
|
216
|
+
/** Receiver attributions (default empty). */
|
|
217
|
+
receiverAttributions?: readonly Attribution[];
|
|
218
|
+
/**
|
|
219
|
+
* Source constituents to insert (already filtered to the desired subset).
|
|
220
|
+
* Cloned; originals are not mutated.
|
|
221
|
+
*/
|
|
222
|
+
sourceItems: readonly T[];
|
|
223
|
+
/** Source attributions whose both endpoints are among {@link sourceItems}. */
|
|
224
|
+
sourceAttributions?: readonly Attribution[];
|
|
225
|
+
/**
|
|
226
|
+
* Identification table using pre-import ids:
|
|
227
|
+
* one endpoint is a source id, the other a receiver id
|
|
228
|
+
* (same rules as backend embedding / InlineSynthesis).
|
|
229
|
+
*/
|
|
230
|
+
substitutions?: readonly Substitution[];
|
|
231
|
+
/** Next free numeric id for inserted constituents. */
|
|
232
|
+
nextId: number;
|
|
233
|
+
}
|
|
234
|
+
/** Result of {@link inlineSynthesis}. */
|
|
235
|
+
interface InlineSynthesisResult<T extends SynthesizableConstituenta> {
|
|
236
|
+
items: T[];
|
|
237
|
+
attributions: Attribution[];
|
|
238
|
+
/** Updated next-id after inserts. */
|
|
239
|
+
nextId: number;
|
|
240
|
+
/** Source id → inserted id. */
|
|
241
|
+
idMap: Record<number, number>;
|
|
242
|
+
/** Alias remapping applied to imported constituents (empty when receiver was empty). */
|
|
243
|
+
aliasMapping: AliasMapping;
|
|
244
|
+
/** Ids removed by substitutions. */
|
|
245
|
+
deletedIds: Set<number>;
|
|
246
|
+
/** Ids of newly inserted constituents (before any were deleted by substitutions). */
|
|
247
|
+
insertedIds: number[];
|
|
248
|
+
/** Survivor ids referenced by applied substitutions. */
|
|
249
|
+
replacementIds: number[];
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Embed {@link InlineSynthesisInput.sourceItems} into the receiver and apply substitutions.
|
|
253
|
+
* Resolves term/definition entity references on the result.
|
|
254
|
+
* Does not mutate inputs.
|
|
255
|
+
*/
|
|
256
|
+
declare function inlineSynthesis<T extends SynthesizableConstituenta>(input: InlineSynthesisInput<T>): InlineSynthesisResult<T>;
|
|
257
|
+
/** Sorts library items relevant for schema embedding with specified {@link RSForm}. */
|
|
258
|
+
declare function sortItemsForInlineSynthesis(receiver: RSForm, items: readonly LibraryItem[]): LibraryItem[];
|
|
259
|
+
//#endregion
|
|
260
|
+
//#region src/library/rsform-api/text-resolution.d.ts
|
|
261
|
+
/** Options controlling which texts to re-resolve after an edit. */
|
|
262
|
+
interface TextChangeOptions {
|
|
263
|
+
termChanged: boolean;
|
|
264
|
+
termRawChanged: boolean;
|
|
265
|
+
definitionRawChanged: boolean;
|
|
266
|
+
clearTargetForms: boolean;
|
|
267
|
+
}
|
|
268
|
+
/** Build term-reference graph: referenced constituent → dependent (backend {@code graph_term}). */
|
|
269
|
+
declare function buildTermReferenceGraph(items: readonly ResolvableConstituenta[]): Graph<number>;
|
|
270
|
+
/** Build definition-reference graph: referenced constituent → dependent (backend {@code graph_text}). */
|
|
271
|
+
declare function buildDefinitionReferenceGraph(items: readonly ResolvableConstituenta[]): Graph<number>;
|
|
272
|
+
/** Resolve all term and definition texts in topological order. Mutates items in place. */
|
|
273
|
+
declare function resolveAllConstituentTexts(items: ResolvableConstituenta[]): void;
|
|
274
|
+
/**
|
|
275
|
+
* Resolve texts after a single constituent change, cascading dependents when the term changed.
|
|
276
|
+
* Mutates items in place.
|
|
277
|
+
*/
|
|
278
|
+
declare function resolveConstituentTextChange(items: ResolvableConstituenta[], targetID: number, options: TextChangeOptions): void;
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/library/rsform-api/transforms.d.ts
|
|
281
|
+
/**
|
|
282
|
+
* Pure constituenta list transforms: reorder, move, insert position.
|
|
283
|
+
*/
|
|
284
|
+
/** Rebuild an item list following {@link orderedIds}. Throws if an id is missing. */
|
|
285
|
+
declare function reorderItemsByIds<T extends {
|
|
286
|
+
id: number;
|
|
287
|
+
}>(items: readonly T[], orderedIds: readonly number[]): T[];
|
|
288
|
+
/**
|
|
289
|
+
* Move a subset of ids within an ordered id list.
|
|
290
|
+
* {@link moveTo} is clamped to `[0, rest.length]` (index among non-moving items).
|
|
291
|
+
*/
|
|
292
|
+
declare function moveIdsInOrder(ids: readonly number[], moving: readonly number[], moveTo: number): number[];
|
|
293
|
+
/** Insert {@link item} after {@link insertAfter}, or append when null/undefined/missing. Mutates {@link items}. */
|
|
294
|
+
declare function insertItemAfter<T extends {
|
|
295
|
+
id: number;
|
|
296
|
+
}>(items: T[], item: T, insertAfter: number | null | undefined): void;
|
|
297
|
+
//#endregion
|
|
298
|
+
export { type AliasTypedConstituenta, type ConstituentaMappableFields, type InlineSynthesisInput, type InlineSynthesisResult, type OrderableConstituenta, type ResolvableConstituenta, type SemanticRelations, type SubstitutionResult, type SynthesizableConstituenta, type TextChangeOptions, addAliasReference, allocateImportAliases, applyConstituentSubstitutions, applyFilterCategory, applyMappingToConstituents, argumentValuesToMapping, buildDefinitionReferenceGraph, buildFormalDependencyGraph, buildSequentialAliasMapping, buildTermReferenceGraph, calculateSchemaStats, canHaveManualTypification, canProduceStructure, filterAttributions, findCstByStructure, generateAlias, getAnalysisFor, getCstTypePrefix, getStructureName, guessCstType, importAttributions, inferClass, inferNewSpawnPosition, inferStatus, inferTemplate, inferTemplatedType, inlineSynthesis, insertItemAfter, isBaseSet, isBasicConcept, isFunctional, isLogical, isSchemaIssue, isTemplateCst, maxAliasIndex, moveIdsInOrder, normalizeExpression, refineAnalysisForDependencyCycles, remapAttributionsUnderSubstitution, remapSubstitutionsAfterImport, removeAliasReference, reorderItemsByIds, resolveAllConstituentTexts, resolveConstituentTextChange, restoreConstituentOrder, sortItemsForInlineSynthesis, typeClassForCstType, validateAliasFormat, validateNewAlias };
|
|
299
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { $ as isFunctional, A as normalizeExpression, B as buildSequentialAliasMapping, C as isSchemaIssue, D as inferStatus, E as applyFilterCategory, F as refineAnalysisForDependencyCycles, G as validateNewAlias, H as maxAliasIndex, I as addAliasReference, J as getCstTypePrefix, K as canHaveManualTypification, L as allocateImportAliases, M as importAttributions, N as remapAttributionsUnderSubstitution, O as inferTemplate, P as getAnalysisFor, Q as isBasicConcept, R as applyMappingToConstituents, S as calculateSchemaStats, T as restoreConstituentOrder, U as removeAliasReference, V as generateAlias, W as validateAliasFormat, X as inferClass, Y as guessCstType, Z as isBaseSet, _ as applyConstituentSubstitutions, b as getStructureName, c as insertItemAfter, d as inlineSynthesis, et as isLogical, f as sortItemsForInlineSynthesis, g as resolveConstituentTextChange, h as resolveAllConstituentTexts, j as filterAttributions, k as inferTemplatedType, l as moveIdsInOrder, m as buildTermReferenceGraph, nt as typeClassForCstType, p as buildDefinitionReferenceGraph, q as canProduceStructure, tt as isTemplateCst, u as reorderItemsByIds, v as remapSubstitutionsAfterImport, w as buildFormalDependencyGraph, x as inferNewSpawnPosition, y as findCstByStructure, z as argumentValuesToMapping } from "../../diagnostics-CljEzVBV.js";
|
|
2
|
+
export { addAliasReference, allocateImportAliases, applyConstituentSubstitutions, applyFilterCategory, applyMappingToConstituents, argumentValuesToMapping, buildDefinitionReferenceGraph, buildFormalDependencyGraph, buildSequentialAliasMapping, buildTermReferenceGraph, calculateSchemaStats, canHaveManualTypification, canProduceStructure, filterAttributions, findCstByStructure, generateAlias, getAnalysisFor, getCstTypePrefix, getStructureName, guessCstType, importAttributions, inferClass, inferNewSpawnPosition, inferStatus, inferTemplate, inferTemplatedType, inlineSynthesis, insertItemAfter, isBaseSet, isBasicConcept, isFunctional, isLogical, isSchemaIssue, isTemplateCst, maxAliasIndex, moveIdsInOrder, normalizeExpression, refineAnalysisForDependencyCycles, remapAttributionsUnderSubstitution, remapSubstitutionsAfterImport, removeAliasReference, reorderItemsByIds, resolveAllConstituentTexts, resolveConstituentTextChange, restoreConstituentOrder, sortItemsForInlineSynthesis, typeClassForCstType, validateAliasFormat, validateNewAlias };
|
package/dist/library/rsform.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as RSFormStats, S as RSForm, T as
|
|
2
|
-
export { ArgumentValue, Attribution, Constituenta, CstClass, CstStatus, CstType, RSForm, RSFormStats, Substitution, TypeInfo };
|
|
1
|
+
import { C as RSFormStats, E as TypeInfo, S as RSForm, T as TermForm, _ as Attribution, b as CstStatus, g as ArgumentValue, v as Constituenta, w as Substitution, x as CstType, y as CstClass } from "../diagnostics-Dac5sJhO.js";
|
|
2
|
+
export { ArgumentValue, Attribution, Constituenta, CstClass, CstStatus, CstType, RSForm, RSFormStats, Substitution, TermForm, TypeInfo };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsform.js","names":[],"sources":["../../src/library/rsform.ts"],"sourcesContent":["/**\n * Module: Models for formal representation for systems of concepts.\n */\n\nimport { type Graph } from '../graph';\nimport { type AnalysisBase, type ExpressionType, type RSLangAnalyzer, type TypePath } from '../rslang';\n\nimport { type CstDiagnostic } from './diagnostics';\nimport { type CurrentVersion, type LibraryItem, type LibraryItemReference, type VersionInfo } from './library';\n\n/** Represents {@link Constituenta} type. */\nexport const CstType = {\n NOMINAL: 'nominal',\n BASE: 'basic',\n STRUCTURED: 'structure',\n TERM: 'term',\n AXIOM: 'axiom',\n FUNCTION: 'function',\n PREDICATE: 'predicate',\n CONSTANT: 'constant',\n STATEMENT: 'statement'\n} as const;\nexport type CstType = (typeof CstType)[keyof typeof CstType];\n\n/** Represents attribution of a {@link Constituenta} to another {@link Constituenta}. */\nexport interface Attribution {\n container: number;\n attribute: number;\n}\n\n/** Represents global identifier type info. */\nexport interface TypeInfo {\n alias: string;\n type: ExpressionType;\n}\n\n/** Represents function argument value. */\nexport interface ArgumentValue {\n alias: string;\n typification: string;\n value?: string;\n}\n\n/** Represents Constituenta classification in terms of system of concepts. */\nexport const CstClass = {\n NOMINAL: 'nominal',\n BASIC: 'basic',\n DERIVED: 'derived',\n STATEMENT: 'statement',\n TEMPLATE: 'template'\n} as const;\nexport type CstClass = (typeof CstClass)[keyof typeof CstClass];\n\n/** Represents formal expression Status. */\nexport const CstStatus = {\n VERIFIED: 'verified',\n INCORRECT: 'incorrect',\n INCALCULABLE: 'incalculable',\n PROPERTY: 'property',\n UNKNOWN: 'unknown'\n} as const;\nexport type CstStatus = (typeof CstStatus)[keyof typeof CstStatus];\n\n/** Represents substitution of {@link Constituenta}. */\nexport interface Substitution {\n original: number;\n substitution: number;\n}\n\n/** Represents word form for natural language. */\
|
|
1
|
+
{"version":3,"file":"rsform.js","names":[],"sources":["../../src/library/rsform.ts"],"sourcesContent":["/**\n * Module: Models for formal representation for systems of concepts.\n */\n\nimport { type Graph } from '../graph';\nimport { type AnalysisBase, type ExpressionType, type RSLangAnalyzer, type TypePath } from '../rslang';\n\nimport { type CstDiagnostic } from './diagnostics';\nimport { type CurrentVersion, type LibraryItem, type LibraryItemReference, type VersionInfo } from './library';\n\n/** Represents {@link Constituenta} type. */\nexport const CstType = {\n NOMINAL: 'nominal',\n BASE: 'basic',\n STRUCTURED: 'structure',\n TERM: 'term',\n AXIOM: 'axiom',\n FUNCTION: 'function',\n PREDICATE: 'predicate',\n CONSTANT: 'constant',\n STATEMENT: 'statement'\n} as const;\nexport type CstType = (typeof CstType)[keyof typeof CstType];\n\n/** Represents attribution of a {@link Constituenta} to another {@link Constituenta}. */\nexport interface Attribution {\n container: number;\n attribute: number;\n}\n\n/** Represents global identifier type info. */\nexport interface TypeInfo {\n alias: string;\n type: ExpressionType;\n}\n\n/** Represents function argument value. */\nexport interface ArgumentValue {\n alias: string;\n typification: string;\n value?: string;\n}\n\n/** Represents Constituenta classification in terms of system of concepts. */\nexport const CstClass = {\n NOMINAL: 'nominal',\n BASIC: 'basic',\n DERIVED: 'derived',\n STATEMENT: 'statement',\n TEMPLATE: 'template'\n} as const;\nexport type CstClass = (typeof CstClass)[keyof typeof CstClass];\n\n/** Represents formal expression Status. */\nexport const CstStatus = {\n VERIFIED: 'verified',\n INCORRECT: 'incorrect',\n INCALCULABLE: 'incalculable',\n PROPERTY: 'property',\n UNKNOWN: 'unknown'\n} as const;\nexport type CstStatus = (typeof CstStatus)[keyof typeof CstStatus];\n\n/** Represents substitution of {@link Constituenta}. */\nexport interface Substitution {\n original: number;\n substitution: number;\n}\n\n/** Represents word form for natural language. */\nexport interface TermForm {\n text: string;\n tags: string;\n}\n\n/** Represents Constituenta. */\nexport interface Constituenta {\n id: number;\n crucial: boolean;\n alias: string;\n convention: string;\n cst_type: CstType;\n definition_formal: string;\n definition_raw: string;\n definition_resolved: string;\n term_raw: string;\n term_resolved: string;\n term_forms: TermForm[];\n attributes: number[];\n\n /** Manual typification of the constituent */\n typification_manual: string;\n\n /** Controls whether base concepts expose property values or full values */\n value_is_property: boolean;\n\n analysis: AnalysisBase;\n\n /** Schema-kind {@link CstDiagnostic} list, populated during schema loading. */\n diagnostics: CstDiagnostic[];\n\n /** Typification used for dependents, model values, and display (manual when it overrides computed). */\n effectiveType: ExpressionType | null;\n\n /**\n * True when manual typification is non-empty, parses to a type, and its label differs from the\n * typification inferred from the formal definition ({@link Constituenta.analysis}.type).\n */\n is_type_mismatch: boolean;\n\n /** Identifier of {@link LibraryItem} containing this {@link Constituenta}. */\n schema: number;\n\n /** {@link CstClass} of this {@link Constituenta}. */\n cst_class: CstClass;\n /** {@link CstStatus} of this {@link Constituenta}. */\n status: CstStatus;\n\n /** Indicates if this {@link Constituenta} is a template. */\n is_template: boolean;\n /** Indicates if this {@link Constituenta} has a simple expression. */\n is_simple_expression: boolean;\n\n /** Index of {@link LibraryItem} that contains this cst (or inheritance parent).\n * 0 - not inherited, 1 - inherited by 1st schema, 2 - inherited by 2nd schema, etc.\n */\n parent_schema_index: number;\n /** {@link LibraryItem} that contains parent of this inherited {@link Constituenta}. */\n parent_schema: number | null;\n /** Indicates if this {@link Constituenta} is inherited. */\n is_inherited: boolean;\n /** Indicates if this {@link Constituenta} has children that are inherited. */\n has_inherited_children: boolean;\n\n /** {@link Constituenta} that spawned this one. */\n spawner?: number;\n /** Alias of {@link Constituenta} that spawned this one. */\n spawner_alias?: string;\n /** Structure path that spawned this one. */\n spawner_path?: TypePath;\n\n /** List of {@link Constituenta} that are spawned by this one. */\n spawn: number[];\n /** List of aliases of {@link Constituenta} that are spawned by this one. */\n spawn_alias: string[];\n}\n\n/** Represents {@link RSForm} statistics. */\nexport interface RSFormStats {\n step_complexity: number;\n\n /** Total number of constituents in the RSForm. */\n count_all: number;\n /** Number of crucial constituents in the RSForm. */\n count_crucial: number;\n\n count_problematic: number;\n /** Constituents that have same term. */\n count_homonyms: number;\n /** Constituents that have same formal definition and term. */\n count_formal_duplicates: number;\n /** Non-logical basic constituents missing convention and/or resolved term. */\n count_missing_basic_text: number;\n /** Constituents with non-empty manual typification that disagrees with inferred typification. */\n count_type_mismatch: number;\n\n count_incorrect: number;\n count_property: number;\n count_incalculable: number;\n count_inherited: number;\n\n count_text_term: number;\n count_definition: number;\n count_convention: number;\n count_comment: number;\n\n count_base: number;\n count_constant: number;\n count_structured: number;\n count_axiom: number;\n count_term: number;\n count_function: number;\n count_predicate: number;\n count_statement: number;\n count_nominal: number;\n}\n\n/** Represents inheritance data for {@link RSForm}. */\ninterface InheritanceInfo {\n child: number;\n child_source: number;\n parent: number;\n parent_source: number;\n}\n\n/** Represents formal explication for set of concepts. */\nexport interface RSForm extends LibraryItem {\n /** Whether this RSForm was produced (vs imported or inherited) */\n is_produced: boolean;\n /** Whether this RSForm has attribution feature */\n is_attributive: boolean;\n /** List of user IDs who can edit this RSForm */\n editors: number[];\n /** Information about the current version of this RSForm */\n version: CurrentVersion;\n /** Full version history of this RSForm */\n versions: VersionInfo[];\n\n /** Full list of constituents in the RSForm */\n items: Constituenta[];\n /** List of inheritance relationships between constituents */\n inheritance: InheritanceInfo[];\n /** List of constituent attribution relationships */\n attribution: Attribution[];\n /** References to Operational Schemes/Systems associated with the RSForm */\n oss: LibraryItemReference[];\n /** References to conceptual models associated with the RSForm */\n models: LibraryItemReference[];\n\n /** Analyzer instance for RS language features and validation */\n analyzer: RSLangAnalyzer;\n /** Graph structure representing formal dependencies between constituents */\n graph: Graph;\n /** Graph structure representing attribution relationships */\n attribution_graph: Graph;\n /** Map for quick lookup of constituents by alias */\n cstByAlias: Map<string, Constituenta>;\n /** Map for quick lookup of constituents by ID */\n cstByID: Map<number, Constituenta>;\n}\n"],"mappings":";;AAWA,MAAa,UAAU;CACrB,SAAS;CACT,MAAM;CACN,YAAY;CACZ,MAAM;CACN,OAAO;CACP,UAAU;CACV,WAAW;CACX,UAAU;CACV,WAAW;AACb;;AAuBA,MAAa,WAAW;CACtB,SAAS;CACT,OAAO;CACP,SAAS;CACT,WAAW;CACX,UAAU;AACZ;;AAIA,MAAa,YAAY;CACvB,UAAU;CACV,WAAW;CACX,cAAc;CACd,UAAU;CACV,SAAS;AACX"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { b as Typification, f as ExpressionType } from "../typification-9lNu9R4k.js";
|
|
2
2
|
import { d as ValuePath, l as Value } from "../value-BduA_ZGp.js";
|
|
3
|
-
import { S as RSForm, f as EvalStatus, l as BasicBinding, m as RSModelStats, v as Constituenta, x as CstType } from "../diagnostics-
|
|
3
|
+
import { S as RSForm, f as EvalStatus, l as BasicBinding, m as RSModelStats, v as Constituenta, x as CstType } from "../diagnostics-Dac5sJhO.js";
|
|
4
4
|
import { RSEngine } from "./rsengine.js";
|
|
5
5
|
|
|
6
6
|
//#region src/library/rsmodel-api.d.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TypeID } from "../rslang/semantic/typification.js";
|
|
2
|
+
import { CstType } from "./rsform.js";
|
|
2
3
|
import { O as setNestedValue, _ as extractValue, b as isTupleValue, f as tuple, l as compare, x as makeDefaultValue } from "../value-COprb2Je.js";
|
|
3
4
|
import "../rslang/index.js";
|
|
4
|
-
import {
|
|
5
|
-
import { D as isBaseSet, O as isBasicConcept, f as calculateSchemaStats, s as modelStatusCstDiagnostic } from "../diagnostics-CY9sKggB.js";
|
|
5
|
+
import { Q as isBasicConcept, S as calculateSchemaStats, Z as isBaseSet, s as modelStatusCstDiagnostic } from "../diagnostics-CljEzVBV.js";
|
|
6
6
|
import { EvalStatus } from "./rsmodel.js";
|
|
7
7
|
//#region src/library/rsmodel-api.ts
|
|
8
8
|
const RANDOM_INTEGER_MIN = -100;
|
|
@@ -172,8 +172,10 @@ function updateValueElement(value, path, newValue) {
|
|
|
172
172
|
return setNestedValue(value, path, newValue);
|
|
173
173
|
}
|
|
174
174
|
function deleteValueElement(value, path, type, target) {
|
|
175
|
+
if (value === null) return null;
|
|
175
176
|
if (path.length === 0 && type.typeID !== TypeID.collection) return null;
|
|
176
177
|
const arrayValue = extractValue(value, path);
|
|
178
|
+
if (!Array.isArray(arrayValue)) return null;
|
|
177
179
|
return setNestedValue(value, path, [...arrayValue.slice(0, target), ...arrayValue.slice(target + 1)]);
|
|
178
180
|
}
|
|
179
181
|
function addValueElement(value, path, type, currentType) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsmodel-api.js","names":[],"sources":["../../src/library/rsmodel-api.ts"],"sourcesContent":["import { type ExpressionType, TypeID, type Typification, type Value } from '../rslang';\nimport { compare, tuple, TUPLE_ID, VALUE_TRUE, type ValuePath } from '../rslang/eval/value';\nimport { extractValue, isTupleValue, makeDefaultValue, setNestedValue } from '../rslang/eval/value-api';\nimport { type EchelonCollection } from '../rslang/semantic/typification';\n\nimport { modelStatusCstDiagnostic } from './diagnostics';\nimport { type RSEngine } from './rsengine';\nimport { type Constituenta, CstType, type RSForm } from './rsform';\nimport { calculateSchemaStats, isBaseSet, isBasicConcept } from './rsform-api';\nimport { type BasicBinding, EvalStatus, type RSModelStats } from './rsmodel';\n\nconst RANDOM_INTEGER_MIN = -100;\nconst RANDOM_INTEGER_MAX = 100;\nconst DEFAULT_RANDOM_SET_ELEMENTS_COUNT = 5;\n\n/** Evaluate if parsed data is a basic binding data. */\nexport function validateBasicBindingData(data: unknown): data is Record<string, string> {\n if (!data || typeof data !== 'object' || Array.isArray(data)) {\n return false;\n }\n return Object.entries(data).every(([key, value]) => typeof value === 'string' && Number.isInteger(Number(key)));\n}\n\n/** Convert parsed data to a basic binding. */\nexport function toBasicBinding(data: Record<string | number, string>): BasicBinding {\n const result: BasicBinding = {};\n for (const [k, v] of Object.entries(data)) {\n result[Number(k)] = v;\n }\n return result;\n}\n\n/** Evaluate if parsed data is a {@link Value} data. */\nexport function validateValueData(data: unknown): data is Value {\n if (typeof data === 'number') {\n return Number.isFinite(data);\n }\n if (!Array.isArray(data)) {\n return false;\n }\n return data.every(item => validateValueData(item));\n}\n\nexport function generateRandomValue(\n type: Typification,\n basics: Map<number, BasicBinding>,\n cstByAlias: Map<string, Constituenta>,\n setElementsCount: number = DEFAULT_RANDOM_SET_ELEMENTS_COUNT\n): Value | null {\n switch (type.typeID) {\n case TypeID.integer:\n return Math.floor(Math.random() * (RANDOM_INTEGER_MAX - RANDOM_INTEGER_MIN + 1)) + RANDOM_INTEGER_MIN;\n case TypeID.basic: {\n const cst = cstByAlias.get(type.baseID);\n const binding = cst ? basics.get(cst.id) : undefined;\n const ids = Object.keys(binding ?? {}).map(Number);\n if (ids.length === 0) {\n return null;\n }\n return ids[Math.floor(Math.random() * ids.length)];\n }\n case TypeID.tuple: {\n const factors: Value[] = [];\n for (const factor of type.factors) {\n const sample = generateRandomValue(factor, basics, cstByAlias, setElementsCount);\n if (sample === null) {\n return null;\n }\n factors.push(sample);\n }\n return tuple(factors);\n }\n case TypeID.collection: {\n const result: Value[] = [];\n const randomElementsCount = Math.floor(Math.random() * (setElementsCount + 1));\n for (let i = 0; i < randomElementsCount; i++) {\n const sample = generateRandomValue(type.base, basics, cstByAlias, setElementsCount);\n if (sample === null) {\n return null;\n }\n result.push(sample);\n }\n return result;\n }\n case TypeID.anyTypification:\n return null;\n }\n}\n\n/** Calculate statistics for {@link RSModel}. */\nexport function calculateModelStats(schema: RSForm, engine: RSEngine, _engineGeneration?: number): RSModelStats {\n const items = schema.items;\n const statusByID = new Map<number, EvalStatus>();\n for (const cst of items) {\n statusByID.set(cst.id, engine.getCstStatus(cst.id));\n }\n return {\n ...calculateSchemaStats(schema),\n base_elements: items.reduce((sum, cst) => sum + countBaseElements(cst, engine), 0),\n count_missing_base: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.EMPTY && isBasicConcept(cst.cst_type) ? 1 : 0),\n 0\n ),\n count_false_axioms: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.AXIOM_FALSE ? 1 : 0),\n 0\n ),\n count_invalid_data: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.INVALID_DATA ? 1 : 0),\n 0\n ),\n count_invalid_calculations: items.reduce(\n (sum, cst) =>\n sum +\n (statusByID.get(cst.id) === EvalStatus.EVAL_FAIL || statusByID.get(cst.id) === EvalStatus.NOT_PROCESSED\n ? 1\n : 0),\n 0\n ),\n count_empty_terms: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.EMPTY && cst.cst_type === CstType.TERM ? 1 : 0),\n 0\n )\n };\n}\n\n/** Checks whether evaluation status contributes to model status issues. */\nexport function isModelIssue(engine: RSEngine, cst: Constituenta): boolean {\n return modelStatusCstDiagnostic(engine.getCstStatus(cst.id), cst.cst_type) !== null;\n}\n\n/** Evaluate if {@link CstType} is interpretable. */\nexport function isInterpretable(type: CstType): boolean {\n switch (type) {\n case CstType.BASE:\n case CstType.CONSTANT:\n case CstType.STRUCTURED:\n case CstType.AXIOM:\n case CstType.TERM:\n case CstType.STATEMENT:\n return true;\n\n case CstType.NOMINAL:\n case CstType.FUNCTION:\n case CstType.PREDICATE:\n return false;\n }\n}\n\n/** Evaluate if {@link CstType} is inferrable. */\nexport function isInferrable(type: CstType): boolean {\n switch (type) {\n case CstType.AXIOM:\n case CstType.STATEMENT:\n case CstType.TERM:\n return true;\n\n case CstType.NOMINAL:\n case CstType.BASE:\n case CstType.CONSTANT:\n case CstType.STRUCTURED:\n case CstType.FUNCTION:\n case CstType.PREDICATE:\n return false;\n }\n}\n\n/** Infers status of a given {@link Value} and {@link CstType}. */\nexport function inferEvalStatus(\n value: Value | null,\n cstType: CstType,\n wasCalculated: boolean = true,\n isInvalid: boolean = false\n): EvalStatus {\n if (isBaseSet(cstType) || cstType === CstType.STRUCTURED) {\n if (isInvalid) {\n return EvalStatus.INVALID_DATA;\n }\n if (value === null || (Array.isArray(value) && value.length === 0)) {\n return EvalStatus.EMPTY;\n }\n return EvalStatus.HAS_DATA;\n }\n if (!isInferrable(cstType)) {\n return EvalStatus.NO_EVAL;\n }\n if (!wasCalculated) {\n return EvalStatus.NOT_PROCESSED;\n }\n if (value === null) {\n return EvalStatus.EVAL_FAIL;\n }\n if (cstType === CstType.AXIOM && value !== VALUE_TRUE) {\n return EvalStatus.AXIOM_FALSE;\n }\n if (Array.isArray(value) && value.length === 0) {\n return EvalStatus.EMPTY;\n }\n return EvalStatus.HAS_DATA;\n}\n\n/** Tries to fix value removing invalid base elements not present in the target value.\n * returns null if no fixing is possible.\n * returns true if fixing was successful.\n * returns false if fixing was not needed.\n */\nexport function tryFixValue(\n value: Value,\n type: ExpressionType,\n targetAlias: string,\n targetValue: Value[]\n): boolean | null {\n switch (type.typeID) {\n case TypeID.integer:\n return false;\n case TypeID.basic:\n if (type.baseID !== targetAlias) {\n return false;\n }\n if (typeof value !== 'number') {\n return null;\n }\n if (!targetValue.includes(value)) {\n return null;\n }\n return false;\n case TypeID.tuple: {\n if (!isTupleValue(value)) {\n return null;\n }\n let wasChanged = false;\n for (let i = 0; i < type.factors.length; i++) {\n const componentChanged = tryFixValue(value[i + 1], type.factors[i], targetAlias, targetValue);\n if (componentChanged === null) {\n return null;\n }\n if (componentChanged) {\n wasChanged = true;\n }\n }\n return wasChanged;\n }\n case TypeID.collection:\n if (!Array.isArray(value) || (value.length > 1 && value[0] === TUPLE_ID)) {\n return null;\n }\n let wasChanged = false;\n const removeElements: Value[] = [];\n for (const item of value) {\n const elementChanged = tryFixValue(item, type.base, targetAlias, targetValue);\n if (elementChanged === null || elementChanged === true) {\n wasChanged = true;\n if (elementChanged === null) {\n removeElements.push(item);\n }\n }\n }\n for (const item of removeElements) {\n const index = value.indexOf(item);\n if (index !== -1) {\n value.splice(index, 1);\n }\n }\n if (wasChanged) {\n value.sort((a, b) => compare(a, b));\n let i = 1;\n while (i < value.length) {\n if (compare(value[i], value[i - 1]) === 0) {\n value.splice(i, 1);\n } else {\n i++;\n }\n }\n }\n return wasChanged;\n\n case TypeID.logic:\n case TypeID.anyTypification:\n case TypeID.predicate:\n case TypeID.function:\n return null;\n }\n}\n\nexport function updateValueElement(value: Value | null, path: ValuePath, newValue: number): Value | null {\n return setNestedValue(value, path, newValue);\n}\n\nexport function deleteValueElement(\n value: Value | null,\n path: ValuePath,\n type: Typification,\n target: number\n): Value | null {\n if (path.length === 0 && type.typeID !== TypeID.collection) {\n return null;\n }\n\n const arrayValue = extractValue(value!, path)! as Value[];\n const updatedArray = [...arrayValue.slice(0, target), ...arrayValue.slice(target + 1)];\n return setNestedValue(value, path, updatedArray);\n}\n\nexport function addValueElement(\n value: Value | null,\n path: ValuePath,\n type: Typification,\n currentType: Typification\n): Value | null {\n if (path.length === 0 && type.typeID !== TypeID.collection) {\n return makeDefaultValue(type);\n }\n\n const newElem = makeDefaultValue((currentType as EchelonCollection).base);\n const arrayValue = (extractValue(value!, path) as Value[] | null) ?? [];\n const updatedArray = [newElem, ...arrayValue];\n return setNestedValue(value, path, updatedArray);\n}\n\n// ========= Internal functions ==========\n\nfunction countBaseElements(cst: Constituenta, engine: RSEngine): number {\n if (!isBasicConcept(cst.cst_type)) {\n return 0;\n }\n const value = engine.getCstValue(cst.id);\n if (value === null) {\n return 0;\n }\n if (!Array.isArray(value) || value[0] === TUPLE_ID) {\n return 1;\n }\n return value.length;\n}\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,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,OAAO;EACZ,KAAK,OAAO,UACV,OAAO;CACX;AACF;AAEA,SAAgB,mBAAmB,OAAqB,MAAiB,UAAgC;CACvG,OAAO,eAAe,OAAO,MAAM,QAAQ;AAC7C;AAEA,SAAgB,mBACd,OACA,MACA,MACA,QACc;CACd,IAAI,KAAK,WAAW,KAAK,KAAK,WAAW,OAAO,YAC9C,OAAO;CAGT,MAAM,aAAa,aAAa,OAAQ,IAAI;CAE5C,OAAO,eAAe,OAAO,MAAM,CADb,GAAG,WAAW,MAAM,GAAG,MAAM,GAAG,GAAG,WAAW,MAAM,SAAS,CAAC,CACjD,CAAY;AACjD;AAEA,SAAgB,gBACd,OACA,MACA,MACA,aACc;CACd,IAAI,KAAK,WAAW,KAAK,KAAK,WAAW,OAAO,YAC9C,OAAO,iBAAiB,IAAI;CAM9B,OAAO,eAAe,OAAO,MAAM,CAHnB,iBAAkB,YAAkC,IAE9C,GAAS,GADX,aAAa,OAAQ,IAAI,KAAwB,CAAC,CAEnC,CAAY;AACjD;AAIA,SAAS,kBAAkB,KAAmB,QAA0B;CACtE,IAAI,CAAC,eAAe,IAAI,QAAQ,GAC9B,OAAO;CAET,MAAM,QAAQ,OAAO,YAAY,IAAI,EAAE;CACvC,IAAI,UAAU,MACZ,OAAO;CAET,IAAI,CAAC,MAAM,QAAQ,KAAK,KAAK,MAAM,OAAA,MACjC,OAAO;CAET,OAAO,MAAM;AACf"}
|
|
1
|
+
{"version":3,"file":"rsmodel-api.js","names":[],"sources":["../../src/library/rsmodel-api.ts"],"sourcesContent":["import { type ExpressionType, TypeID, type Typification, type Value } from '../rslang';\nimport { compare, tuple, TUPLE_ID, VALUE_TRUE, type ValuePath } from '../rslang/eval/value';\nimport { extractValue, isTupleValue, makeDefaultValue, setNestedValue } from '../rslang/eval/value-api';\nimport { type EchelonCollection } from '../rslang/semantic/typification';\n\nimport { modelStatusCstDiagnostic } from './diagnostics';\nimport { type RSEngine } from './rsengine';\nimport { type Constituenta, CstType, type RSForm } from './rsform';\nimport { calculateSchemaStats, isBaseSet, isBasicConcept } from './rsform-api';\nimport { type BasicBinding, EvalStatus, type RSModelStats } from './rsmodel';\n\nconst RANDOM_INTEGER_MIN = -100;\nconst RANDOM_INTEGER_MAX = 100;\nconst DEFAULT_RANDOM_SET_ELEMENTS_COUNT = 5;\n\n/** Evaluate if parsed data is a basic binding data. */\nexport function validateBasicBindingData(data: unknown): data is Record<string, string> {\n if (!data || typeof data !== 'object' || Array.isArray(data)) {\n return false;\n }\n return Object.entries(data).every(([key, value]) => typeof value === 'string' && Number.isInteger(Number(key)));\n}\n\n/** Convert parsed data to a basic binding. */\nexport function toBasicBinding(data: Record<string | number, string>): BasicBinding {\n const result: BasicBinding = {};\n for (const [k, v] of Object.entries(data)) {\n result[Number(k)] = v;\n }\n return result;\n}\n\n/** Evaluate if parsed data is a {@link Value} data. */\nexport function validateValueData(data: unknown): data is Value {\n if (typeof data === 'number') {\n return Number.isFinite(data);\n }\n if (!Array.isArray(data)) {\n return false;\n }\n return data.every(item => validateValueData(item));\n}\n\nexport function generateRandomValue(\n type: Typification,\n basics: Map<number, BasicBinding>,\n cstByAlias: Map<string, Constituenta>,\n setElementsCount: number = DEFAULT_RANDOM_SET_ELEMENTS_COUNT\n): Value | null {\n switch (type.typeID) {\n case TypeID.integer:\n return Math.floor(Math.random() * (RANDOM_INTEGER_MAX - RANDOM_INTEGER_MIN + 1)) + RANDOM_INTEGER_MIN;\n case TypeID.basic: {\n const cst = cstByAlias.get(type.baseID);\n const binding = cst ? basics.get(cst.id) : undefined;\n const ids = Object.keys(binding ?? {}).map(Number);\n if (ids.length === 0) {\n return null;\n }\n return ids[Math.floor(Math.random() * ids.length)];\n }\n case TypeID.tuple: {\n const factors: Value[] = [];\n for (const factor of type.factors) {\n const sample = generateRandomValue(factor, basics, cstByAlias, setElementsCount);\n if (sample === null) {\n return null;\n }\n factors.push(sample);\n }\n return tuple(factors);\n }\n case TypeID.collection: {\n const result: Value[] = [];\n const randomElementsCount = Math.floor(Math.random() * (setElementsCount + 1));\n for (let i = 0; i < randomElementsCount; i++) {\n const sample = generateRandomValue(type.base, basics, cstByAlias, setElementsCount);\n if (sample === null) {\n return null;\n }\n result.push(sample);\n }\n return result;\n }\n case TypeID.anyTypification:\n return null;\n }\n}\n\n/** Calculate statistics for {@link RSModel}. */\nexport function calculateModelStats(schema: RSForm, engine: RSEngine, _engineGeneration?: number): RSModelStats {\n const items = schema.items;\n const statusByID = new Map<number, EvalStatus>();\n for (const cst of items) {\n statusByID.set(cst.id, engine.getCstStatus(cst.id));\n }\n return {\n ...calculateSchemaStats(schema),\n base_elements: items.reduce((sum, cst) => sum + countBaseElements(cst, engine), 0),\n count_missing_base: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.EMPTY && isBasicConcept(cst.cst_type) ? 1 : 0),\n 0\n ),\n count_false_axioms: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.AXIOM_FALSE ? 1 : 0),\n 0\n ),\n count_invalid_data: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.INVALID_DATA ? 1 : 0),\n 0\n ),\n count_invalid_calculations: items.reduce(\n (sum, cst) =>\n sum +\n (statusByID.get(cst.id) === EvalStatus.EVAL_FAIL || statusByID.get(cst.id) === EvalStatus.NOT_PROCESSED\n ? 1\n : 0),\n 0\n ),\n count_empty_terms: items.reduce(\n (sum, cst) => sum + (statusByID.get(cst.id) === EvalStatus.EMPTY && cst.cst_type === CstType.TERM ? 1 : 0),\n 0\n )\n };\n}\n\n/** Checks whether evaluation status contributes to model status issues. */\nexport function isModelIssue(engine: RSEngine, cst: Constituenta): boolean {\n return modelStatusCstDiagnostic(engine.getCstStatus(cst.id), cst.cst_type) !== null;\n}\n\n/** Evaluate if {@link CstType} is interpretable. */\nexport function isInterpretable(type: CstType): boolean {\n switch (type) {\n case CstType.BASE:\n case CstType.CONSTANT:\n case CstType.STRUCTURED:\n case CstType.AXIOM:\n case CstType.TERM:\n case CstType.STATEMENT:\n return true;\n\n case CstType.NOMINAL:\n case CstType.FUNCTION:\n case CstType.PREDICATE:\n return false;\n }\n}\n\n/** Evaluate if {@link CstType} is inferrable. */\nexport function isInferrable(type: CstType): boolean {\n switch (type) {\n case CstType.AXIOM:\n case CstType.STATEMENT:\n case CstType.TERM:\n return true;\n\n case CstType.NOMINAL:\n case CstType.BASE:\n case CstType.CONSTANT:\n case CstType.STRUCTURED:\n case CstType.FUNCTION:\n case CstType.PREDICATE:\n return false;\n }\n}\n\n/** Infers status of a given {@link Value} and {@link CstType}. */\nexport function inferEvalStatus(\n value: Value | null,\n cstType: CstType,\n wasCalculated: boolean = true,\n isInvalid: boolean = false\n): EvalStatus {\n if (isBaseSet(cstType) || cstType === CstType.STRUCTURED) {\n if (isInvalid) {\n return EvalStatus.INVALID_DATA;\n }\n if (value === null || (Array.isArray(value) && value.length === 0)) {\n return EvalStatus.EMPTY;\n }\n return EvalStatus.HAS_DATA;\n }\n if (!isInferrable(cstType)) {\n return EvalStatus.NO_EVAL;\n }\n if (!wasCalculated) {\n return EvalStatus.NOT_PROCESSED;\n }\n if (value === null) {\n return EvalStatus.EVAL_FAIL;\n }\n if (cstType === CstType.AXIOM && value !== VALUE_TRUE) {\n return EvalStatus.AXIOM_FALSE;\n }\n if (Array.isArray(value) && value.length === 0) {\n return EvalStatus.EMPTY;\n }\n return EvalStatus.HAS_DATA;\n}\n\n/** Tries to fix value removing invalid base elements not present in the target value.\n * returns null if no fixing is possible.\n * returns true if fixing was successful.\n * returns false if fixing was not needed.\n */\nexport function tryFixValue(\n value: Value,\n type: ExpressionType,\n targetAlias: string,\n targetValue: Value[]\n): boolean | null {\n switch (type.typeID) {\n case TypeID.integer:\n return false;\n case TypeID.basic:\n if (type.baseID !== targetAlias) {\n return false;\n }\n if (typeof value !== 'number') {\n return null;\n }\n if (!targetValue.includes(value)) {\n return null;\n }\n return false;\n case TypeID.tuple: {\n if (!isTupleValue(value)) {\n return null;\n }\n let wasChanged = false;\n for (let i = 0; i < type.factors.length; i++) {\n const componentChanged = tryFixValue(value[i + 1], type.factors[i], targetAlias, targetValue);\n if (componentChanged === null) {\n return null;\n }\n if (componentChanged) {\n wasChanged = true;\n }\n }\n return wasChanged;\n }\n case TypeID.collection:\n if (!Array.isArray(value) || (value.length > 1 && value[0] === TUPLE_ID)) {\n return null;\n }\n let wasChanged = false;\n const removeElements: Value[] = [];\n for (const item of value) {\n const elementChanged = tryFixValue(item, type.base, targetAlias, targetValue);\n if (elementChanged === null || elementChanged === true) {\n wasChanged = true;\n if (elementChanged === null) {\n removeElements.push(item);\n }\n }\n }\n for (const item of removeElements) {\n const index = value.indexOf(item);\n if (index !== -1) {\n value.splice(index, 1);\n }\n }\n if (wasChanged) {\n value.sort((a, b) => compare(a, b));\n let i = 1;\n while (i < value.length) {\n if (compare(value[i], value[i - 1]) === 0) {\n value.splice(i, 1);\n } else {\n i++;\n }\n }\n }\n return wasChanged;\n\n case TypeID.logic:\n case TypeID.anyTypification:\n case TypeID.predicate:\n case TypeID.function:\n return null;\n }\n}\n\nexport function updateValueElement(value: Value | null, path: ValuePath, newValue: number): Value | null {\n return setNestedValue(value, path, newValue);\n}\n\nexport function deleteValueElement(\n value: Value | null,\n path: ValuePath,\n type: Typification,\n target: number\n): Value | null {\n if (value === null) {\n return null;\n }\n if (path.length === 0 && type.typeID !== TypeID.collection) {\n return null;\n }\n\n const arrayValue = extractValue(value, path);\n if (!Array.isArray(arrayValue)) {\n return null;\n }\n const updatedArray = [...arrayValue.slice(0, target), ...arrayValue.slice(target + 1)];\n return setNestedValue(value, path, updatedArray);\n}\n\nexport function addValueElement(\n value: Value | null,\n path: ValuePath,\n type: Typification,\n currentType: Typification\n): Value | null {\n if (path.length === 0 && type.typeID !== TypeID.collection) {\n return makeDefaultValue(type);\n }\n\n const newElem = makeDefaultValue((currentType as EchelonCollection).base);\n const arrayValue = (extractValue(value!, path) as Value[] | null) ?? [];\n const updatedArray = [newElem, ...arrayValue];\n return setNestedValue(value, path, updatedArray);\n}\n\n// ========= Internal functions ==========\n\nfunction countBaseElements(cst: Constituenta, engine: RSEngine): number {\n if (!isBasicConcept(cst.cst_type)) {\n return 0;\n }\n const value = engine.getCstValue(cst.id);\n if (value === null) {\n return 0;\n }\n if (!Array.isArray(value) || value[0] === TUPLE_ID) {\n return 1;\n }\n return value.length;\n}\n"],"mappings":";;;;;;;AAWA,MAAM,qBAAqB;AAE3B,MAAM,oCAAoC;;AAG1C,SAAgB,yBAAyB,MAA+C;CACtF,IAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GACzD,OAAO;CAET,OAAO,OAAO,QAAQ,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,WAAW,OAAO,UAAU,YAAY,OAAO,UAAU,OAAO,GAAG,CAAC,CAAC;AAChH;;AAGA,SAAgB,eAAe,MAAqD;CAClF,MAAM,SAAuB,CAAC;CAC9B,KAAK,MAAM,CAAC,GAAG,MAAM,OAAO,QAAQ,IAAI,GACtC,OAAO,OAAO,CAAC,KAAK;CAEtB,OAAO;AACT;;AAGA,SAAgB,kBAAkB,MAA8B;CAC9D,IAAI,OAAO,SAAS,UAClB,OAAO,OAAO,SAAS,IAAI;CAE7B,IAAI,CAAC,MAAM,QAAQ,IAAI,GACrB,OAAO;CAET,OAAO,KAAK,OAAM,SAAQ,kBAAkB,IAAI,CAAC;AACnD;AAEA,SAAgB,oBACd,MACA,QACA,YACA,mBAA2B,mCACb;CACd,QAAQ,KAAK,QAAb;EACE,KAAK,OAAO,SACV,OAAO,KAAK,MAAM,KAAK,OAAO,IAAK,GAA4C,IAAI;EACrF,KAAK,OAAO,OAAO;GACjB,MAAM,MAAM,WAAW,IAAI,KAAK,MAAM;GACtC,MAAM,UAAU,MAAM,OAAO,IAAI,IAAI,EAAE,IAAI;GAC3C,MAAM,MAAM,OAAO,KAAK,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI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AO,MAAM;AACf"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { d as DEFAULT_VALUE_TEXT, f as EvalStatus, h as TYPE_BASIC, l as BasicBinding, m as RSModelStats, p as RSModel, u as BasicsContext } from "../diagnostics-
|
|
1
|
+
import { d as DEFAULT_VALUE_TEXT, f as EvalStatus, h as TYPE_BASIC, l as BasicBinding, m as RSModelStats, p as RSModel, u as BasicsContext } from "../diagnostics-Dac5sJhO.js";
|
|
2
2
|
export { BasicBinding, BasicsContext, DEFAULT_VALUE_TEXT, EvalStatus, RSModel, RSModelStats, TYPE_BASIC };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { b as Typification, y as TypePath } from "../typification-9lNu9R4k.js";
|
|
2
|
-
import { S as RSForm, v as Constituenta } from "../diagnostics-
|
|
2
|
+
import { S as RSForm, v as Constituenta } from "../diagnostics-Dac5sJhO.js";
|
|
3
3
|
|
|
4
4
|
//#region src/library/structure-planner.d.ts
|
|
5
5
|
/** Represents a node in the structure planner. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TypeID, bool, isTypification, makeTypePath } from "../rslang/semantic/typification.js";
|
|
2
2
|
import { labelType } from "../rslang/labels.js";
|
|
3
3
|
import { splitTemplateDefinition } from "../rslang/api.js";
|
|
4
|
-
import "../rslang/index.js";
|
|
5
4
|
import { CstType } from "./rsform.js";
|
|
6
|
-
import
|
|
5
|
+
import "../rslang/index.js";
|
|
6
|
+
import { y as findCstByStructure } from "../diagnostics-CljEzVBV.js";
|
|
7
7
|
//#region src/library/structure-planner.ts
|
|
8
8
|
/** Structure planner for {@link Constituenta}. */
|
|
9
9
|
var StructurePlanner = class {
|
package/dist/rslang/api.d.ts
CHANGED
|
@@ -1,59 +1,3 @@
|
|
|
1
|
-
import { t as AstNode } from "../ast-C8sIpKdL.js";
|
|
2
|
-
import { n as ArgumentsType } from "../arguments-extractor-ngatANBI.js";
|
|
3
1
|
import { t as generateExpressionFromAst } from "../expression-generator-CoucLIkE.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/** Represents alias mapping. */
|
|
7
|
-
type AliasMapping = Record<string, string>;
|
|
8
|
-
/** Whether {@link value} is a single schema global alias (e.g. `X1`, `F42`). */
|
|
9
|
-
declare function isGlobalAlias(value: string): boolean;
|
|
10
|
-
/**
|
|
11
|
-
* Parse a RSLang expression into a normalized AST.
|
|
12
|
-
*
|
|
13
|
-
* Returns `null` for blank input. Parses the original `expression` string so node
|
|
14
|
-
* offsets match the source text (required for slice-based AST walks).
|
|
15
|
-
*/
|
|
16
|
-
declare function parseRSLangExpression(expression: string): AstNode | null;
|
|
17
|
-
/** Extract arguments from AST. */
|
|
18
|
-
declare function extractArguments(ast: AstNode): ArgumentsType[];
|
|
19
|
-
/** Extracts global variable names from a given expression. */
|
|
20
|
-
declare function extractGlobals(expression: string): Set<string>;
|
|
21
|
-
/** Check if expression is simple derivation. */
|
|
22
|
-
declare function isSimpleExpression(text: string): boolean;
|
|
23
|
-
/** Check if expression is set typification. */
|
|
24
|
-
declare function isSetTypification(text: string): boolean;
|
|
25
|
-
/**
|
|
26
|
-
* Splits a string containing a template definition into its head and body parts.
|
|
27
|
-
*
|
|
28
|
-
* A template definition is expected to have the following format: `[head] body`.
|
|
29
|
-
* If the input string does not contain the opening square bracket '[', the entire
|
|
30
|
-
* string is treated as the body, and an empty string is assigned to the head.
|
|
31
|
-
* If the opening bracket is present, the function attempts to find the matching
|
|
32
|
-
* closing bracket ']' to determine the head and body parts.
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* const template = '[header] body content';
|
|
36
|
-
* const result = splitTemplateDefinition(template);
|
|
37
|
-
* // result: `{ head: 'header', body: 'body content' }`
|
|
38
|
-
*/
|
|
39
|
-
declare function splitTemplateDefinition(target: string): {
|
|
40
|
-
head: string;
|
|
41
|
-
body: string;
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Substitutes values for template arguments in a given expression.
|
|
45
|
-
*
|
|
46
|
-
* This function takes an input mathematical expression and a list of argument values.
|
|
47
|
-
* It replaces template argument placeholders in the expression with their corresponding values
|
|
48
|
-
* from the provided arguments.
|
|
49
|
-
*/
|
|
50
|
-
declare function substituteTemplateArgs(expression: string, mapping: AliasMapping): string;
|
|
51
|
-
/** Substitute local parameter aliases in an expression fragment. */
|
|
52
|
-
declare function substituteLocalAliases(expression: string, mapping: AliasMapping): string;
|
|
53
|
-
/** Apply alias mapping. */
|
|
54
|
-
declare function applyAliasMapping(target: string, mapping: AliasMapping): string;
|
|
55
|
-
/** Apply alias typification mapping. */
|
|
56
|
-
declare function applyTypificationMapping(target: string, mapping: AliasMapping): string;
|
|
57
|
-
//#endregion
|
|
58
|
-
export { AliasMapping, applyAliasMapping, applyTypificationMapping, extractArguments, extractGlobals, generateExpressionFromAst, isGlobalAlias, isSetTypification, isSimpleExpression, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs };
|
|
59
|
-
//# sourceMappingURL=api.d.ts.map
|
|
2
|
+
import { a as extractGlobals, c as isSimpleExpression, d as substituteLocalAliases, f as substituteTemplateArgs, i as extractArguments, l as parseRSLangExpression, n as applyAliasMapping, o as isGlobalAlias, r as applyTypificationMapping, s as isSetTypification, t as AliasMapping, u as splitTemplateDefinition } from "../api-Bf0f_uiI.js";
|
|
3
|
+
export { AliasMapping, applyAliasMapping, applyTypificationMapping, extractArguments, extractGlobals, generateExpressionFromAst, isGlobalAlias, isSetTypification, isSimpleExpression, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs };
|
package/dist/rslang/api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { buildTree } from "../parsing/ast.js";
|
|
2
2
|
import "../parsing/index.js";
|
|
3
|
-
import { parser } from "./parser/parser.js";
|
|
4
3
|
import { normalizeAST } from "./parser/normalize.js";
|
|
4
|
+
import { parser } from "./parser/parser.js";
|
|
5
5
|
import { ArgumentsExtractor } from "./semantic/arguments-extractor.js";
|
|
6
6
|
import { generateExpressionFromAst } from "./parser/expression-generator.js";
|
|
7
7
|
//#region src/rslang/api.ts
|
package/dist/rslang/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { TokenID } from "./parser/token.js";
|
|
2
2
|
import { AnyTypificationT, EmptySetT, LogicT, TypeClass, TypeID, makeTypePath } from "./semantic/typification.js";
|
|
3
|
+
import { parser } from "./parser/parser.js";
|
|
3
4
|
import { readErrorAnnotation, readTypeAnnotation } from "./ast-annotations.js";
|
|
4
5
|
import { RSErrorCode } from "./error.js";
|
|
5
6
|
import { C as printValue, u as makeValuePath } from "../value-COprb2Je.js";
|
|
6
7
|
import { RSCalculator } from "./eval/calculator.js";
|
|
7
|
-
import { parser } from "./parser/parser.js";
|
|
8
8
|
import { ValueClass } from "./semantic/value-class.js";
|
|
9
9
|
import { RSLangAnalyzer } from "./semantic/analyzer.js";
|
|
10
10
|
import { applyAsciiTypeSubstitutions, parseTypeText } from "./semantic/typification-parser.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as extractSyntaxErrors } from "../../../syntax-errors-
|
|
1
|
+
import { t as extractSyntaxErrors } from "../../../syntax-errors-BN_bqTaX.js";
|
|
2
2
|
export { extractSyntaxErrors };
|
|
@@ -2,9 +2,9 @@ import { TokenID } from "../parser/token.js";
|
|
|
2
2
|
import { TypeID, basic, bool, constant, debool } from "./typification.js";
|
|
3
3
|
import { labelType } from "../labels.js";
|
|
4
4
|
import { annotateError } from "../ast-annotations.js";
|
|
5
|
-
import { RSErrorCode } from "../error.js";
|
|
6
5
|
import { parseRSLangExpression } from "../api.js";
|
|
7
|
-
import {
|
|
6
|
+
import { RSErrorCode } from "../error.js";
|
|
7
|
+
import { t as extractSyntaxErrors } from "../../syntax-errors-BN_bqTaX.js";
|
|
8
8
|
import { getTypeClass } from "./typification-api.js";
|
|
9
9
|
import { TypeAuditor } from "./type-auditor.js";
|
|
10
10
|
import { ValueClass } from "./value-class.js";
|
|
@@ -2,9 +2,9 @@ import { visitAstDFS } from "./parsing/ast.js";
|
|
|
2
2
|
import "./parsing/index.js";
|
|
3
3
|
import { TokenID } from "./rslang/parser/token.js";
|
|
4
4
|
import { TypeClass } from "./rslang/semantic/typification.js";
|
|
5
|
+
import "./rslang/parser/parser.terms.js";
|
|
5
6
|
import { annotateError } from "./rslang/ast-annotations.js";
|
|
6
7
|
import { RSErrorCode } from "./rslang/error.js";
|
|
7
|
-
import "./rslang/parser/parser.terms.js";
|
|
8
8
|
//#region src/rslang/parser/syntax-errors/context.ts
|
|
9
9
|
/** Skips classifiers that conflict with bracket-level diagnostics. */
|
|
10
10
|
function whenNoBracketErrors(classifier) {
|
|
@@ -722,4 +722,4 @@ function extractInternal(node, expression, collect, hasBracketErrors, options) {
|
|
|
722
722
|
//#endregion
|
|
723
723
|
export { extractSyntaxErrors as t };
|
|
724
724
|
|
|
725
|
-
//# sourceMappingURL=syntax-errors-
|
|
725
|
+
//# sourceMappingURL=syntax-errors-BN_bqTaX.js.map
|