@openfisca/json-model
Version:
Library to handle informations extracted in JSON or YAML format from OpenFisca parameters, variables, etc
80 lines (79 loc) • 2.96 kB
TypeScript
import type { EntityByKey } from "../entities";
import { type NodeParameter } from "../parameters";
import type { Variable } from "../variables";
import { PythonAstNode, PythonAstSubscript, type OpenfiscaAstCog, type OpenfiscaAstFormula, type OpenfiscaAstNode, type PythonAstAssign, type PythonAstAttribute, type PythonAstAugAssign, type PythonAstCall, type PythonAstFunctionDef, type PythonAstName, type PythonAstReturn } from "./nodes";
import { AstTransformer } from "./visitors";
export declare class OpenfiscaAstFormulaBuilder extends AstTransformer<PythonAstNode, OpenfiscaAstNode> {
readonly variable: Variable;
readonly entityByKey: EntityByKey;
readonly rootParameter: NodeParameter;
readonly variableSummaryByName: {
[name: string]: Variable;
};
readonly cogByName: {
[name: string]: OpenfiscaAstCog;
};
readonly globalVariableValueByName: {
[name: string]: {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
};
readonly personEntityKey: string;
returnCount: number;
returnValue: {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
} | undefined;
readonly variableValueByName: {
[name: string]: {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
};
constructor(variable: Variable, functionDef: PythonAstFunctionDef, entityByKey: EntityByKey, rootParameter: NodeParameter, variableSummaryByName: {
[name: string]: Variable;
});
run(functionDef: PythonAstFunctionDef): OpenfiscaAstFormula;
transform_Assign(assign: PythonAstAssign): {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
transform_Attribute(attribute: PythonAstAttribute): {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
transform_AugAssign(augAssign: PythonAstAugAssign): {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
transform_Call(call: PythonAstCall): {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
transform_Name(name: PythonAstName): {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
transform_Return(returnNode: PythonAstReturn): {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
transform_Subscript(subscript: PythonAstSubscript): {
input: PythonAstNode;
output: OpenfiscaAstNode;
error?: unknown;
};
}
export declare function openfiscaAstFromFormulaPythonAst(variable: Variable, functionDef: PythonAstFunctionDef, entityByKey: EntityByKey, rootParameter: NodeParameter, variableSummaryByName: {
[name: string]: Variable;
}): OpenfiscaAstFormula;