- foldAstStateful<Info, Down, Up>(ast, down, folds): Up
Parameters
- ast: RNode<Info>
- down: Down
- folds: {
down: DownFold<Info, Down>;
foldAccess: ((node: RAccess<Info>, name: Up, access: readonly ("<>" | Up)[], down: Down) => Up);
foldBinaryOp: ((op: RBinaryOp<Info>, lhs: Up, rhs: Up, down: Down) => Up);
foldExprList: ((exprList: RExpressionList<Info>, grouping: undefined | [start: Up, end: Up], expressions: Up[], down: Down) => Up);
foldIfThenElse: ((ifThenExpr: RIfThenElse<Info>, cond: Up, then: Up, otherwise: undefined | Up, down: Down) => Up);
foldLogical: ((logical: RLogical<Info>, down: Down) => Up);
foldNumber: ((num: RNumber<Info>, down: Down) => Up);
foldPipe: ((op: RPipe<Info>, lhs: Up, rhs: Up, down: Down) => Up);
foldString: ((str: RString<Info>, down: Down) => Up);
foldSymbol: ((symbol: RSymbol<Info, string>, down: Down) => Up);
foldUnaryOp: ((op: RUnaryOp<Info>, operand: Up, down: Down) => Up);
functions: {
foldArgument: ((argument: RArgument<Info>, name: undefined | Up, value: undefined | Up, down: Down) => Up);
foldFunctionCall: ((call: RFunctionCall<Info>, functionNameOrExpression: Up, args: ("<>" | Up)[], down: Down) => Up);
foldFunctionDefinition: ((definition: RFunctionDefinition<Info>, params: Up[], body: Up, down: Down) => Up);
foldParameter: ((parameter: RParameter<Info>, name: Up, defaultValue: undefined | Up, down: Down) => Up);
};
loop: {
foldBreak: ((next: RBreak<Info>, down: Down) => Up);
foldFor: ((loop: RForLoop<Info>, variable: Up, vector: Up, body: Up, down: Down) => Up);
foldNext: ((next: RNext<Info>, down: Down) => Up);
foldRepeat: ((loop: RRepeatLoop<Info>, body: Up, down: Down) => Up);
foldWhile: ((loop: RWhileLoop<Info>, condition: Up, body: Up, down: Down) => Up);
};
other: {
foldComment: ((comment: RComment<Info>, down: Down) => Up);
foldLineDirective: ((comment: RLineDirective<Info>, down: Down) => Up);
};
}Readonly
foldAccess: ((node: RAccess<Info>, name: Up, access: readonly ("<>" | Up)[], down: Down) => Up)
- (node, name, access, down): Up
Returns Up
Readonly
foldBinaryOp: ((op: RBinaryOp<Info>, lhs: Up, rhs: Up, down: Down) => Up)
- (op, lhs, rhs, down): Up
Returns Up
Readonly
foldExprList: ((exprList: RExpressionList<Info>, grouping: undefined | [start: Up, end: Up], expressions: Up[], down: Down) => Up)
- (exprList, grouping, expressions, down): Up
Returns Up
Readonly
foldIfThenElse: ((ifThenExpr: RIfThenElse<Info>, cond: Up, then: Up, otherwise: undefined | Up, down: Down) => Up)
- (ifThenExpr, cond, then, otherwise, down): Up
Returns Up
Readonly
foldLogical: ((logical: RLogical<Info>, down: Down) => Up)
- (logical, down): Up
Returns Up
Readonly
foldNumber: ((num: RNumber<Info>, down: Down) => Up)
- (num, down): Up
Returns Up
Readonly
foldPipe: ((op: RPipe<Info>, lhs: Up, rhs: Up, down: Down) => Up)
- (op, lhs, rhs, down): Up
Returns Up
Readonly
foldString: ((str: RString<Info>, down: Down) => Up)
- (str, down): Up
Returns Up
Readonly
foldSymbol: ((symbol: RSymbol<Info, string>, down: Down) => Up)
- (symbol, down): Up
Returns Up
Readonly
foldUnaryOp: ((op: RUnaryOp<Info>, operand: Up, down: Down) => Up)
- (op, operand, down): Up
Returns Up
Readonly
functions: {
foldArgument: ((argument: RArgument<Info>, name: undefined | Up, value: undefined | Up, down: Down) => Up);
foldFunctionCall: ((call: RFunctionCall<Info>, functionNameOrExpression: Up, args: ("<>" | Up)[], down: Down) => Up);
foldFunctionDefinition: ((definition: RFunctionDefinition<Info>, params: Up[], body: Up, down: Down) => Up);
foldParameter: ((parameter: RParameter<Info>, name: Up, defaultValue: undefined | Up, down: Down) => Up);
}
Readonly
foldArgument: ((argument: RArgument<Info>, name: undefined | Up, value: undefined | Up, down: Down) => Up)
- (argument, name, value, down): Up
Returns Up
Readonly
foldFunctionCall: ((call: RFunctionCall<Info>, functionNameOrExpression: Up, args: ("<>" | Up)[], down: Down) => Up)
- (call, functionNameOrExpression, args, down): Up
Returns Up
Readonly
foldFunctionDefinition: ((definition: RFunctionDefinition<Info>, params: Up[], body: Up, down: Down) => Up)
- (definition, params, body, down): Up
Returns Up
Readonly
foldParameter: ((parameter: RParameter<Info>, name: Up, defaultValue: undefined | Up, down: Down) => Up)
- (parameter, name, defaultValue, down): Up
Returns Up
Readonly
loop: {
foldBreak: ((next: RBreak<Info>, down: Down) => Up);
foldFor: ((loop: RForLoop<Info>, variable: Up, vector: Up, body: Up, down: Down) => Up);
foldNext: ((next: RNext<Info>, down: Down) => Up);
foldRepeat: ((loop: RRepeatLoop<Info>, body: Up, down: Down) => Up);
foldWhile: ((loop: RWhileLoop<Info>, condition: Up, body: Up, down: Down) => Up);
}
Readonly
foldBreak: ((next: RBreak<Info>, down: Down) => Up)
- (next, down): Up
Returns Up
Readonly
foldFor: ((loop: RForLoop<Info>, variable: Up, vector: Up, body: Up, down: Down) => Up)
- (loop, variable, vector, body, down): Up
Returns Up
Readonly
foldNext: ((next: RNext<Info>, down: Down) => Up)
- (next, down): Up
Returns Up
Readonly
foldRepeat: ((loop: RRepeatLoop<Info>, body: Up, down: Down) => Up)
- (loop, body, down): Up
Returns Up
Readonly
foldWhile: ((loop: RWhileLoop<Info>, condition: Up, body: Up, down: Down) => Up)
- (loop, condition, body, down): Up
Returns Up
Readonly
other: {
foldComment: ((comment: RComment<Info>, down: Down) => Up);
foldLineDirective: ((comment: RLineDirective<Info>, down: Down) => Up);
}
Returns Up
Folds in old functional-fashion over the AST structure but allowing for a down function which can pass context to child nodes.