@rsconcept/domain 3.1.1 → 3.2.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/{analyzer-B35QsI3L.d.ts → analyzer-BcPMzR38.d.ts} +2 -2
- package/dist/{api-DgecYHjR.d.ts → api-BRrnB6yd.d.ts} +4 -2
- package/dist/{ast-annotations-DclU1Ser.d.ts → ast-annotations-B0XO6380.d.ts} +2 -2
- package/dist/{calculator-B-1p712X.d.ts → calculator-SVf1trzN.d.ts} +2 -2
- package/dist/cctext/index.js +1 -2
- package/dist/cctext/language-api.d.ts +11 -12
- package/dist/cctext/language.d.ts +13 -14
- package/dist/{diagnostics-D4_B7rt2.d.ts → diagnostics-DC6QECex.d.ts} +3 -3
- package/dist/{error-S1JghCNN.d.ts → error-DBbO_NIg.d.ts} +2 -1
- package/dist/graph/index.js +1 -2
- package/dist/{index-DzvllU3P.d.ts → index-CEOeehqz.d.ts} +5 -5
- package/dist/{index-D-w-bgei.d.ts → index-CEUOBGLn.d.ts} +6 -5
- package/dist/index.d.ts +8 -7
- package/dist/index.js +2 -1
- package/dist/library/diagnostics.d.ts +1 -1
- package/dist/library/diagnostics.js +1 -2
- package/dist/library/folder-tree.d.ts +2 -3
- package/dist/library/index.d.ts +5 -5
- package/dist/library/library-api.d.ts +2 -3
- package/dist/library/oss-api.d.ts +5 -6
- package/dist/library/oss-layout-api.d.ts +4 -5
- package/dist/library/oss.d.ts +16 -16
- package/dist/library/rsengine.d.ts +6 -7
- package/dist/library/rsengine.js +19 -21
- package/dist/library/rsengine.js.map +1 -1
- package/dist/library/rsform-api/index.d.ts +1 -1
- package/dist/library/rsform-api/index.js +1 -2
- package/dist/library/rsform.d.ts +1 -1
- package/dist/library/rsmodel-api.d.ts +17 -18
- package/dist/library/rsmodel.d.ts +1 -1
- package/dist/library/structure-planner.d.ts +4 -5
- package/dist/rslang/api.d.ts +2 -2
- package/dist/rslang/api.js +3 -1
- package/dist/rslang/api.js.map +1 -1
- package/dist/rslang/ast-annotations.d.ts +1 -1
- package/dist/rslang/error.d.ts +1 -1
- package/dist/rslang/error.js +1 -0
- package/dist/rslang/error.js.map +1 -1
- package/dist/rslang/eval/calculator.d.ts +1 -1
- package/dist/rslang/eval/evaluation-cache.d.ts +3 -4
- package/dist/rslang/eval/evaluator.d.ts +3 -4
- package/dist/rslang/eval/value-api.js +1 -2
- package/dist/rslang/eval/value.js +1 -2
- package/dist/rslang/index.d.ts +8 -7
- package/dist/rslang/index.js +2 -1
- package/dist/rslang/labels.d.ts +5 -6
- package/dist/rslang/parser/normalize.d.ts +1 -2
- package/dist/rslang/parser/parser.terms.d.ts +1 -2
- package/dist/rslang/parser/syntax-errors/index.d.ts +3 -4
- package/dist/rslang/parser/syntax-errors/index.js +1 -2
- package/dist/rslang/semantic/analyzer.d.ts +1 -1
- package/dist/rslang/semantic/analyzer.js +1 -1
- package/dist/rslang/semantic/type-auditor.d.ts +2 -3
- package/dist/rslang/semantic/typification-api.d.ts +10 -11
- package/dist/rslang/semantic/value-auditor.d.ts +2 -3
- package/dist/shared/index.js +1 -2
- package/dist/{syntax-errors-BN_bqTaX.js → syntax-errors-WGLQNaNe.js} +19 -4
- package/dist/{syntax-errors-BN_bqTaX.js.map → syntax-errors-WGLQNaNe.js.map} +1 -1
- package/package.json +24 -25
- package/src/index.ts +2 -1
- package/src/library/rsengine.test.ts +164 -0
- package/src/library/rsengine.ts +25 -24
- package/src/rslang/api.ts +3 -0
- package/src/rslang/error.ts +1 -0
- package/src/rslang/index.ts +2 -1
- package/src/rslang/parser/parser.test.ts +38 -0
- package/src/rslang/parser/syntax-errors/README.md +2 -2
- package/src/rslang/parser/syntax-errors/expression-errors.ts +18 -0
- package/src/rslang/parser/syntax-errors/index.ts +11 -4
package/dist/library/rsengine.js
CHANGED
|
@@ -43,8 +43,8 @@ var RSEngine = class {
|
|
|
43
43
|
this.onChangeDefinitions(changedCst);
|
|
44
44
|
}
|
|
45
45
|
if (this.data !== model) {
|
|
46
|
+
this.prepareValues(model);
|
|
46
47
|
this.data = model;
|
|
47
|
-
this.prepareValues();
|
|
48
48
|
}
|
|
49
49
|
this.notifyAll();
|
|
50
50
|
}
|
|
@@ -184,16 +184,13 @@ var RSEngine = class {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
}
|
|
187
|
-
|
|
187
|
+
await this.services.setCstValue({
|
|
188
188
|
itemID: this.modelID,
|
|
189
189
|
data: updateList
|
|
190
|
-
})
|
|
190
|
+
});
|
|
191
|
+
if (resetList.length > 0) await this.services.clearValues({
|
|
191
192
|
itemID: this.modelID,
|
|
192
193
|
data: { items: resetList }
|
|
193
|
-
})]);
|
|
194
|
-
else await this.services.setCstValue({
|
|
195
|
-
itemID: this.modelID,
|
|
196
|
-
data: updateList
|
|
197
194
|
});
|
|
198
195
|
const changed = [...resetList, ...updateList.map((item) => item.target)];
|
|
199
196
|
this.basics.set(cstID, data);
|
|
@@ -303,25 +300,26 @@ var RSEngine = class {
|
|
|
303
300
|
if (fullAnalysis.ast) this.calculator.setAST(cst.alias, fullAnalysis.ast);
|
|
304
301
|
}
|
|
305
302
|
}
|
|
306
|
-
prepareValues() {
|
|
303
|
+
prepareValues(model) {
|
|
307
304
|
this.basics.clear();
|
|
308
305
|
this.invalidData.clear();
|
|
309
306
|
this.calculatedSet.clear();
|
|
310
|
-
for (const item of
|
|
311
|
-
const cst = this.schema
|
|
312
|
-
if (item.type
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
this.calculator.setValue(cst.alias, Object.keys(data).map(Number));
|
|
307
|
+
for (const item of model.items) {
|
|
308
|
+
const cst = this.schema?.cstByID.get(item.id);
|
|
309
|
+
if (!cst || item.type !== "basic") continue;
|
|
310
|
+
if (!isBaseSet(cst.cst_type)) {
|
|
311
|
+
this.invalidData.add(item.id);
|
|
312
|
+
continue;
|
|
317
313
|
}
|
|
314
|
+
const data = item.value;
|
|
315
|
+
this.basics.set(cst.id, data);
|
|
316
|
+
this.calculator.setValue(cst.alias, Object.keys(data).map(Number));
|
|
318
317
|
}
|
|
319
|
-
for (const item of
|
|
320
|
-
const cst = this.schema
|
|
321
|
-
if (item.type
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
}
|
|
318
|
+
for (const item of model.items) {
|
|
319
|
+
const cst = this.schema?.cstByID.get(item.id);
|
|
320
|
+
if (!cst || item.type === "basic") continue;
|
|
321
|
+
this.calculator.setValue(cst.alias, item.value);
|
|
322
|
+
if (!cst.effectiveType || !this.calculator.validate(item.value, cst.effectiveType)) this.invalidData.add(item.id);
|
|
325
323
|
}
|
|
326
324
|
this.setupEmptySets();
|
|
327
325
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rsengine.js","names":[],"sources":["../../src/library/rsengine.ts"],"sourcesContent":["import { type AstNode } from '../parsing';\nimport { type CalculatorEvaluateOptions, type CalculatorResult, RSCalculator, TypeID, type Value } from '../rslang';\nimport { compare } from '../rslang/eval/value';\nimport { normalizeType } from '../rslang/labels';\n\nimport { CstType, type RSForm } from './rsform';\nimport { getAnalysisFor, isBaseSet, isBasicConcept, isFunctional } from './rsform-api';\nimport { type BasicBinding, type BasicsContext, type EvalStatus, type RSModel, TYPE_BASIC } from './rsmodel';\nimport { inferEvalStatus, isInferrable, tryFixValue } from './rsmodel-api';\n\nconst INVALID_TYPE_MARKER = 'INVALID';\n\n/** Services for {@link RSEngine}. */\nexport interface RSEngineServices {\n setCstValue: (args: {\n itemID: number;\n data: { target: number; type: string; data: Value | BasicBinding }[];\n }) => Promise<unknown>;\n clearValues: (args: { itemID: number; data: { items: number[] } }) => Promise<unknown>;\n}\n\n/** Notifications for {@link RSEngine}. */\nexport interface RSEngineNotifications {\n onInvalidSetValue: () => void;\n onCalculationSuccess: (timeSpent: string) => void;\n}\n\n/** Calculation engine for {@link RSModel}. */\nexport class RSEngine {\n public modelID: number;\n public schema: RSForm | null = null;\n public data: RSModel | null = null;\n public calculator = new RSCalculator();\n public basics: BasicsContext = new Map<number, BasicBinding>();\n\n private services: RSEngineServices;\n private notifications: RSEngineNotifications | null;\n private invalidData = new Set<number>();\n private calculatedSet = new Set<number>();\n private valueSubscribers = new Map<number, Set<() => void>>();\n private statusSubscribers = new Map<number, Set<() => void>>();\n private changeSubscribers = new Set<() => void>();\n private changeGeneration = 0;\n private pendingChange = false;\n private coalescedEmitTimeout: ReturnType<typeof setTimeout> | null = null;\n\n constructor(modelID: number, services: RSEngineServices, notifications: RSEngineNotifications | null = null) {\n this.services = services;\n this.notifications = notifications;\n this.modelID = modelID;\n }\n\n /** Updates data for {@link RSEngine}. */\n public loadData(schema: RSForm, model: RSModel): void {\n const oldSchema = this.schema;\n const newSchema = oldSchema !== schema;\n this.schema = schema;\n if (newSchema) {\n const changedCst = this.collectChanged(oldSchema, schema);\n this.prepareAst();\n this.setupEmptySets();\n this.onChangeDefinitions(changedCst);\n }\n if (this.data !== model) {\n this.data = model;\n this.prepareValues();\n }\n this.notifyAll();\n }\n\n /** Updates services for {@link RSEngine}. */\n public updateServices(services: RSEngineServices): void {\n this.services = services;\n }\n\n /** Updates notifications for {@link RSEngine}. */\n public updateNotifications(notifications: RSEngineNotifications | null): void {\n this.notifications = notifications;\n }\n\n /** Gets value of {@link Constituenta}. */\n public getCstValue(cstID: number): Value | null {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst) {\n return null;\n }\n return this.calculator.getValue(cst.alias);\n }\n\n /** Gets status of {@link Constituenta}. */\n public getCstStatus(cstID: number): EvalStatus {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst) {\n return inferEvalStatus(null, CstType.NOMINAL, false);\n }\n const value = this.calculator.getValue(cst.alias);\n return inferEvalStatus(value, cst.cst_type, this.calculatedSet.has(cstID), this.invalidData.has(cstID));\n }\n\n /** Subscribe to value change of {@link Constituenta}. */\n public subscribeValue(cstID: number, callbackFn: () => void): () => void {\n let subs = this.valueSubscribers.get(cstID);\n if (!subs) {\n subs = new Set();\n this.valueSubscribers.set(cstID, subs);\n }\n subs.add(callbackFn);\n return () => {\n const current = this.valueSubscribers.get(cstID);\n if (!current) {\n return;\n }\n current.delete(callbackFn);\n if (current.size === 0) {\n this.valueSubscribers.delete(cstID);\n }\n };\n }\n\n /** Subscribe to status change of {@link Constituenta}. */\n public subscribeStatus(cstID: number, callbackFn: () => void): () => void {\n let subs = this.statusSubscribers.get(cstID);\n if (!subs) {\n subs = new Set();\n this.statusSubscribers.set(cstID, subs);\n }\n subs.add(callbackFn);\n return () => {\n const current = this.statusSubscribers.get(cstID);\n if (!current) {\n return;\n }\n current.delete(callbackFn);\n if (current.size === 0) {\n this.statusSubscribers.delete(cstID);\n }\n };\n }\n\n /**\n * Subscribe to any engine change that can affect evaluation (values, status, or loaded data).\n */\n public subscribeChanges(callbackFn: () => void): () => void {\n this.changeSubscribers.add(callbackFn);\n return () => {\n this.changeSubscribers.delete(callbackFn);\n };\n }\n\n /** Monotonic counter bumped whenever the engine emits a change to {@link RSEngine.subscribeChanges} listeners. */\n public getChangeGeneration(): number {\n return this.changeGeneration;\n }\n\n /**\n * Runs pending {@link RSEngine.subscribeChanges} notifications immediately and clears the coalescing queue.\n * Use after a synchronous batch of engine updates when listeners must observe a bumped {@link getChangeGeneration}\n * in the same turn.\n */\n public flushPendingChanges(): void {\n if (this.coalescedEmitTimeout !== null) {\n clearTimeout(this.coalescedEmitTimeout);\n this.coalescedEmitTimeout = null;\n }\n if (!this.pendingChange) {\n return;\n }\n this.pendingChange = false;\n this.emitChange();\n }\n\n /** Sets value for {@link Constituenta} from {@link Value}. */\n public async setStructureValue(cstID: number, data: Value): Promise<void> {\n const cst = this.schema?.cstByID.get(cstID);\n if (!this.schema || !cst || isInferrable(cst.cst_type)) {\n this.notifications?.onInvalidSetValue();\n return;\n }\n\n const typeStr = cst.effectiveType ? normalizeType(cst.effectiveType) : INVALID_TYPE_MARKER;\n const payload = [{ target: cstID, type: typeStr, data }];\n await this.services.setCstValue({ itemID: this.modelID, data: payload });\n\n if (!cst.effectiveType || !this.calculator.validate(data, cst.effectiveType)) {\n this.invalidData.add(cstID);\n } else {\n this.invalidData.delete(cstID);\n }\n this.calculator.setValue(cst.alias, data);\n this.notifyCst(cstID);\n this.cascadeReset([cstID]);\n }\n\n /** Sets value for {@link Constituenta} from {@link BasicBinding}. */\n public async setBasicValue(cstID: number, data: BasicBinding): Promise<void> {\n const cst = this.schema?.cstByID.get(cstID);\n if (!this.schema || !cst || !isBaseSet(cst.cst_type)) {\n this.notifications?.onInvalidSetValue();\n return;\n }\n const oldValue = this.calculator.getValue(cst.alias);\n const newValue = Object.keys(data).map(Number);\n\n const updateList: Parameters<RSEngineServices['setCstValue']>[0]['data'] = [\n { target: cstID, type: TYPE_BASIC, data }\n ];\n const resetList: number[] = [];\n\n if (oldValue !== null && compare(newValue, oldValue) !== 0) {\n const dependencies = this.schema.graph.expandAllOutputs([cstID]);\n for (const childID of dependencies) {\n const child = this.schema.cstByID.get(childID)!;\n if (child.cst_type === CstType.STRUCTURED && !!child.effectiveType) {\n const value = this.calculator.getValue(child.alias);\n if (value !== null) {\n const fix = tryFixValue(value, child.effectiveType, cst.alias, newValue);\n if (fix === null) {\n resetList.push(childID);\n } else if (fix === true) {\n const typeStr = normalizeType(child.effectiveType);\n updateList.push({ target: childID, type: typeStr, data: [...(value as Value[])] });\n }\n }\n }\n }\n }\n\n if (resetList.length > 0) {\n await Promise.all([\n this.services.setCstValue({ itemID: this.modelID, data: updateList }),\n this.services.clearValues({ itemID: this.modelID, data: { items: resetList } })\n ]);\n } else {\n await this.services.setCstValue({ itemID: this.modelID, data: updateList });\n }\n const changed = [...resetList, ...updateList.map(item => item.target)];\n\n this.basics.set(cstID, data);\n this.calculator.setValue(cst.alias, Object.keys(data).map(Number));\n\n for (const item of resetList) {\n this.calculator.resetValue(this.schema.cstByID.get(item)!.alias);\n this.notifyCst(item);\n }\n for (const updateData of updateList) {\n if (updateData.target !== cstID) {\n this.calculator.setValue(\n this.schema.cstByID.get(updateData.target)!.alias,\n updateData.data as unknown as Value\n );\n this.notifyCst(updateData.target);\n }\n }\n for (const item of changed) {\n this.notifyCst(item);\n }\n this.cascadeReset(changed);\n }\n\n /** Resets value for {@link Constituenta}. */\n public async resetValue(cstID: number): Promise<void> {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst) {\n return;\n }\n await this.services.clearValues({ itemID: this.modelID, data: { items: [cstID] } });\n this.calculator.resetValue(cst.alias);\n this.basics.delete(cstID);\n this.calculatedSet.delete(cstID);\n this.invalidData.delete(cstID);\n this.notifyCst(cstID);\n }\n\n /** Evaluates expression for {@link RSEngine}. */\n public evaluateExpression(expression: string, cstType: CstType): CalculatorResult {\n return getEvaluationFor(expression, cstType, this.schema!, this.calculator);\n }\n\n /** Evaluates AST for {@link RSEngine}. */\n public evaluateAst(ast: AstNode, options?: CalculatorEvaluateOptions): CalculatorResult {\n return this.calculator.evaluateFull(ast, options);\n }\n\n /** Calculates value for {@link Constituenta}. */\n public calculateCst(cstID: number): CalculatorResult {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst || !this.schema) {\n return { value: null, iterations: 0, errors: [], cacheHits: 0 };\n }\n\n if (!this.calculatedSet.has(cstID)) {\n const predecessors = this.schema.graph.expandAllInputs([cstID]);\n this.prepareEvaluation(predecessors);\n }\n const result = getEvaluationFor(cst.definition_formal, cst.cst_type, this.schema, this.calculator);\n\n if (result.value === null) {\n this.calculator.resetValue(cst.alias);\n } else {\n this.calculator.setValue(cst.alias, result.value);\n }\n\n this.calculatedSet.add(cstID);\n this.notifyCst(cstID);\n\n return result;\n }\n\n /** Recalculate model for all inferrable expressions. */\n recalculateAll(): void {\n const start = performance.now();\n this.calculatedSet.clear();\n this.recalculateInternal();\n const end = performance.now();\n const timeSpent = ((end - start) / 1000).toFixed(2);\n this.notifications?.onCalculationSuccess(timeSpent);\n }\n\n /** Notify subscribers about value and status change of {@link Constituenta}. */\n private notifyCst(cstID: number) {\n this.notifyStatus(cstID);\n this.notifyValue(cstID);\n this.scheduleCoalescedEmitChange();\n }\n\n /** Notify all subscribers about value change. */\n private notifyValue(cstID: number) {\n const subs = this.valueSubscribers.get(cstID);\n if (subs) {\n for (const cb of subs) cb();\n }\n }\n\n /** Notify all subscribers about status change. */\n private notifyStatus(cstID: number) {\n const subs = this.statusSubscribers.get(cstID);\n if (subs) {\n for (const cb of subs) cb();\n }\n }\n\n /** Notify all subscribers about value and status change. */\n private notifyAll(): void {\n for (const subs of this.valueSubscribers.values()) {\n for (const cb of subs) cb();\n }\n for (const subs of this.statusSubscribers.values()) {\n for (const cb of subs) cb();\n }\n this.scheduleCoalescedEmitChange();\n }\n\n private scheduleCoalescedEmitChange(): void {\n this.pendingChange = true;\n if (this.coalescedEmitTimeout !== null) {\n return;\n }\n this.coalescedEmitTimeout = setTimeout(\n function runCoalescedEmitChange(this: RSEngine) {\n this.coalescedEmitTimeout = null;\n if (!this.pendingChange) {\n return;\n }\n this.pendingChange = false;\n this.emitChange();\n }.bind(this),\n 0\n );\n }\n\n private emitChange(): void {\n this.changeGeneration += 1;\n for (const cb of this.changeSubscribers) {\n cb();\n }\n }\n\n private prepareAst(): void {\n this.calculator.clearAllAst();\n const functions = this.schema!.items.filter(cst => isFunctional(cst.cst_type) && cst.analysis?.success);\n for (const cst of functions) {\n const fullAnalysis = getAnalysisFor(cst.definition_formal, cst.cst_type, this.schema!);\n if (fullAnalysis.ast) {\n this.calculator.setAST(cst.alias, fullAnalysis.ast);\n }\n }\n }\n\n private prepareValues(): void {\n this.basics.clear();\n this.invalidData.clear();\n this.calculatedSet.clear();\n\n for (const item of this.data!.items) {\n const cst = this.schema!.cstByID.get(item.id)!;\n if (item.type === TYPE_BASIC) {\n if (cst.cst_type !== CstType.BASE && cst.cst_type !== CstType.CONSTANT) {\n throw new Error(`Invalid data for ${cst.alias}`);\n }\n const data = item.value as BasicBinding;\n this.basics.set(cst.id, data);\n this.calculator.setValue(cst.alias, Object.keys(data).map(Number));\n }\n }\n for (const item of this.data!.items) {\n const cst = this.schema!.cstByID.get(item.id)!;\n if (item.type !== TYPE_BASIC) {\n this.calculator.setValue(cst.alias, item.value as Value);\n if (!cst.effectiveType || !this.calculator.validate(item.value as Value, cst.effectiveType)) {\n this.invalidData.add(item.id);\n }\n }\n }\n this.setupEmptySets();\n }\n\n private setupEmptySets(): void {\n for (const cst of this.schema!.items) {\n if (isBasicConcept(cst.cst_type) && this.schema!.analyzer.getType(cst.alias)?.typeID === TypeID.collection) {\n if (this.calculator.getValue(cst.alias) === null) {\n this.calculator.setValue(cst.alias, []);\n }\n }\n }\n }\n\n private collectChanged(previousSchema: RSForm | null, nextSchema: RSForm): number[] {\n if (!previousSchema) {\n return [];\n }\n const changedIDs: number[] = [];\n for (const cst of nextSchema.items) {\n const prev = previousSchema.cstByID.get(cst.id);\n if (prev && (prev.definition_formal !== cst.definition_formal || prev.alias !== cst.alias)) {\n changedIDs.push(cst.id);\n }\n }\n return changedIDs;\n }\n\n private onChangeDefinitions(cstIDs: number[]): void {\n if (!this.schema || cstIDs.length === 0) {\n return;\n }\n for (const cstID of cstIDs) {\n const cst = this.schema.cstByID.get(cstID);\n if (!cst || !isInferrable(cst.cst_type)) {\n continue;\n }\n this.calculatedSet.delete(cstID);\n this.calculator.resetValue(cst.alias);\n this.notifyCst(cstID);\n }\n this.cascadeReset(cstIDs);\n }\n\n private cascadeReset(cstIDs: number[]): void {\n if (!this.schema) {\n return;\n }\n const dependencies = this.schema.graph.expandAllOutputs(cstIDs);\n for (const cstID of dependencies) {\n const cst = this.schema.cstByID.get(cstID);\n if (!cst || !isInferrable(cst.cst_type)) {\n continue;\n }\n this.calculatedSet.delete(cstID);\n this.calculator.resetValue(this.schema.cstByID.get(cstID)!.alias);\n this.notifyCst(cstID);\n }\n }\n\n private prepareEvaluation(dependencies: number[]): void {\n for (const cstID of this.schema!.graph.topologicalOrder()) {\n if (dependencies.includes(cstID)) {\n const cst = this.schema!.cstByID.get(cstID)!;\n if (isInferrable(cst.cst_type)) {\n const value = fastEvaluation(cst.definition_formal, cst.cst_type, this.schema!, this.calculator);\n if (value !== null) {\n this.calculator.setValue(cst.alias, value);\n } else {\n this.calculator.resetValue(cst.alias);\n }\n this.notifyCst(cstID);\n }\n this.calculatedSet.add(cstID);\n }\n }\n }\n\n private recalculateInternal(): void {\n const processedIDs = [];\n for (const cst of this.schema!.cstByID.values()) {\n if (isInferrable(cst.cst_type)) {\n this.calculator.resetValue(cst.alias);\n }\n }\n\n for (const cstID of this.schema!.graph.topologicalOrder()) {\n processedIDs.push(cstID);\n const cst = this.schema!.cstByID.get(cstID)!;\n if (isInferrable(cst.cst_type)) {\n const value = fastEvaluation(cst.definition_formal, cst.cst_type, this.schema!, this.calculator);\n this.calculatedSet.add(cstID);\n if (value !== null) {\n this.calculator.setValue(cst.alias, value);\n }\n }\n }\n this.notifyAll();\n }\n}\n\n// ==== Internal functions ==== /\n\n/** Evaluates expression for {@link Constituenta}, including error handling. */\nfunction getEvaluationFor(\n expression: string,\n cstType: CstType,\n schema: RSForm,\n calculator: RSCalculator\n): CalculatorResult {\n const parse = getAnalysisFor(expression, cstType, schema);\n if (!parse.success || !parse.ast) {\n return {\n value: null,\n iterations: 0,\n cacheHits: 0,\n errors: parse.errors\n };\n }\n const result = calculator.evaluateFull(parse.ast);\n return {\n value: result.value,\n iterations: result.iterations,\n cacheHits: result.cacheHits,\n errors: [...parse.errors, ...result.errors]\n };\n}\n\n/** Evaluates expression for {@link RSModel}. */\nfunction fastEvaluation(expression: string, cstType: CstType, schema: RSForm, calculator: RSCalculator): Value | null {\n const parse = getAnalysisFor(expression, cstType, schema);\n if (!parse.success || !parse.ast) {\n return null;\n }\n return calculator.evaluateFast(parse.ast);\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAM,sBAAsB;;AAkB5B,IAAa,WAAb,MAAsB;CACpB;CACA,SAA+B;CAC/B,OAA8B;CAC9B,aAAoB,IAAI,aAAa;CACrC,yBAA+B,IAAI,IAA0B;CAE7D;CACA;CACA,8BAAsB,IAAI,IAAY;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B,KAAK,WAAW,WAAW,IAAI,KAAK;EAIxC,KAAK,MAAM,SAAS,KAAK,OAAQ,MAAM,iBAAiB,GAAG;GACzD,aAAa,KAAK,KAAK;GACvB,MAAM,MAAM,KAAK,OAAQ,QAAQ,IAAI,KAAK;GAC1C,IAAI,aAAa,IAAI,QAAQ,GAAG;IAC9B,MAAM,QAAQ,eAAe,IAAI,mBAAmB,IAAI,UAAU,KAAK,QAAS,KAAK,UAAU;IAC/F,KAAK,cAAc,IAAI,KAAK;IAC5B,IAAI,UAAU,MACZ,KAAK,WAAW,SAAS,IAAI,OAAO,KAAK;GAE7C;EACF;EACA,KAAK,UAAU;CACjB;AACF;;AAKA,SAAS,iBACP,YACA,SACA,QACA,YACkB;CAClB,MAAM,QAAQ,eAAe,YAAY,SAAS,MAAM;CACxD,IAAI,CAAC,MAAM,WAAW,CAAC,MAAM,KAC3B,OAAO;EACL,OAAO;EACP,YAAY;EACZ,WAAW;EACX,QAAQ,MAAM;CAChB;CAEF,MAAM,SAAS,WAAW,aAAa,MAAM,GAAG;CAChD,OAAO;EACL,OAAO,OAAO;EACd,YAAY,OAAO;EACnB,WAAW,OAAO;EAClB,QAAQ,CAAC,GAAG,MAAM,QAAQ,GAAG,OAAO,MAAM;CAC5C;AACF;;AAGA,SAAS,eAAe,YAAoB,SAAkB,QAAgB,YAAwC;CACpH,MAAM,QAAQ,eAAe,YAAY,SAAS,MAAM;CACxD,IAAI,CAAC,MAAM,WAAW,CAAC,MAAM,KAC3B,OAAO;CAET,OAAO,WAAW,aAAa,MAAM,GAAG;AAC1C"}
|
|
1
|
+
{"version":3,"file":"rsengine.js","names":[],"sources":["../../src/library/rsengine.ts"],"sourcesContent":["import { type AstNode } from '../parsing';\nimport { type CalculatorEvaluateOptions, type CalculatorResult, RSCalculator, TypeID, type Value } from '../rslang';\nimport { compare } from '../rslang/eval/value';\nimport { normalizeType } from '../rslang/labels';\n\nimport { CstType, type RSForm } from './rsform';\nimport { getAnalysisFor, isBaseSet, isBasicConcept, isFunctional } from './rsform-api';\nimport { type BasicBinding, type BasicsContext, type EvalStatus, type RSModel, TYPE_BASIC } from './rsmodel';\nimport { inferEvalStatus, isInferrable, tryFixValue } from './rsmodel-api';\n\nconst INVALID_TYPE_MARKER = 'INVALID';\n\n/** Services for {@link RSEngine}. */\nexport interface RSEngineServices {\n setCstValue: (args: {\n itemID: number;\n data: { target: number; type: string; data: Value | BasicBinding }[];\n }) => Promise<unknown>;\n clearValues: (args: { itemID: number; data: { items: number[] } }) => Promise<unknown>;\n}\n\n/** Notifications for {@link RSEngine}. */\nexport interface RSEngineNotifications {\n onInvalidSetValue: () => void;\n onCalculationSuccess: (timeSpent: string) => void;\n}\n\n/** Calculation engine for {@link RSModel}. */\nexport class RSEngine {\n public modelID: number;\n public schema: RSForm | null = null;\n public data: RSModel | null = null;\n public calculator = new RSCalculator();\n public basics: BasicsContext = new Map<number, BasicBinding>();\n\n private services: RSEngineServices;\n private notifications: RSEngineNotifications | null;\n private invalidData = new Set<number>();\n private calculatedSet = new Set<number>();\n private valueSubscribers = new Map<number, Set<() => void>>();\n private statusSubscribers = new Map<number, Set<() => void>>();\n private changeSubscribers = new Set<() => void>();\n private changeGeneration = 0;\n private pendingChange = false;\n private coalescedEmitTimeout: ReturnType<typeof setTimeout> | null = null;\n\n constructor(modelID: number, services: RSEngineServices, notifications: RSEngineNotifications | null = null) {\n this.services = services;\n this.notifications = notifications;\n this.modelID = modelID;\n }\n\n /** Updates data for {@link RSEngine}. */\n public loadData(schema: RSForm, model: RSModel): void {\n const oldSchema = this.schema;\n const newSchema = oldSchema !== schema;\n this.schema = schema;\n if (newSchema) {\n const changedCst = this.collectChanged(oldSchema, schema);\n this.prepareAst();\n this.setupEmptySets();\n this.onChangeDefinitions(changedCst);\n }\n if (this.data !== model) {\n this.prepareValues(model);\n this.data = model;\n }\n this.notifyAll();\n }\n\n /** Updates services for {@link RSEngine}. */\n public updateServices(services: RSEngineServices): void {\n this.services = services;\n }\n\n /** Updates notifications for {@link RSEngine}. */\n public updateNotifications(notifications: RSEngineNotifications | null): void {\n this.notifications = notifications;\n }\n\n /** Gets value of {@link Constituenta}. */\n public getCstValue(cstID: number): Value | null {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst) {\n return null;\n }\n return this.calculator.getValue(cst.alias);\n }\n\n /** Gets status of {@link Constituenta}. */\n public getCstStatus(cstID: number): EvalStatus {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst) {\n return inferEvalStatus(null, CstType.NOMINAL, false);\n }\n const value = this.calculator.getValue(cst.alias);\n return inferEvalStatus(value, cst.cst_type, this.calculatedSet.has(cstID), this.invalidData.has(cstID));\n }\n\n /** Subscribe to value change of {@link Constituenta}. */\n public subscribeValue(cstID: number, callbackFn: () => void): () => void {\n let subs = this.valueSubscribers.get(cstID);\n if (!subs) {\n subs = new Set();\n this.valueSubscribers.set(cstID, subs);\n }\n subs.add(callbackFn);\n return () => {\n const current = this.valueSubscribers.get(cstID);\n if (!current) {\n return;\n }\n current.delete(callbackFn);\n if (current.size === 0) {\n this.valueSubscribers.delete(cstID);\n }\n };\n }\n\n /** Subscribe to status change of {@link Constituenta}. */\n public subscribeStatus(cstID: number, callbackFn: () => void): () => void {\n let subs = this.statusSubscribers.get(cstID);\n if (!subs) {\n subs = new Set();\n this.statusSubscribers.set(cstID, subs);\n }\n subs.add(callbackFn);\n return () => {\n const current = this.statusSubscribers.get(cstID);\n if (!current) {\n return;\n }\n current.delete(callbackFn);\n if (current.size === 0) {\n this.statusSubscribers.delete(cstID);\n }\n };\n }\n\n /**\n * Subscribe to any engine change that can affect evaluation (values, status, or loaded data).\n */\n public subscribeChanges(callbackFn: () => void): () => void {\n this.changeSubscribers.add(callbackFn);\n return () => {\n this.changeSubscribers.delete(callbackFn);\n };\n }\n\n /** Monotonic counter bumped whenever the engine emits a change to {@link RSEngine.subscribeChanges} listeners. */\n public getChangeGeneration(): number {\n return this.changeGeneration;\n }\n\n /**\n * Runs pending {@link RSEngine.subscribeChanges} notifications immediately and clears the coalescing queue.\n * Use after a synchronous batch of engine updates when listeners must observe a bumped {@link getChangeGeneration}\n * in the same turn.\n */\n public flushPendingChanges(): void {\n if (this.coalescedEmitTimeout !== null) {\n clearTimeout(this.coalescedEmitTimeout);\n this.coalescedEmitTimeout = null;\n }\n if (!this.pendingChange) {\n return;\n }\n this.pendingChange = false;\n this.emitChange();\n }\n\n /** Sets value for {@link Constituenta} from {@link Value}. */\n public async setStructureValue(cstID: number, data: Value): Promise<void> {\n const cst = this.schema?.cstByID.get(cstID);\n if (!this.schema || !cst || isInferrable(cst.cst_type)) {\n this.notifications?.onInvalidSetValue();\n return;\n }\n\n const typeStr = cst.effectiveType ? normalizeType(cst.effectiveType) : INVALID_TYPE_MARKER;\n const payload = [{ target: cstID, type: typeStr, data }];\n await this.services.setCstValue({ itemID: this.modelID, data: payload });\n\n if (!cst.effectiveType || !this.calculator.validate(data, cst.effectiveType)) {\n this.invalidData.add(cstID);\n } else {\n this.invalidData.delete(cstID);\n }\n this.calculator.setValue(cst.alias, data);\n this.notifyCst(cstID);\n this.cascadeReset([cstID]);\n }\n\n /** Sets value for {@link Constituenta} from {@link BasicBinding}. */\n public async setBasicValue(cstID: number, data: BasicBinding): Promise<void> {\n const cst = this.schema?.cstByID.get(cstID);\n if (!this.schema || !cst || !isBaseSet(cst.cst_type)) {\n this.notifications?.onInvalidSetValue();\n return;\n }\n const oldValue = this.calculator.getValue(cst.alias);\n const newValue = Object.keys(data).map(Number);\n\n const updateList: Parameters<RSEngineServices['setCstValue']>[0]['data'] = [\n { target: cstID, type: TYPE_BASIC, data }\n ];\n const resetList: number[] = [];\n\n if (oldValue !== null && compare(newValue, oldValue) !== 0) {\n const dependencies = this.schema.graph.expandAllOutputs([cstID]);\n for (const childID of dependencies) {\n const child = this.schema.cstByID.get(childID)!;\n if (child.cst_type === CstType.STRUCTURED && !!child.effectiveType) {\n const value = this.calculator.getValue(child.alias);\n if (value !== null) {\n const fix = tryFixValue(value, child.effectiveType, cst.alias, newValue);\n if (fix === null) {\n resetList.push(childID);\n } else if (fix === true) {\n const typeStr = normalizeType(child.effectiveType);\n updateList.push({ target: childID, type: typeStr, data: [...(value as Value[])] });\n }\n }\n }\n }\n }\n\n // Sequential writes: both endpoints share the model concurrency token.\n // A parallel pair would send the same expected time_update and the second would 409.\n await this.services.setCstValue({ itemID: this.modelID, data: updateList });\n if (resetList.length > 0) {\n await this.services.clearValues({ itemID: this.modelID, data: { items: resetList } });\n }\n const changed = [...resetList, ...updateList.map(item => item.target)];\n\n this.basics.set(cstID, data);\n this.calculator.setValue(cst.alias, Object.keys(data).map(Number));\n\n for (const item of resetList) {\n this.calculator.resetValue(this.schema.cstByID.get(item)!.alias);\n this.notifyCst(item);\n }\n for (const updateData of updateList) {\n if (updateData.target !== cstID) {\n this.calculator.setValue(\n this.schema.cstByID.get(updateData.target)!.alias,\n updateData.data as unknown as Value\n );\n this.notifyCst(updateData.target);\n }\n }\n for (const item of changed) {\n this.notifyCst(item);\n }\n this.cascadeReset(changed);\n }\n\n /** Resets value for {@link Constituenta}. */\n public async resetValue(cstID: number): Promise<void> {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst) {\n return;\n }\n await this.services.clearValues({ itemID: this.modelID, data: { items: [cstID] } });\n this.calculator.resetValue(cst.alias);\n this.basics.delete(cstID);\n this.calculatedSet.delete(cstID);\n this.invalidData.delete(cstID);\n this.notifyCst(cstID);\n }\n\n /** Evaluates expression for {@link RSEngine}. */\n public evaluateExpression(expression: string, cstType: CstType): CalculatorResult {\n return getEvaluationFor(expression, cstType, this.schema!, this.calculator);\n }\n\n /** Evaluates AST for {@link RSEngine}. */\n public evaluateAst(ast: AstNode, options?: CalculatorEvaluateOptions): CalculatorResult {\n return this.calculator.evaluateFull(ast, options);\n }\n\n /** Calculates value for {@link Constituenta}. */\n public calculateCst(cstID: number): CalculatorResult {\n const cst = this.schema?.cstByID.get(cstID);\n if (!cst || !this.schema) {\n return { value: null, iterations: 0, errors: [], cacheHits: 0 };\n }\n\n if (!this.calculatedSet.has(cstID)) {\n const predecessors = this.schema.graph.expandAllInputs([cstID]);\n this.prepareEvaluation(predecessors);\n }\n const result = getEvaluationFor(cst.definition_formal, cst.cst_type, this.schema, this.calculator);\n\n if (result.value === null) {\n this.calculator.resetValue(cst.alias);\n } else {\n this.calculator.setValue(cst.alias, result.value);\n }\n\n this.calculatedSet.add(cstID);\n this.notifyCst(cstID);\n\n return result;\n }\n\n /** Recalculate model for all inferrable expressions. */\n recalculateAll(): void {\n const start = performance.now();\n this.calculatedSet.clear();\n this.recalculateInternal();\n const end = performance.now();\n const timeSpent = ((end - start) / 1000).toFixed(2);\n this.notifications?.onCalculationSuccess(timeSpent);\n }\n\n /** Notify subscribers about value and status change of {@link Constituenta}. */\n private notifyCst(cstID: number) {\n this.notifyStatus(cstID);\n this.notifyValue(cstID);\n this.scheduleCoalescedEmitChange();\n }\n\n /** Notify all subscribers about value change. */\n private notifyValue(cstID: number) {\n const subs = this.valueSubscribers.get(cstID);\n if (subs) {\n for (const cb of subs) cb();\n }\n }\n\n /** Notify all subscribers about status change. */\n private notifyStatus(cstID: number) {\n const subs = this.statusSubscribers.get(cstID);\n if (subs) {\n for (const cb of subs) cb();\n }\n }\n\n /** Notify all subscribers about value and status change. */\n private notifyAll(): void {\n for (const subs of this.valueSubscribers.values()) {\n for (const cb of subs) cb();\n }\n for (const subs of this.statusSubscribers.values()) {\n for (const cb of subs) cb();\n }\n this.scheduleCoalescedEmitChange();\n }\n\n private scheduleCoalescedEmitChange(): void {\n this.pendingChange = true;\n if (this.coalescedEmitTimeout !== null) {\n return;\n }\n this.coalescedEmitTimeout = setTimeout(\n function runCoalescedEmitChange(this: RSEngine) {\n this.coalescedEmitTimeout = null;\n if (!this.pendingChange) {\n return;\n }\n this.pendingChange = false;\n this.emitChange();\n }.bind(this),\n 0\n );\n }\n\n private emitChange(): void {\n this.changeGeneration += 1;\n for (const cb of this.changeSubscribers) {\n cb();\n }\n }\n\n private prepareAst(): void {\n this.calculator.clearAllAst();\n const functions = this.schema!.items.filter(cst => isFunctional(cst.cst_type) && cst.analysis?.success);\n for (const cst of functions) {\n const fullAnalysis = getAnalysisFor(cst.definition_formal, cst.cst_type, this.schema!);\n if (fullAnalysis.ast) {\n this.calculator.setAST(cst.alias, fullAnalysis.ast);\n }\n }\n }\n\n private prepareValues(model: RSModel): void {\n this.basics.clear();\n this.invalidData.clear();\n this.calculatedSet.clear();\n\n for (const item of model.items) {\n const cst = this.schema?.cstByID.get(item.id);\n if (!cst || item.type !== TYPE_BASIC) {\n continue;\n }\n if (!isBaseSet(cst.cst_type)) {\n this.invalidData.add(item.id);\n continue;\n }\n const data = item.value as BasicBinding;\n this.basics.set(cst.id, data);\n this.calculator.setValue(cst.alias, Object.keys(data).map(Number));\n }\n for (const item of model.items) {\n const cst = this.schema?.cstByID.get(item.id);\n if (!cst || item.type === TYPE_BASIC) {\n continue;\n }\n this.calculator.setValue(cst.alias, item.value as Value);\n if (!cst.effectiveType || !this.calculator.validate(item.value as Value, cst.effectiveType)) {\n this.invalidData.add(item.id);\n }\n }\n this.setupEmptySets();\n }\n\n private setupEmptySets(): void {\n for (const cst of this.schema!.items) {\n if (isBasicConcept(cst.cst_type) && this.schema!.analyzer.getType(cst.alias)?.typeID === TypeID.collection) {\n if (this.calculator.getValue(cst.alias) === null) {\n this.calculator.setValue(cst.alias, []);\n }\n }\n }\n }\n\n private collectChanged(previousSchema: RSForm | null, nextSchema: RSForm): number[] {\n if (!previousSchema) {\n return [];\n }\n const changedIDs: number[] = [];\n for (const cst of nextSchema.items) {\n const prev = previousSchema.cstByID.get(cst.id);\n if (prev && (prev.definition_formal !== cst.definition_formal || prev.alias !== cst.alias)) {\n changedIDs.push(cst.id);\n }\n }\n return changedIDs;\n }\n\n private onChangeDefinitions(cstIDs: number[]): void {\n if (!this.schema || cstIDs.length === 0) {\n return;\n }\n for (const cstID of cstIDs) {\n const cst = this.schema.cstByID.get(cstID);\n if (!cst || !isInferrable(cst.cst_type)) {\n continue;\n }\n this.calculatedSet.delete(cstID);\n this.calculator.resetValue(cst.alias);\n this.notifyCst(cstID);\n }\n this.cascadeReset(cstIDs);\n }\n\n private cascadeReset(cstIDs: number[]): void {\n if (!this.schema) {\n return;\n }\n const dependencies = this.schema.graph.expandAllOutputs(cstIDs);\n for (const cstID of dependencies) {\n const cst = this.schema.cstByID.get(cstID);\n if (!cst || !isInferrable(cst.cst_type)) {\n continue;\n }\n this.calculatedSet.delete(cstID);\n this.calculator.resetValue(this.schema.cstByID.get(cstID)!.alias);\n this.notifyCst(cstID);\n }\n }\n\n private prepareEvaluation(dependencies: number[]): void {\n for (const cstID of this.schema!.graph.topologicalOrder()) {\n if (dependencies.includes(cstID)) {\n const cst = this.schema!.cstByID.get(cstID)!;\n if (isInferrable(cst.cst_type)) {\n const value = fastEvaluation(cst.definition_formal, cst.cst_type, this.schema!, this.calculator);\n if (value !== null) {\n this.calculator.setValue(cst.alias, value);\n } else {\n this.calculator.resetValue(cst.alias);\n }\n this.notifyCst(cstID);\n }\n this.calculatedSet.add(cstID);\n }\n }\n }\n\n private recalculateInternal(): void {\n const processedIDs = [];\n for (const cst of this.schema!.cstByID.values()) {\n if (isInferrable(cst.cst_type)) {\n this.calculator.resetValue(cst.alias);\n }\n }\n\n for (const cstID of this.schema!.graph.topologicalOrder()) {\n processedIDs.push(cstID);\n const cst = this.schema!.cstByID.get(cstID)!;\n if (isInferrable(cst.cst_type)) {\n const value = fastEvaluation(cst.definition_formal, cst.cst_type, this.schema!, this.calculator);\n this.calculatedSet.add(cstID);\n if (value !== null) {\n this.calculator.setValue(cst.alias, value);\n }\n }\n }\n this.notifyAll();\n }\n}\n\n// ==== Internal functions ==== /\n\n/** Evaluates expression for {@link Constituenta}, including error handling. */\nfunction getEvaluationFor(\n expression: string,\n cstType: CstType,\n schema: RSForm,\n calculator: RSCalculator\n): CalculatorResult {\n const parse = getAnalysisFor(expression, cstType, schema);\n if (!parse.success || !parse.ast) {\n return {\n value: null,\n iterations: 0,\n cacheHits: 0,\n errors: parse.errors\n };\n }\n const result = calculator.evaluateFull(parse.ast);\n return {\n value: result.value,\n iterations: result.iterations,\n cacheHits: result.cacheHits,\n errors: [...parse.errors, ...result.errors]\n };\n}\n\n/** Evaluates expression for {@link RSModel}. */\nfunction fastEvaluation(expression: string, cstType: CstType, schema: RSForm, calculator: RSCalculator): Value | null {\n const parse = getAnalysisFor(expression, cstType, schema);\n if (!parse.success || !parse.ast) {\n return null;\n }\n return calculator.evaluateFast(parse.ast);\n}\n"],"mappings":";;;;;;;;;;AAUA,MAAM,sBAAsB;;AAkB5B,IAAa,WAAb,MAAsB;CACpB;CACA,SAA+B;CAC/B,OAA8B;CAC9B,aAAoB,IAAI,aAAa;CACrC,yBAA+B,IAAI,IAA0B;CAE7D;CACA;CACA,8BAAsB,IAAI,IAAY;CACtC,gCAAwB,IAAI,IAAY;CACxC,mCAA2B,IAAI,IAA6B;CAC5D,oCAA4B,IAAI,IAA6B;CAC7D,oCAA4B,IAAI,IAAgB;CAChD,mBAA2B;CAC3B,gBAAwB;CACxB,uBAAqE;CAErE,YAAY,SAAiB,UAA4B,gBAA8C,MAAM;EAC3G,KAAK,WAAW;EAChB,KAAK,gBAAgB;EACrB,KAAK,UAAU;CACjB;;CAGA,SAAgB,QAAgB,OAAsB;EACpD,MAAM,YAAY,KAAK;EACvB,MAAM,YAAY,cAAc;EAChC,KAAK,SAAS;EACd,IAAI,WAAW;GACb,MAAM,aAAa,KAAK,eAAe,WAAW,MAAM;GACxD,KAAK,WAAW;GAChB,KAAK,eAAe;GACpB,KAAK,oBAAoB,UAAU;EACrC;EACA,IAAI,KAAK,SAAS,OAAO;GACvB,KAAK,cAAc,KAAK;GACxB,KAAK,OAAO;EACd;EACA,KAAK,UAAU;CACjB;;CAGA,eAAsB,UAAkC;EACtD,KAAK,WAAW;CAClB;;CAGA,oBAA2B,eAAmD;EAC5E,KAAK,gBAAgB;CACvB;;CAGA,YAAmB,OAA6B;EAC9C,M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B,SAAkB,QAAgB,YAAwC;CACpH,MAAM,QAAQ,eAAe,YAAY,SAAS,MAAM;CACxD,IAAI,CAAC,MAAM,WAAW,CAAC,MAAM,KAC3B,OAAO;CAET,OAAO,WAAW,aAAa,MAAM,GAAG;AAC1C"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as removeAliasReference, A as canProduceStructure, B as filterAttributions, C as restoreConstituentOrder, D as inferTemplatedType, E as inferTemplate, F as isBasicConcept, G as MappableFields, H as remapAttributionsUnderSubstitution, I as isFunctional, J as applyMappingToConstituents, K as addAliasReference, L as isLogical, M as guessCstType, N as inferClass, O as normalizeExpression, P as isBaseSet, Q as maxAliasIndex, R as isTemplateCst, S as buildFormalDependencyGraph, T as inferStatus, U as getAnalysisFor, V as importAttributions, W as refineAnalysisForDependencyCycles, X as buildSequentialAliasMapping, Y as argumentValuesToMapping, Z as generateAlias, _ as findCstByStructure, a as buildDefinitionReferenceGraph, at as DiagnosticSourceFields, b as calculateSchemaStats, c as resolveConstituentTextChange, ct as SchemaIssueFields, d as SynthesizableFields, dt as SpawnPathFields, et as validateAliasFormat, f as inlineSynthesis, ft as StructureCapableFields, g as remapSubstitutionsAfterImport, h as applyConstituentSubstitutions, ht as TextResolvableFields, i as TextChangeOptions, it as DescribableFields, j as getCstTypePrefix, k as canHaveManualTypification, l as InlineSynthesisInput, lt as SearchableFields, m as SubstitutionResult, mt as TemplateSourceFields, n as moveIdsInOrder, nt as AliasTypedFields, o as buildTermReferenceGraph, ot as FormalOrderFields, p as sortItemsForInlineSynthesis, pt as TemplateParamSourceFields, q as allocateImportAliases, r as reorderItemsByIds, rt as BasicTextCheckFields, s as resolveAllConstituentTexts, st as ModelEvalFields, t as insertItemAfter, tt as validateNewAlias, u as InlineSynthesisResult, ut as SemanticRelations, v as getStructureName, w as applyFilterCategory, x as isSchemaIssue, y as inferNewSpawnPosition, z as typeClassForCstType } from "../../index-
|
|
1
|
+
import { $ as removeAliasReference, A as canProduceStructure, B as filterAttributions, C as restoreConstituentOrder, D as inferTemplatedType, E as inferTemplate, F as isBasicConcept, G as MappableFields, H as remapAttributionsUnderSubstitution, I as isFunctional, J as applyMappingToConstituents, K as addAliasReference, L as isLogical, M as guessCstType, N as inferClass, O as normalizeExpression, P as isBaseSet, Q as maxAliasIndex, R as isTemplateCst, S as buildFormalDependencyGraph, T as inferStatus, U as getAnalysisFor, V as importAttributions, W as refineAnalysisForDependencyCycles, X as buildSequentialAliasMapping, Y as argumentValuesToMapping, Z as generateAlias, _ as findCstByStructure, a as buildDefinitionReferenceGraph, at as DiagnosticSourceFields, b as calculateSchemaStats, c as resolveConstituentTextChange, ct as SchemaIssueFields, d as SynthesizableFields, dt as SpawnPathFields, et as validateAliasFormat, f as inlineSynthesis, ft as StructureCapableFields, g as remapSubstitutionsAfterImport, h as applyConstituentSubstitutions, ht as TextResolvableFields, i as TextChangeOptions, it as DescribableFields, j as getCstTypePrefix, k as canHaveManualTypification, l as InlineSynthesisInput, lt as SearchableFields, m as SubstitutionResult, mt as TemplateSourceFields, n as moveIdsInOrder, nt as AliasTypedFields, o as buildTermReferenceGraph, ot as FormalOrderFields, p as sortItemsForInlineSynthesis, pt as TemplateParamSourceFields, q as allocateImportAliases, r as reorderItemsByIds, rt as BasicTextCheckFields, s as resolveAllConstituentTexts, st as ModelEvalFields, t as insertItemAfter, tt as validateNewAlias, u as InlineSynthesisResult, ut as SemanticRelations, v as getStructureName, w as applyFilterCategory, x as isSchemaIssue, y as inferNewSpawnPosition, z as typeClassForCstType } from "../../index-CEOeehqz.js";
|
|
2
2
|
export { type AliasTypedFields, type BasicTextCheckFields, type DescribableFields, type DiagnosticSourceFields, type FormalOrderFields, type InlineSynthesisInput, type InlineSynthesisResult, type MappableFields, type ModelEvalFields, type SchemaIssueFields, type SearchableFields, type SemanticRelations, type SpawnPathFields, type StructureCapableFields, type SubstitutionResult, type SynthesizableFields, type TemplateParamSourceFields, type TemplateSourceFields, type TextChangeOptions, type TextResolvableFields, 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 };
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
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 };
|
|
1
|
+
export { I as addAliasReference, L as allocateImportAliases, _ as applyConstituentSubstitutions, E as applyFilterCategory, R as applyMappingToConstituents, z as argumentValuesToMapping, p as buildDefinitionReferenceGraph, w as buildFormalDependencyGraph, B as buildSequentialAliasMapping, m as buildTermReferenceGraph, S as calculateSchemaStats, K as canHaveManualTypification, q as canProduceStructure, j as filterAttributions, y as findCstByStructure, V as generateAlias, P as getAnalysisFor, J as getCstTypePrefix, b as getStructureName, Y as guessCstType, M as importAttributions, X as inferClass, x as inferNewSpawnPosition, D as inferStatus, O as inferTemplate, k as inferTemplatedType, d as inlineSynthesis, c as insertItemAfter, Z as isBaseSet, Q as isBasicConcept, $ as isFunctional, et as isLogical, C as isSchemaIssue, tt as isTemplateCst, H as maxAliasIndex, l as moveIdsInOrder, A as normalizeExpression, F as refineAnalysisForDependencyCycles, N as remapAttributionsUnderSubstitution, v as remapSubstitutionsAfterImport, U as removeAliasReference, u as reorderItemsByIds, h as resolveAllConstituentTexts, g as resolveConstituentTextChange, T as restoreConstituentOrder, f as sortItemsForInlineSynthesis, nt as typeClassForCstType, W as validateAliasFormat, G as validateNewAlias } from "../../diagnostics-D_4TpAH4.js";
|
package/dist/library/rsform.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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-DC6QECex.js";
|
|
2
2
|
export { ArgumentValue, Attribution, Constituenta, CstClass, CstStatus, CstType, RSForm, RSFormStats, Substitution, TermForm, TypeInfo };
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
import { b as Typification, f as ExpressionType } from "../typification-hWUoWCba.js";
|
|
2
2
|
import { d as ValuePath, l as Value } from "../value-XpJOVzMP.js";
|
|
3
|
-
import "../index-
|
|
4
|
-
import { S as RSForm, f as EvalStatus, l as BasicBinding, m as RSModelStats, x as CstType } from "../diagnostics-
|
|
3
|
+
import "../index-CEUOBGLn.js";
|
|
4
|
+
import { S as RSForm, f as EvalStatus, l as BasicBinding, m as RSModelStats, x as CstType } from "../diagnostics-DC6QECex.js";
|
|
5
5
|
import { RSEngine } from "./rsengine.js";
|
|
6
|
-
import { st as ModelEvalFields } from "../index-
|
|
6
|
+
import { st as ModelEvalFields } from "../index-CEOeehqz.js";
|
|
7
7
|
//#region src/library/rsmodel-api.d.ts
|
|
8
8
|
/** Evaluate if parsed data is a basic binding data. */
|
|
9
|
-
declare function validateBasicBindingData(data: unknown): data is Record<string, string>;
|
|
9
|
+
export declare function validateBasicBindingData(data: unknown): data is Record<string, string>;
|
|
10
10
|
/** Convert parsed data to a basic binding. */
|
|
11
|
-
declare function toBasicBinding(data: Record<string | number, string>): BasicBinding;
|
|
11
|
+
export declare function toBasicBinding(data: Record<string | number, string>): BasicBinding;
|
|
12
12
|
/** Evaluate if parsed data is a {@link Value} data. */
|
|
13
|
-
declare function validateValueData(data: unknown): data is Value;
|
|
14
|
-
declare function generateRandomValue(type: Typification, basics: Map<number, BasicBinding>, cstByAlias: Map<string, {
|
|
13
|
+
export declare function validateValueData(data: unknown): data is Value;
|
|
14
|
+
export declare function generateRandomValue(type: Typification, basics: Map<number, BasicBinding>, cstByAlias: Map<string, {
|
|
15
15
|
id: number;
|
|
16
16
|
}>, setElementsCount?: number): Value | null;
|
|
17
17
|
/** Calculate statistics for {@link RSModel}. */
|
|
18
|
-
declare function calculateModelStats(schema: RSForm, engine: RSEngine, _engineGeneration?: number): RSModelStats;
|
|
18
|
+
export declare function calculateModelStats(schema: RSForm, engine: RSEngine, _engineGeneration?: number): RSModelStats;
|
|
19
19
|
/** Checks whether evaluation status contributes to model status issues. */
|
|
20
|
-
declare function isModelIssue(engine: RSEngine, cst: ModelEvalFields): boolean;
|
|
20
|
+
export declare function isModelIssue(engine: RSEngine, cst: ModelEvalFields): boolean;
|
|
21
21
|
/** Filters items whose evaluation status contributes to model issues. */
|
|
22
|
-
declare function getEvalIssueItems(items: readonly ModelEvalFields[], engine: RSEngine): ModelEvalFields[];
|
|
22
|
+
export declare function getEvalIssueItems(items: readonly ModelEvalFields[], engine: RSEngine): ModelEvalFields[];
|
|
23
23
|
/** Evaluate if {@link CstType} is interpretable. */
|
|
24
|
-
declare function isInterpretable(type: CstType): boolean;
|
|
24
|
+
export declare function isInterpretable(type: CstType): boolean;
|
|
25
25
|
/** Evaluate if {@link CstType} is inferrable. */
|
|
26
|
-
declare function isInferrable(type: CstType): boolean;
|
|
26
|
+
export declare function isInferrable(type: CstType): boolean;
|
|
27
27
|
/** Infers status of a given {@link Value} and {@link CstType}. */
|
|
28
|
-
declare function inferEvalStatus(value: Value | null, cstType: CstType, wasCalculated?: boolean, isInvalid?: boolean): EvalStatus;
|
|
28
|
+
export declare function inferEvalStatus(value: Value | null, cstType: CstType, wasCalculated?: boolean, isInvalid?: boolean): EvalStatus;
|
|
29
29
|
/** Tries to fix value removing invalid base elements not present in the target value.
|
|
30
30
|
* returns null if no fixing is possible.
|
|
31
31
|
* returns true if fixing was successful.
|
|
32
32
|
* returns false if fixing was not needed.
|
|
33
33
|
*/
|
|
34
|
-
declare function tryFixValue(value: Value, type: ExpressionType, targetAlias: string, targetValue: Value[]): boolean | null;
|
|
35
|
-
declare function updateValueElement(value: Value | null, path: ValuePath, newValue: number): Value | null;
|
|
36
|
-
declare function deleteValueElement(value: Value | null, path: ValuePath, type: Typification, target: number): Value | null;
|
|
37
|
-
declare function addValueElement(value: Value | null, path: ValuePath, type: Typification, currentType: Typification): Value | null;
|
|
34
|
+
export declare function tryFixValue(value: Value, type: ExpressionType, targetAlias: string, targetValue: Value[]): boolean | null;
|
|
35
|
+
export declare function updateValueElement(value: Value | null, path: ValuePath, newValue: number): Value | null;
|
|
36
|
+
export declare function deleteValueElement(value: Value | null, path: ValuePath, type: Typification, target: number): Value | null;
|
|
37
|
+
export declare function addValueElement(value: Value | null, path: ValuePath, type: Typification, currentType: Typification): Value | null;
|
|
38
38
|
//#endregion
|
|
39
|
-
export { addValueElement, calculateModelStats, deleteValueElement, generateRandomValue, getEvalIssueItems, inferEvalStatus, isInferrable, isInterpretable, isModelIssue, toBasicBinding, tryFixValue, updateValueElement, validateBasicBindingData, validateValueData };
|
|
40
39
|
//# sourceMappingURL=rsmodel-api.d.ts.map
|
|
@@ -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-DC6QECex.js";
|
|
2
2
|
export { BasicBinding, BasicsContext, DEFAULT_VALUE_TEXT, EvalStatus, RSModel, RSModelStats, TYPE_BASIC };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { b as Typification, y as TypePath } from "../typification-hWUoWCba.js";
|
|
2
|
-
import "../index-
|
|
3
|
-
import { S as RSForm, v as Constituenta } from "../diagnostics-
|
|
2
|
+
import "../index-CEUOBGLn.js";
|
|
3
|
+
import { S as RSForm, v as Constituenta } from "../diagnostics-DC6QECex.js";
|
|
4
4
|
//#region src/library/structure-planner.d.ts
|
|
5
5
|
/** Represents a node in the structure planner. */
|
|
6
|
-
interface SPNode {
|
|
6
|
+
export interface SPNode {
|
|
7
7
|
key: string;
|
|
8
8
|
path: TypePath;
|
|
9
9
|
type: Typification;
|
|
@@ -12,7 +12,7 @@ interface SPNode {
|
|
|
12
12
|
existing: Constituenta | null;
|
|
13
13
|
}
|
|
14
14
|
/** Structure planner for {@link Constituenta}. */
|
|
15
|
-
declare class StructurePlanner {
|
|
15
|
+
export declare class StructurePlanner {
|
|
16
16
|
private items;
|
|
17
17
|
private schema;
|
|
18
18
|
private target;
|
|
@@ -23,5 +23,4 @@ declare class StructurePlanner {
|
|
|
23
23
|
private pushNode;
|
|
24
24
|
}
|
|
25
25
|
//#endregion
|
|
26
|
-
export { SPNode, StructurePlanner };
|
|
27
26
|
//# sourceMappingURL=structure-planner.d.ts.map
|
package/dist/rslang/api.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as generateExpressionFromAst } from "../expression-generator-CADzBw-C.js";
|
|
2
|
-
import { a as
|
|
3
|
-
export { AliasMapping, applyAliasMapping, applyTypificationMapping, extractArguments, extractGlobals, generateExpressionFromAst, isGlobalAlias, isSetTypification, isSimpleExpression, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs };
|
|
2
|
+
import { a as extractArguments, c as isSetTypification, d as splitTemplateDefinition, f as substituteLocalAliases, i as applyTypificationMapping, l as isSimpleExpression, n as DELETED_ALIAS, o as extractGlobals, p as substituteTemplateArgs, r as applyAliasMapping, s as isGlobalAlias, t as AliasMapping, u as parseRSLangExpression } from "../api-BRrnB6yd.js";
|
|
3
|
+
export { AliasMapping, DELETED_ALIAS, applyAliasMapping, applyTypificationMapping, extractArguments, extractGlobals, generateExpressionFromAst, isGlobalAlias, isSetTypification, isSimpleExpression, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs };
|
package/dist/rslang/api.js
CHANGED
|
@@ -8,6 +8,8 @@ import { generateExpressionFromAst } from "./parser/expression-generator.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Module: API for RSLanguage.
|
|
10
10
|
*/
|
|
11
|
+
/** Placeholder alias written into expressions in place of references to deleted constituents. */
|
|
12
|
+
const DELETED_ALIAS = "DEL";
|
|
11
13
|
const LOCALS_REGEXP = /[_a-zα-ω][a-zα-ω]*\d*/g;
|
|
12
14
|
const GLOBAL_ALIAS_SOURCE = "[XCSADFPTN]\\d+";
|
|
13
15
|
const GLOBALS_REGEXP = new RegExp(GLOBAL_ALIAS_SOURCE, "g");
|
|
@@ -160,6 +162,6 @@ function applyPattern(text, mapping, pattern) {
|
|
|
160
162
|
return output;
|
|
161
163
|
}
|
|
162
164
|
//#endregion
|
|
163
|
-
export { applyAliasMapping, applyTypificationMapping, extractArguments, extractGlobals, generateExpressionFromAst, isGlobalAlias, isSetTypification, isSimpleExpression, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs };
|
|
165
|
+
export { DELETED_ALIAS, applyAliasMapping, applyTypificationMapping, extractArguments, extractGlobals, generateExpressionFromAst, isGlobalAlias, isSetTypification, isSimpleExpression, parseRSLangExpression, splitTemplateDefinition, substituteLocalAliases, substituteTemplateArgs };
|
|
164
166
|
|
|
165
167
|
//# sourceMappingURL=api.js.map
|
package/dist/rslang/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","names":["rslangParser"],"sources":["../../src/rslang/api.ts"],"sourcesContent":["/**\n * Module: API for RSLanguage.\n */\nimport { type AstNode, buildTree } from '../parsing';\n\nimport { normalizeAST } from './parser/normalize';\nimport { parser as rslangParser } from './parser/parser';\nimport { ArgumentsExtractor, type ArgumentsType } from './semantic/arguments-extractor';\nexport { generateExpressionFromAst } from './parser/expression-generator';\n\n/** Represents alias mapping. */\nexport type AliasMapping = Record<string, string>;\n\n// cspell:disable\nconst LOCALS_REGEXP = /[_a-zα-ω][a-zα-ω]*\\d*/g;\nconst GLOBAL_ALIAS_SOURCE = '[XCSADFPTN]\\\\d+';\nconst GLOBALS_REGEXP = new RegExp(GLOBAL_ALIAS_SOURCE, 'g');\nconst GLOBAL_ALIAS_ANCHORED_REGEXP = new RegExp(`^${GLOBAL_ALIAS_SOURCE}$`);\nconst COMPLEX_SYMBOLS_REGEXP = /[∀∃×ℬ;|:]/g;\nconst TYPIFICATION_SET = /^ℬ+\\([ℬ\\(((X|C)\\d+|Z)\\)×]*\\)$/g;\n// cspell:enable\n\n/** Whether {@link value} is a single schema global alias (e.g. `X1`, `F42`). */\nexport function isGlobalAlias(value: string): boolean {\n return GLOBAL_ALIAS_ANCHORED_REGEXP.test(value);\n}\n\n/**\n * Parse a RSLang expression into a normalized AST.\n *\n * Returns `null` for blank input. Parses the original `expression` string so node\n * offsets match the source text (required for slice-based AST walks).\n */\nexport function parseRSLangExpression(expression: string): AstNode | null {\n if (!expression.trim()) {\n return null;\n }\n const tree = rslangParser.parse(expression);\n const ast = buildTree(tree.cursor());\n normalizeAST(ast, expression);\n return ast;\n}\n\n/** Extract arguments from AST. */\nexport function extractArguments(ast: AstNode): ArgumentsType[] {\n return new ArgumentsExtractor().run(ast);\n}\n\n/** Extracts global variable names from a given expression. */\nexport function extractGlobals(expression: string): Set<string> {\n return new Set(expression.match(GLOBALS_REGEXP) ?? []);\n}\n\n/** Check if expression is simple derivation. */\nexport function isSimpleExpression(text: string): boolean {\n return !text.match(COMPLEX_SYMBOLS_REGEXP);\n}\n\n/** Check if expression is set typification. */\nexport function isSetTypification(text: string): boolean {\n return !!text.match(TYPIFICATION_SET);\n}\n\n/**\n * Splits a string containing a template definition into its head and body parts.\n *\n * A template definition is expected to have the following format: `[head] body`.\n * If the input string does not contain the opening square bracket '[', the entire\n * string is treated as the body, and an empty string is assigned to the head.\n * If the opening bracket is present, the function attempts to find the matching\n * closing bracket ']' to determine the head and body parts.\n *\n * @example\n * const template = '[header] body content';\n * const result = splitTemplateDefinition(template);\n * // result: `{ head: 'header', body: 'body content' }`\n */\nexport function splitTemplateDefinition(target: string) {\n let start = 0;\n for (; start < target.length && target[start] !== '['; ++start);\n if (start < target.length) {\n for (let counter = 0, end = start + 1; end < target.length; ++end) {\n if (target[end] === '[') {\n ++counter;\n } else if (target[end] === ']') {\n if (counter !== 0) {\n --counter;\n } else {\n return {\n head: target.substring(start + 1, end).trim(),\n body: target.substring(end + 1).trim()\n };\n }\n }\n }\n }\n return {\n head: '',\n body: target\n };\n}\n\n/**\n * Substitutes values for template arguments in a given expression.\n *\n * This function takes an input mathematical expression and a list of argument values.\n * It replaces template argument placeholders in the expression with their corresponding values\n * from the provided arguments.\n */\nexport function substituteTemplateArgs(expression: string, mapping: AliasMapping): string {\n if (Object.keys(mapping).length === 0) {\n return expression;\n }\n let { head, body } = splitTemplateDefinition(expression);\n body = applyPattern(body, mapping, LOCALS_REGEXP);\n const argTexts = head.split(',').map(text => text.trim());\n head = argTexts\n .filter(arg => [...arg.matchAll(LOCALS_REGEXP)].every(local => local.every(match => !(match in mapping))))\n .join(', ');\n\n if (!head) {\n return body;\n } else {\n return `[${head}] ${body}`;\n }\n}\n\n/** Substitute local parameter aliases in an expression fragment. */\nexport function substituteLocalAliases(expression: string, mapping: AliasMapping): string {\n return applyPattern(expression, mapping, LOCALS_REGEXP);\n}\n\n/** Apply alias mapping. */\nexport function applyAliasMapping(target: string, mapping: AliasMapping): string {\n return applyPattern(target, mapping, GLOBALS_REGEXP);\n}\n\n/** Apply alias typification mapping. */\nexport function applyTypificationMapping(target: string, mapping: AliasMapping): string {\n const modified = applyAliasMapping(target, mapping);\n if (modified === target) {\n return target;\n }\n\n const deleteBrackets: number[] = [];\n const positions: number[] = [];\n const booleans: number[] = [];\n let boolCount: number = 0;\n let stackSize: number = 0;\n\n for (let i = 0; i < modified.length; i++) {\n const char = modified[i];\n if (char === 'ℬ') {\n boolCount++;\n continue;\n }\n if (char === '(') {\n stackSize++;\n positions.push(i);\n booleans.push(boolCount);\n }\n boolCount = 0;\n if (char === ')') {\n if (\n i < modified.length - 1 &&\n modified[i + 1] === ')' &&\n stackSize > 1 &&\n positions[stackSize - 2] + booleans[stackSize - 1] + 1 === positions[stackSize - 1]\n ) {\n deleteBrackets.push(i);\n deleteBrackets.push(positions[stackSize - 2]);\n }\n if (i === modified.length - 1 && stackSize === 1 && positions[0] === 0) {\n deleteBrackets.push(i);\n deleteBrackets.push(positions[0]);\n }\n stackSize--;\n positions.pop();\n booleans.pop();\n }\n }\n\n let result = '';\n for (let i = 0; i < modified.length; i++) {\n if (!deleteBrackets.includes(i)) {\n result += modified[i];\n }\n }\n\n return result;\n}\n\n// ====== Internals =========\n/** Text substitution guided by mapping and regular expression. */\nfunction applyPattern(text: string, mapping: AliasMapping, pattern: RegExp): string {\n if (text === '' || pattern === null) {\n return text;\n }\n let posInput = 0;\n let output = '';\n const patternMatches = text.matchAll(pattern);\n for (const segment of patternMatches) {\n const entity = segment[0];\n const start = segment.index ?? 0;\n if (entity in mapping) {\n output += text.substring(posInput, start);\n output += mapping[entity];\n posInput = start + segment[0].length;\n }\n }\n output += text.substring(posInput);\n return output;\n}\n"],"mappings":";;;;;;;;;;AAcA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB,IAAI,OAAO,qBAAqB,GAAG;AAC1D,MAAM,+BAA+B,IAAI,OAAO,IAAI,oBAAoB,EAAE;AAC1E,MAAM,yBAAyB;AAC/B,MAAM,mBAAmB;;AAIzB,SAAgB,cAAc,OAAwB;CACpD,OAAO,6BAA6B,KAAK,KAAK;AAChD;;;;;;;AAQA,SAAgB,sBAAsB,YAAoC;CACxE,IAAI,CAAC,WAAW,KAAK,GACnB,OAAO;CAET,MAAM,OAAOA,OAAa,MAAM,UAAU;CAC1C,MAAM,MAAM,UAAU,KAAK,OAAO,CAAC;CACnC,aAAa,KAAK,UAAU;CAC5B,OAAO;AACT;;AAGA,SAAgB,iBAAiB,KAA+B;CAC9D,OAAO,IAAI,mBAAmB,CAAC,CAAC,IAAI,GAAG;AACzC;;AAGA,SAAgB,eAAe,YAAiC;CAC9D,OAAO,IAAI,IAAI,WAAW,MAAM,cAAc,KAAK,CAAC,CAAC;AACvD;;AAGA,SAAgB,mBAAmB,MAAuB;CACxD,OAAO,CAAC,KAAK,MAAM,sBAAsB;AAC3C;;AAGA,SAAgB,kBAAkB,MAAuB;CACvD,OAAO,CAAC,CAAC,KAAK,MAAM,gBAAgB;AACtC;;;;;;;;;;;;;;;AAgBA,SAAgB,wBAAwB,QAAgB;CACtD,IAAI,QAAQ;CACZ,OAAO,QAAQ,OAA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+
{"version":3,"file":"api.js","names":["rslangParser"],"sources":["../../src/rslang/api.ts"],"sourcesContent":["/**\n * Module: API for RSLanguage.\n */\nimport { type AstNode, buildTree } from '../parsing';\n\nimport { normalizeAST } from './parser/normalize';\nimport { parser as rslangParser } from './parser/parser';\nimport { ArgumentsExtractor, type ArgumentsType } from './semantic/arguments-extractor';\nexport { generateExpressionFromAst } from './parser/expression-generator';\n\n/** Placeholder alias written into expressions in place of references to deleted constituents. */\nexport const DELETED_ALIAS = 'DEL';\n\n/** Represents alias mapping. */\nexport type AliasMapping = Record<string, string>;\n\n// cspell:disable\nconst LOCALS_REGEXP = /[_a-zα-ω][a-zα-ω]*\\d*/g;\nconst GLOBAL_ALIAS_SOURCE = '[XCSADFPTN]\\\\d+';\nconst GLOBALS_REGEXP = new RegExp(GLOBAL_ALIAS_SOURCE, 'g');\nconst GLOBAL_ALIAS_ANCHORED_REGEXP = new RegExp(`^${GLOBAL_ALIAS_SOURCE}$`);\nconst COMPLEX_SYMBOLS_REGEXP = /[∀∃×ℬ;|:]/g;\nconst TYPIFICATION_SET = /^ℬ+\\([ℬ\\(((X|C)\\d+|Z)\\)×]*\\)$/g;\n// cspell:enable\n\n/** Whether {@link value} is a single schema global alias (e.g. `X1`, `F42`). */\nexport function isGlobalAlias(value: string): boolean {\n return GLOBAL_ALIAS_ANCHORED_REGEXP.test(value);\n}\n\n/**\n * Parse a RSLang expression into a normalized AST.\n *\n * Returns `null` for blank input. Parses the original `expression` string so node\n * offsets match the source text (required for slice-based AST walks).\n */\nexport function parseRSLangExpression(expression: string): AstNode | null {\n if (!expression.trim()) {\n return null;\n }\n const tree = rslangParser.parse(expression);\n const ast = buildTree(tree.cursor());\n normalizeAST(ast, expression);\n return ast;\n}\n\n/** Extract arguments from AST. */\nexport function extractArguments(ast: AstNode): ArgumentsType[] {\n return new ArgumentsExtractor().run(ast);\n}\n\n/** Extracts global variable names from a given expression. */\nexport function extractGlobals(expression: string): Set<string> {\n return new Set(expression.match(GLOBALS_REGEXP) ?? []);\n}\n\n/** Check if expression is simple derivation. */\nexport function isSimpleExpression(text: string): boolean {\n return !text.match(COMPLEX_SYMBOLS_REGEXP);\n}\n\n/** Check if expression is set typification. */\nexport function isSetTypification(text: string): boolean {\n return !!text.match(TYPIFICATION_SET);\n}\n\n/**\n * Splits a string containing a template definition into its head and body parts.\n *\n * A template definition is expected to have the following format: `[head] body`.\n * If the input string does not contain the opening square bracket '[', the entire\n * string is treated as the body, and an empty string is assigned to the head.\n * If the opening bracket is present, the function attempts to find the matching\n * closing bracket ']' to determine the head and body parts.\n *\n * @example\n * const template = '[header] body content';\n * const result = splitTemplateDefinition(template);\n * // result: `{ head: 'header', body: 'body content' }`\n */\nexport function splitTemplateDefinition(target: string) {\n let start = 0;\n for (; start < target.length && target[start] !== '['; ++start);\n if (start < target.length) {\n for (let counter = 0, end = start + 1; end < target.length; ++end) {\n if (target[end] === '[') {\n ++counter;\n } else if (target[end] === ']') {\n if (counter !== 0) {\n --counter;\n } else {\n return {\n head: target.substring(start + 1, end).trim(),\n body: target.substring(end + 1).trim()\n };\n }\n }\n }\n }\n return {\n head: '',\n body: target\n };\n}\n\n/**\n * Substitutes values for template arguments in a given expression.\n *\n * This function takes an input mathematical expression and a list of argument values.\n * It replaces template argument placeholders in the expression with their corresponding values\n * from the provided arguments.\n */\nexport function substituteTemplateArgs(expression: string, mapping: AliasMapping): string {\n if (Object.keys(mapping).length === 0) {\n return expression;\n }\n let { head, body } = splitTemplateDefinition(expression);\n body = applyPattern(body, mapping, LOCALS_REGEXP);\n const argTexts = head.split(',').map(text => text.trim());\n head = argTexts\n .filter(arg => [...arg.matchAll(LOCALS_REGEXP)].every(local => local.every(match => !(match in mapping))))\n .join(', ');\n\n if (!head) {\n return body;\n } else {\n return `[${head}] ${body}`;\n }\n}\n\n/** Substitute local parameter aliases in an expression fragment. */\nexport function substituteLocalAliases(expression: string, mapping: AliasMapping): string {\n return applyPattern(expression, mapping, LOCALS_REGEXP);\n}\n\n/** Apply alias mapping. */\nexport function applyAliasMapping(target: string, mapping: AliasMapping): string {\n return applyPattern(target, mapping, GLOBALS_REGEXP);\n}\n\n/** Apply alias typification mapping. */\nexport function applyTypificationMapping(target: string, mapping: AliasMapping): string {\n const modified = applyAliasMapping(target, mapping);\n if (modified === target) {\n return target;\n }\n\n const deleteBrackets: number[] = [];\n const positions: number[] = [];\n const booleans: number[] = [];\n let boolCount: number = 0;\n let stackSize: number = 0;\n\n for (let i = 0; i < modified.length; i++) {\n const char = modified[i];\n if (char === 'ℬ') {\n boolCount++;\n continue;\n }\n if (char === '(') {\n stackSize++;\n positions.push(i);\n booleans.push(boolCount);\n }\n boolCount = 0;\n if (char === ')') {\n if (\n i < modified.length - 1 &&\n modified[i + 1] === ')' &&\n stackSize > 1 &&\n positions[stackSize - 2] + booleans[stackSize - 1] + 1 === positions[stackSize - 1]\n ) {\n deleteBrackets.push(i);\n deleteBrackets.push(positions[stackSize - 2]);\n }\n if (i === modified.length - 1 && stackSize === 1 && positions[0] === 0) {\n deleteBrackets.push(i);\n deleteBrackets.push(positions[0]);\n }\n stackSize--;\n positions.pop();\n booleans.pop();\n }\n }\n\n let result = '';\n for (let i = 0; i < modified.length; i++) {\n if (!deleteBrackets.includes(i)) {\n result += modified[i];\n }\n }\n\n return result;\n}\n\n// ====== Internals =========\n/** Text substitution guided by mapping and regular expression. */\nfunction applyPattern(text: string, mapping: AliasMapping, pattern: RegExp): string {\n if (text === '' || pattern === null) {\n return text;\n }\n let posInput = 0;\n let output = '';\n const patternMatches = text.matchAll(pattern);\n for (const segment of patternMatches) {\n const entity = segment[0];\n const start = segment.index ?? 0;\n if (entity in mapping) {\n output += text.substring(posInput, start);\n output += mapping[entity];\n posInput = start + segment[0].length;\n }\n }\n output += text.substring(posInput);\n return output;\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,gBAAgB;AAM7B,MAAM,gBAAgB;AACtB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB,IAAI,OAAO,qBAA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KAAK,CAAC;IACrB,eAAe,KAAK,UAAU,YAAY,EAAE;GAC9C;GACA,IAAI,MAAM,SAAS,SAAS,KAAK,cAAc,KAAK,UAAU,OAAO,GAAG;IACtE,eAAe,KAAK,CAAC;IACrB,eAAe,KAAK,UAAU,EAAE;GAClC;GACA;GACA,UAAU,IAAI;GACd,SAAS,IAAI;EACf;CACF;CAEA,IAAI,SAAS;CACb,KAAK,IAAI,IAAI,GAAG,IAAI,SAAS,QAAQ,KACnC,IAAI,CAAC,eAAe,SAAS,CAAC,GAC5B,UAAU,SAAS;CAIvB,OAAO;AACT;;AAIA,SAAS,aAAa,MAAc,SAAuB,SAAyB;CAClF,IAAI,SAAS,MAAM,YAAY,MAC7B,OAAO;CAET,IAAI,WAAW;CACf,IAAI,SAAS;CACb,MAAM,iBAAiB,KAAK,SAAS,OAAO;CAC5C,KAAK,MAAM,WAAW,gBAAgB;EACpC,MAAM,SAAS,QAAQ;EACvB,MAAM,QAAQ,QAAQ,SAAS;EAC/B,IAAI,UAAU,SAAS;GACrB,UAAU,KAAK,UAAU,UAAU,KAAK;GACxC,UAAU,QAAQ;GAClB,WAAW,QAAQ,QAAQ,EAAE,CAAC;EAChC;CACF;CACA,UAAU,KAAK,UAAU,QAAQ;CACjC,OAAO;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as readTypeAnnotation, n as annotateType, r as readErrorAnnotation, t as annotateError } from "../ast-annotations-
|
|
1
|
+
import { i as readTypeAnnotation, n as annotateType, r as readErrorAnnotation, t as annotateError } from "../ast-annotations-B0XO6380.js";
|
|
2
2
|
export { annotateError, annotateType, readErrorAnnotation, readTypeAnnotation };
|
package/dist/rslang/error.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RSErrorDescription, c as getRSErrorPrefix, i as RSErrorCode, l as isCritical, n as EvalStackFrame, o as RSErrorInfo, r as RSErrorClass, s as formatEvalCallStack, t as ErrorReporter } from "../error-
|
|
1
|
+
import { a as RSErrorDescription, c as getRSErrorPrefix, i as RSErrorCode, l as isCritical, n as EvalStackFrame, o as RSErrorInfo, r as RSErrorClass, s as formatEvalCallStack, t as ErrorReporter } from "../error-DBbO_NIg.js";
|
|
2
2
|
export { ErrorReporter, EvalStackFrame, RSErrorClass, RSErrorCode, RSErrorDescription, RSErrorInfo, formatEvalCallStack, getRSErrorPrefix, isCritical };
|
package/dist/rslang/error.js
CHANGED
package/dist/rslang/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","names":[],"sources":["../../src/rslang/error.ts"],"sourcesContent":["/** Module: Error types and functions. */\n\n/** Represents error class. */\nexport const RSErrorClass = {\n LEXER: 0,\n PARSER: 1,\n SEMANTIC: 2,\n EVALUATION: 3,\n UNKNOWN: 4\n} as const;\nexport type RSErrorClass = (typeof RSErrorClass)[keyof typeof RSErrorClass];\n\n/** Represents RSLang expression error information. */\nexport interface RSErrorInfo {\n code: RSErrorCode;\n params?: readonly string[];\n}\n\n/**\n * One frame of an evaluation call chain.\n *\n * Spans are relative to the formal definition of {@link alias}.\n * Frames are ordered innermost-first: fault locus, then each caller outward.\n * The root expression under evaluation is not a frame — its highlight is\n * {@link RSErrorDescription.from}/{@link RSErrorDescription.to}; {@link RSErrorDescription.stack}\n * is absent when the fault is in that root expression.\n */\nexport interface EvalStackFrame {\n /** Constituent whose formal definition contains this span. */\n alias: string;\n /** Half-open span `[from, to)` in that definition. */\n from: number;\n to: number;\n}\n\n/** Represents RSLang expression error description. */\nexport interface RSErrorDescription extends RSErrorInfo {\n from: number;\n to: number;\n /**\n * Evaluation call chain when the fault is inside a called `F#`/`P#` body.\n * Absent for parse/semantic errors and for evaluation errors in the root expression.\n */\n stack?: readonly EvalStackFrame[];\n}\n\n/** Error reporter function type. */\nexport type ErrorReporter = (error: RSErrorDescription) => void;\n\n/**\n * Formats an evaluation call chain for display (`F5 → F12`).\n *\n * Uses callee aliases from outermost call to innermost fault container.\n * Returns an empty string when there is no nested call to show.\n */\nexport function formatEvalCallStack(stack: readonly EvalStackFrame[] | undefined): string {\n if (!stack || stack.length === 0) {\n return '';\n }\n const aliases: string[] = [];\n for (let index = stack.length - 1; index >= 0; index--) {\n const frame = stack[index];\n if (frame) {\n aliases.push(frame.alias);\n }\n }\n return aliases.join(' → ');\n}\n\n/** Represents RSLang expression error types. */\nexport const RSErrorCode = {\n unknownSyntax: 0x8400, // 33792\n forbiddenCharacter: 0x8401, // 33793\n bracketMismatch: 0x8409, // 33801\n doubleParenthesis: 0x840a, // 33802\n missingOpenBracket: 0x840b, // 33803\n missingCloseBracket: 0x840c, // 33804\n invalidFilterSyntax: 0x8417, // 33815\n expectedFunctionBody: 0x8418, // 33816\n expectedExpressionBody: 0x8419, // 33817\n expectedLogicBody: 0x841a, // 33818\n expectedQuantifierBody: 0x841b, // 33819\n expectedDeclarativeBody: 0x841c, // 33820\n expectedImperativeBody: 0x841d, // 33821\n expectedRecursiveBody: 0x841e, // 33822\n expectedQuantifierDomain: 0x841f, // 33823\n expectedRightOperand: 0x8420, // 33824\n expectedUnaryOperand: 0x8421, // 33825\n globalFuncParenCall: 0x8422, // 33826\n expectedArgument: 0x8423, // 33827\n expectedLocal: 0x8415, // 33813\n expectedType: 0x8416, // 33814\n\n localNotUsed: 0x2802, // 10242\n\n localUndeclared: 0x8801, // 34817\n localShadowing: 0x8802, // 34818\n localDoubleDeclare: 0x8803, // 34819\n\n typesNotEqual: 0x880a, // 34826\n globalNotTyped: 0x8804, // 34820\n invalidDecart: 0x8805, // 34821\n invalidBoolean: 0x8806, // 34822\n invalidTypeOperation: 0x8807, // 34823\n invalidCard: 0x8808, // 34824\n invalidDebool: 0x8809, // 34825\n globalFuncWithoutArgs: 0x880b, // 34827\n invalidReduce: 0x8810, // 34832\n invalidEnumeration: 0x8813, // 34835\n projectionSetArgumentNotSet: 0x8830, // 34864\n projectionSetArgumentNotTupleSet: 0x8831, // 34865\n projectionSetIndexOutOfRange: 0x8832, // 34866\n projectionTupleArgumentNotTuple: 0x8833, // 34867\n projectionTupleIndexOutOfRange: 0x8834, // 34868\n invalidCortegeDeclare: 0x8814, // 34836\n localOutOfScope: 0x8815, // 34837\n invalidElementPredicate: 0x8816, // 34838\n invalidEmptySetUsage: 0x8817, // 34839\n invalidArgsArity: 0x8818, // 34840\n invalidArgumentType: 0x8819, // 34841\n globalStructure: 0x881c, // 34844\n radicalUsage: 0x8821, // 34849\n invalidFilterArgumentType: 0x8822, // 34850\n invalidFilterArity: 0x8823, // 34851\n arithmeticNotSupported: 0x8824, // 34852\n typesNotCompatible: 0x8825, // 34853\n orderingNotSupported: 0x8826, // 34854\n expectedLogic: 0x8827, // 34855\n expectedSetexpr: 0x8828, // 34856\n invalidArgumentCortegeDeclare: 0x8829, // 34857\n invalidQuantifierDomain: 0x882a, // 34858\n invalidFilterParameterType: 0x882b, // 34859\n invalidFilterIndex: 0x882c, // 34860\n invalidFilterBooleanEchelon: 0x882d, // 34861\n localOutOfScopeParentheses: 0x882e, // 34862\n localUndeclaredInSubexpr: 0x882f, // 34863\n\n globalNoValue: 0x8840, // 34880\n invalidPropertyUsage: 0x8841, // 34881\n\n // Value evaluation (runtime)\n calcUnknownError: 0x8100, // 35328\n setOverflow: 0x8101, // 35329\n booleanBaseLimit: 0x8102, // 35330\n calcGlobalMissing: 0x8103, // 35331\n iterationsLimit: 0x8104, // 35332\n calcInvalidDebool: 0x8105, // 35333\n iterateInfinity: 0x8106, // 35334\n calculationNotSupported: 0x8107, // 35335\n calcInvalidData: 0x8108, // 35336\n\n cstEmptyDerived: 0x8861, // 34913\n definitionNotAllowed: 0x8862, // 34914\n\n // Schema diagnostics surfaced in expression analysis (same value as RSDiagnosticCode.schemaDependencyCycle).\n schemaDependencyCycle: 0x8906 // 35078\n} as const;\nexport type RSErrorCode = (typeof RSErrorCode)[keyof typeof RSErrorCode];\n\nconst ERROR_EVALUATION_MASK = 0x0100;\nconst ERROR_LEXER_MASK = 0x0200;\nconst ERROR_PARSER_MASK = 0x0400;\nconst ERROR_SEMANTIC_MASK = 0x0800;\n\n/** Infers error class from error type (code). */\nfunction inferErrorClass(error: RSErrorCode): RSErrorClass {\n if ((error & ERROR_EVALUATION_MASK) !== 0) {\n return RSErrorClass.EVALUATION;\n } else if ((error & ERROR_LEXER_MASK) !== 0) {\n return RSErrorClass.LEXER;\n } else if ((error & ERROR_PARSER_MASK) !== 0) {\n return RSErrorClass.PARSER;\n } else if ((error & ERROR_SEMANTIC_MASK) !== 0) {\n return RSErrorClass.SEMANTIC;\n } else {\n return RSErrorClass.UNKNOWN;\n }\n}\n\n/** Generate ErrorID label. */\nexport function getRSErrorPrefix(code: RSErrorCode): string {\n const id = code.toString(16).toUpperCase();\n // prettier-ignore\n switch (inferErrorClass(code)) {\n case RSErrorClass.LEXER: return 'L' + id;\n case RSErrorClass.PARSER: return 'P' + id;\n case RSErrorClass.SEMANTIC: return 'S' + id;\n case RSErrorClass.EVALUATION: return 'E' + id;\n case RSErrorClass.UNKNOWN: return 'U' + id;\n }\n}\n\n/** Checks if error is critical. */\nexport function isCritical(code: RSErrorCode): boolean {\n if ((code & 0xf000) === 0x2000) {\n return false;\n }\n return true;\n}\n"],"mappings":";;;AAGA,MAAa,eAAe;CAC1B,OAAO;CACP,QAAQ;CACR,UAAU;CACV,YAAY;CACZ,SAAS;AACX;;;;;;;AA8CA,SAAgB,oBAAoB,OAAsD;CACxF,IAAI,CAAC,SAAS,MAAM,WAAW,GAC7B,OAAO;CAET,MAAM,UAAoB,CAAC;CAC3B,KAAK,IAAI,QAAQ,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS;EACtD,MAAM,QAAQ,MAAM;EACpB,IAAI,OACF,QAAQ,KAAK,MAAM,KAAK;CAE5B;CACA,OAAO,QAAQ,KAAK,KAAK;AAC3B;;AAGA,MAAa,cAAc;CACzB,eAAe;CACf,oBAAoB;CACpB,iBAAiB;CACjB,mBAAmB;CACnB,oBAAoB;CACpB,qBAAqB;CACrB,qBAAqB;CACrB,sBA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,yBAAyB,GAC3C,OAAO,aAAa;MAEpB,OAAO,aAAa;AAExB;;AAGA,SAAgB,iBAAiB,MAA2B;CAC1D,MAAM,KAAK,KAAK,SAAS,EAAE,CAAC,CAAC,YAAY;CAEzC,QAAQ,gBAAgB,IAAI,GAA5B;EACE,KAAK,aAAa,OAAO,OAAO,MAAM;EACtC,KAAK,aAAa,QAAQ,OAAO,MAAM;EACvC,KAAK,aAAa,UAAU,OAAO,MAAM;EACzC,KAAK,aAAa,YAAY,OAAO,MAAM;EAC3C,KAAK,aAAa,SAAS,OAAO,MAAM;CAC1C;AACF;;AAGA,SAAgB,WAAW,MAA4B;CACrD,KAAK,OAAO,WAAY,MACtB,OAAO;CAET,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"error.js","names":[],"sources":["../../src/rslang/error.ts"],"sourcesContent":["/** Module: Error types and functions. */\n\n/** Represents error class. */\nexport const RSErrorClass = {\n LEXER: 0,\n PARSER: 1,\n SEMANTIC: 2,\n EVALUATION: 3,\n UNKNOWN: 4\n} as const;\nexport type RSErrorClass = (typeof RSErrorClass)[keyof typeof RSErrorClass];\n\n/** Represents RSLang expression error information. */\nexport interface RSErrorInfo {\n code: RSErrorCode;\n params?: readonly string[];\n}\n\n/**\n * One frame of an evaluation call chain.\n *\n * Spans are relative to the formal definition of {@link alias}.\n * Frames are ordered innermost-first: fault locus, then each caller outward.\n * The root expression under evaluation is not a frame — its highlight is\n * {@link RSErrorDescription.from}/{@link RSErrorDescription.to}; {@link RSErrorDescription.stack}\n * is absent when the fault is in that root expression.\n */\nexport interface EvalStackFrame {\n /** Constituent whose formal definition contains this span. */\n alias: string;\n /** Half-open span `[from, to)` in that definition. */\n from: number;\n to: number;\n}\n\n/** Represents RSLang expression error description. */\nexport interface RSErrorDescription extends RSErrorInfo {\n from: number;\n to: number;\n /**\n * Evaluation call chain when the fault is inside a called `F#`/`P#` body.\n * Absent for parse/semantic errors and for evaluation errors in the root expression.\n */\n stack?: readonly EvalStackFrame[];\n}\n\n/** Error reporter function type. */\nexport type ErrorReporter = (error: RSErrorDescription) => void;\n\n/**\n * Formats an evaluation call chain for display (`F5 → F12`).\n *\n * Uses callee aliases from outermost call to innermost fault container.\n * Returns an empty string when there is no nested call to show.\n */\nexport function formatEvalCallStack(stack: readonly EvalStackFrame[] | undefined): string {\n if (!stack || stack.length === 0) {\n return '';\n }\n const aliases: string[] = [];\n for (let index = stack.length - 1; index >= 0; index--) {\n const frame = stack[index];\n if (frame) {\n aliases.push(frame.alias);\n }\n }\n return aliases.join(' → ');\n}\n\n/** Represents RSLang expression error types. */\nexport const RSErrorCode = {\n unknownSyntax: 0x8400, // 33792\n forbiddenCharacter: 0x8401, // 33793\n bracketMismatch: 0x8409, // 33801\n doubleParenthesis: 0x840a, // 33802\n missingOpenBracket: 0x840b, // 33803\n missingCloseBracket: 0x840c, // 33804\n invalidFilterSyntax: 0x8417, // 33815\n expectedFunctionBody: 0x8418, // 33816\n expectedExpressionBody: 0x8419, // 33817\n expectedLogicBody: 0x841a, // 33818\n expectedQuantifierBody: 0x841b, // 33819\n expectedDeclarativeBody: 0x841c, // 33820\n expectedImperativeBody: 0x841d, // 33821\n expectedRecursiveBody: 0x841e, // 33822\n expectedQuantifierDomain: 0x841f, // 33823\n expectedRightOperand: 0x8420, // 33824\n expectedUnaryOperand: 0x8421, // 33825\n globalFuncParenCall: 0x8422, // 33826\n expectedArgument: 0x8423, // 33827\n expectedLocal: 0x8415, // 33813\n expectedType: 0x8416, // 33814\n\n localNotUsed: 0x2802, // 10242\n\n localUndeclared: 0x8801, // 34817\n localShadowing: 0x8802, // 34818\n localDoubleDeclare: 0x8803, // 34819\n\n typesNotEqual: 0x880a, // 34826\n globalNotTyped: 0x8804, // 34820\n invalidDecart: 0x8805, // 34821\n invalidBoolean: 0x8806, // 34822\n invalidTypeOperation: 0x8807, // 34823\n invalidCard: 0x8808, // 34824\n invalidDebool: 0x8809, // 34825\n globalFuncWithoutArgs: 0x880b, // 34827\n globalDeleted: 0x880c, // 34828\n invalidReduce: 0x8810, // 34832\n invalidEnumeration: 0x8813, // 34835\n projectionSetArgumentNotSet: 0x8830, // 34864\n projectionSetArgumentNotTupleSet: 0x8831, // 34865\n projectionSetIndexOutOfRange: 0x8832, // 34866\n projectionTupleArgumentNotTuple: 0x8833, // 34867\n projectionTupleIndexOutOfRange: 0x8834, // 34868\n invalidCortegeDeclare: 0x8814, // 34836\n localOutOfScope: 0x8815, // 34837\n invalidElementPredicate: 0x8816, // 34838\n invalidEmptySetUsage: 0x8817, // 34839\n invalidArgsArity: 0x8818, // 34840\n invalidArgumentType: 0x8819, // 34841\n globalStructure: 0x881c, // 34844\n radicalUsage: 0x8821, // 34849\n invalidFilterArgumentType: 0x8822, // 34850\n invalidFilterArity: 0x8823, // 34851\n arithmeticNotSupported: 0x8824, // 34852\n typesNotCompatible: 0x8825, // 34853\n orderingNotSupported: 0x8826, // 34854\n expectedLogic: 0x8827, // 34855\n expectedSetexpr: 0x8828, // 34856\n invalidArgumentCortegeDeclare: 0x8829, // 34857\n invalidQuantifierDomain: 0x882a, // 34858\n invalidFilterParameterType: 0x882b, // 34859\n invalidFilterIndex: 0x882c, // 34860\n invalidFilterBooleanEchelon: 0x882d, // 34861\n localOutOfScopeParentheses: 0x882e, // 34862\n localUndeclaredInSubexpr: 0x882f, // 34863\n\n globalNoValue: 0x8840, // 34880\n invalidPropertyUsage: 0x8841, // 34881\n\n // Value evaluation (runtime)\n calcUnknownError: 0x8100, // 35328\n setOverflow: 0x8101, // 35329\n booleanBaseLimit: 0x8102, // 35330\n calcGlobalMissing: 0x8103, // 35331\n iterationsLimit: 0x8104, // 35332\n calcInvalidDebool: 0x8105, // 35333\n iterateInfinity: 0x8106, // 35334\n calculationNotSupported: 0x8107, // 35335\n calcInvalidData: 0x8108, // 35336\n\n cstEmptyDerived: 0x8861, // 34913\n definitionNotAllowed: 0x8862, // 34914\n\n // Schema diagnostics surfaced in expression analysis (same value as RSDiagnosticCode.schemaDependencyCycle).\n schemaDependencyCycle: 0x8906 // 35078\n} as const;\nexport type RSErrorCode = (typeof RSErrorCode)[keyof typeof RSErrorCode];\n\nconst ERROR_EVALUATION_MASK = 0x0100;\nconst ERROR_LEXER_MASK = 0x0200;\nconst ERROR_PARSER_MASK = 0x0400;\nconst ERROR_SEMANTIC_MASK = 0x0800;\n\n/** Infers error class from error type (code). */\nfunction inferErrorClass(error: RSErrorCode): RSErrorClass {\n if ((error & ERROR_EVALUATION_MASK) !== 0) {\n return RSErrorClass.EVALUATION;\n } else if ((error & ERROR_LEXER_MASK) !== 0) {\n return RSErrorClass.LEXER;\n } else if ((error & ERROR_PARSER_MASK) !== 0) {\n return RSErrorClass.PARSER;\n } else if ((error & ERROR_SEMANTIC_MASK) !== 0) {\n return RSErrorClass.SEMANTIC;\n } else {\n return RSErrorClass.UNKNOWN;\n }\n}\n\n/** Generate ErrorID label. */\nexport function getRSErrorPrefix(code: RSErrorCode): string {\n const id = code.toString(16).toUpperCase();\n // prettier-ignore\n switch (inferErrorClass(code)) {\n case RSErrorClass.LEXER: return 'L' + id;\n case RSErrorClass.PARSER: return 'P' + id;\n case RSErrorClass.SEMANTIC: return 'S' + id;\n case RSErrorClass.EVALUATION: return 'E' + id;\n case RSErrorClass.UNKNOWN: return 'U' + id;\n }\n}\n\n/** Checks if error is critical. */\nexport function isCritical(code: RSErrorCode): boolean {\n if ((code & 0xf000) === 0x2000) {\n return false;\n }\n return true;\n}\n"],"mappings":";;;AAGA,MAAa,eAAe;CAC1B,OAAO;CACP,QAAQ;CACR,UAAU;CACV,YAAY;CACZ,SAAS;AACX;;;;;;;AA8CA,SAAgB,oBAAoB,OAAsD;CACxF,IAAI,CAAC,SAAS,MAAM,WAAW,GAC7B,OAAO;CAET,MAAM,UAAoB,CAAC;CAC3B,KAAK,IAAI,QAAQ,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS;EACtD,MAAM,QAAQ,MAAM;EACpB,IAAI,OACF,QAAQ,KAAK,MAAM,KAAK;CAE5B;C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,SAAS,gBAAgB,OAAkC;CACzD,KAAK,QAAQ,2BAA2B,GACtC,OAAO,aAAa;MACf,KAAK,QAAQ,sBAAsB,GACxC,OAAO,aAAa;MACf,KAAK,QAAQ,uBAAuB,GACzC,OAAO,aAAa;MACf,KAAK,QAAQ,yBAAyB,GAC3C,OAAO,aAAa;MAEpB,OAAO,aAAa;AAExB;;AAGA,SAAgB,iBAAiB,MAA2B;CAC1D,MAAM,KAAK,KAAK,SAAS,EAAE,CAAC,CAAC,YAAY;CAEzC,QAAQ,gBAAgB,IAAI,GAA5B;EACE,KAAK,aAAa,OAAO,OAAO,MAAM;EACtC,KAAK,aAAa,QAAQ,OAAO,MAAM;EACvC,KAAK,aAAa,UAAU,OAAO,MAAM;EACzC,KAAK,aAAa,YAAY,OAAO,MAAM;EAC3C,KAAK,aAAa,SAAS,OAAO,MAAM;CAC1C;AACF;;AAGA,SAAgB,WAAW,MAA4B;CACrD,KAAK,OAAO,WAAY,MACtB,OAAO;CAET,OAAO;AACT"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "../../calculator-
|
|
1
|
+
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "../../calculator-SVf1trzN.js";
|
|
2
2
|
export { CalculatorEvaluateOptions, CalculatorResult, RSCalculator };
|
|
@@ -3,7 +3,7 @@ import "../../index-D5RahF1K.js";
|
|
|
3
3
|
import { l as Value } from "../../value-XpJOVzMP.js";
|
|
4
4
|
//#region src/rslang/eval/evaluation-cache.d.ts
|
|
5
5
|
/** Static metadata for one AST node. */
|
|
6
|
-
interface EvalNodeInfo {
|
|
6
|
+
export interface EvalNodeInfo {
|
|
7
7
|
/** Local aliases this expression reads (for dependency stamping). */
|
|
8
8
|
reads: ReadonlySet<string>;
|
|
9
9
|
/** Stable key shared by structurally equivalent expressions. */
|
|
@@ -12,12 +12,12 @@ interface EvalNodeInfo {
|
|
|
12
12
|
cacheable: boolean;
|
|
13
13
|
}
|
|
14
14
|
/** Per-evaluator cache of immutable AST dependency metadata (no runtime values). */
|
|
15
|
-
declare class EvaluationMetadata {
|
|
15
|
+
export declare class EvaluationMetadata {
|
|
16
16
|
private readonly byNode;
|
|
17
17
|
get(node: AstNode): EvalNodeInfo;
|
|
18
18
|
}
|
|
19
19
|
/** Per-run memo of computed values (cleared on each {@link Evaluator.run}). */
|
|
20
|
-
declare class EvaluationCache {
|
|
20
|
+
export declare class EvaluationCache {
|
|
21
21
|
private entries;
|
|
22
22
|
/** Cache hits in the current evaluation run (for tests/diagnostics). */
|
|
23
23
|
hits: number;
|
|
@@ -28,5 +28,4 @@ declare class EvaluationCache {
|
|
|
28
28
|
clear(): void;
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
|
-
export { EvalNodeInfo, EvaluationCache, EvaluationMetadata };
|
|
32
31
|
//# sourceMappingURL=evaluation-cache.d.ts.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as AstNode } from "../../ast-D-D6Rq3T.js";
|
|
2
2
|
import "../../index-D5RahF1K.js";
|
|
3
|
-
import { t as ErrorReporter } from "../../error-
|
|
3
|
+
import { t as ErrorReporter } from "../../error-DBbO_NIg.js";
|
|
4
4
|
import { l as Value, u as ValueContext } from "../../value-XpJOVzMP.js";
|
|
5
5
|
//#region src/rslang/eval/evaluator.d.ts
|
|
6
6
|
/** AST context. */
|
|
7
|
-
type ASTContext = Map<string, AstNode>;
|
|
7
|
+
export type ASTContext = Map<string, AstNode>;
|
|
8
8
|
/** AST calculator - evaluates RS expressions via visitor pattern and provides updates via listeners.
|
|
9
9
|
* Not safe for concurrent {@link run} calls on the same instance; use separate evaluators instead. */
|
|
10
|
-
declare class Evaluator {
|
|
10
|
+
export declare class Evaluator {
|
|
11
11
|
private reporter?;
|
|
12
12
|
private annotateErrors;
|
|
13
13
|
private disableCache;
|
|
@@ -72,5 +72,4 @@ declare class Evaluator {
|
|
|
72
72
|
private visitRecursion;
|
|
73
73
|
}
|
|
74
74
|
//#endregion
|
|
75
|
-
export { ASTContext, Evaluator };
|
|
76
75
|
//# sourceMappingURL=evaluator.d.ts.map
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { boolean, cartesianProduct, contains, convertPathToType, extractValue, isSetValue, isSubsetOrEq, isTupleValue, makeDefaultValue, normalizeValue, printValue, projection, reduce, setDiff, setIntersection, setNestedValue, setSymDiff, setUnion, testInvalid, validateValue, valueStub };
|
|
1
|
+
export { p as boolean, m as cartesianProduct, h as contains, g as convertPathToType, _ as extractValue, v as isSetValue, y as isSubsetOrEq, b as isTupleValue, x as makeDefaultValue, S as normalizeValue, C as printValue, w as projection, T as reduce, E as setDiff, D as setIntersection, O as setNestedValue, k as setSymDiff, A as setUnion, j as testInvalid, M as validateValue, N as valueStub } from "../../value-BDISzQqI.js";
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { BOOL_INFINITY, CalcInvalidDataError, EmptySetV, INVALID_ELEMENT, SET_INFINITY, TUPLE_ID, VALUE_FALSE, VALUE_TRUE, compare, makeValuePath, set, tuple };
|
|
1
|
+
export { t as BOOL_INFINITY, n as CalcInvalidDataError, r as EmptySetV, i as INVALID_ELEMENT, a as SET_INFINITY, o as TUPLE_ID, s as VALUE_FALSE, c as VALUE_TRUE, l as compare, u as makeValuePath, d as set, f as tuple } from "../../value-BDISzQqI.js";
|
package/dist/rslang/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { A as makeTypePath, b as Typification, d as EmptySetT, f as ExpressionType, g as TypeClass, m as LogicT, t as AnyTypificationT, v as TypeID, y as TypePath } from "../typification-hWUoWCba.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { n as ArgumentsType } from "../arguments-extractor-CXWRT5Ou.js";
|
|
3
|
+
import { n as DELETED_ALIAS } from "../api-BRrnB6yd.js";
|
|
4
|
+
import { a as RSErrorDescription, i as RSErrorCode, n as EvalStackFrame, s as formatEvalCallStack } from "../error-DBbO_NIg.js";
|
|
5
|
+
import { i as readTypeAnnotation, r as readErrorAnnotation } from "../ast-annotations-B0XO6380.js";
|
|
4
6
|
import { d as ValuePath, l as Value, p as makeValuePath } from "../value-XpJOVzMP.js";
|
|
5
|
-
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "../calculator-
|
|
7
|
+
import { n as CalculatorResult, r as RSCalculator, t as CalculatorEvaluateOptions } from "../calculator-SVf1trzN.js";
|
|
6
8
|
import { d as printValue } from "../value-api-Dw8UkwCD.js";
|
|
7
9
|
import { t as parser } from "../parser-DkejtiOR.js";
|
|
8
10
|
import { t as TokenID } from "../token-DeXAmzwr.js";
|
|
9
11
|
import { t as ValueClass } from "../value-class-CNI-lqXJ.js";
|
|
10
|
-
import { a as RSLangAnalyzer, n as AnalysisFast, r as AnalysisFull, t as AnalysisBase } from "../analyzer-
|
|
11
|
-
import { n as ArgumentsType } from "../arguments-extractor-CXWRT5Ou.js";
|
|
12
|
+
import { a as RSLangAnalyzer, n as AnalysisFast, r as AnalysisFull, t as AnalysisBase } from "../analyzer-BcPMzR38.js";
|
|
12
13
|
import { n as applyAsciiTypeSubstitutions, r as parseTypeText } from "../typification-parser-DFxj4JiQ.js";
|
|
13
14
|
import { n as TypificationNodeData, t as TypificationGraph } from "../typification-graph-CSxDt18X.js";
|
|
14
|
-
import "../index-
|
|
15
|
-
export { type AnalysisBase, type AnalysisFast, type AnalysisFull, AnyTypificationT, type ArgumentsType, type CalculatorEvaluateOptions, type CalculatorResult, EmptySetT, type EvalStackFrame, type ExpressionType, LogicT, RSCalculator, RSErrorCode, type RSErrorDescription, RSLangAnalyzer, TokenID, TypeClass, TypeID, type TypePath, type Typification, TypificationGraph, type TypificationNodeData, type Value, ValueClass, type ValuePath, applyAsciiTypeSubstitutions, formatEvalCallStack, makeTypePath, makeValuePath, parseTypeText, printValue, readErrorAnnotation, readTypeAnnotation, parser as rslangParser };
|
|
15
|
+
import "../index-CEUOBGLn.js";
|
|
16
|
+
export { type AnalysisBase, type AnalysisFast, type AnalysisFull, AnyTypificationT, type ArgumentsType, type CalculatorEvaluateOptions, type CalculatorResult, DELETED_ALIAS, EmptySetT, type EvalStackFrame, type ExpressionType, LogicT, RSCalculator, RSErrorCode, type RSErrorDescription, RSLangAnalyzer, TokenID, TypeClass, TypeID, type TypePath, type Typification, TypificationGraph, type TypificationNodeData, type Value, ValueClass, type ValuePath, applyAsciiTypeSubstitutions, formatEvalCallStack, makeTypePath, makeValuePath, parseTypeText, printValue, readErrorAnnotation, readTypeAnnotation, parser as rslangParser };
|