21#include <ql/errors.hpp>
40ASTNode::ASTNode(
const std::vector<ASTNodePtr>& args,
const Size minArgs,
const Size maxArgs) : args(args) {
41 QL_REQUIRE(minArgs <=
args.size() && (maxArgs == Null<Size>() ||
args.size() <= maxArgs),
42 "ASTNode construction failed, got " <<
args.size() <<
" arguments, expected " << minArgs <<
"..."
43 << (maxArgs == Null<Size>() ?
"inf" : std::to_string(maxArgs)));
44 if (maxArgs != Null<Size>())
49 auto v1 =
dynamic_cast<Visitor<ASTNode>*
>(&v);
53 QL_FAIL(
"not an ASTNode visitor");
57 auto v1 =
dynamic_cast<Visitor<OperatorPlusNode>*
>(&v);
65 auto v1 =
dynamic_cast<Visitor<OperatorMinusNode>*
>(&v);
73 auto v1 =
dynamic_cast<Visitor<OperatorMultiplyNode>*
>(&v);
81 auto v1 =
dynamic_cast<Visitor<OperatorDivideNode>*
>(&v);
89 auto v1 =
dynamic_cast<Visitor<NegateNode>*
>(&v);
97 auto v1 =
dynamic_cast<Visitor<FunctionAbsNode>*
>(&v);
105 auto v1 =
dynamic_cast<Visitor<FunctionExpNode>*
>(&v);
113 auto v1 =
dynamic_cast<Visitor<FunctionLogNode>*
>(&v);
121 auto v1 =
dynamic_cast<Visitor<FunctionSqrtNode>*
>(&v);
129 auto v1 =
dynamic_cast<Visitor<FunctionNormalCdfNode>*
>(&v);
137 auto v1 =
dynamic_cast<Visitor<FunctionNormalPdfNode>*
>(&v);
145 auto v1 =
dynamic_cast<Visitor<FunctionMaxNode>*
>(&v);
153 auto v1 =
dynamic_cast<Visitor<FunctionMinNode>*
>(&v);
161 auto v1 =
dynamic_cast<Visitor<FunctionPowNode>*
>(&v);
169 auto v1 =
dynamic_cast<Visitor<FunctionBlackNode>*
>(&v);
177 auto v1 =
dynamic_cast<Visitor<FunctionDcfNode>*
>(&v);
185 auto v1 =
dynamic_cast<Visitor<FunctionDaysNode>*
>(&v);
193 auto v1 =
dynamic_cast<Visitor<FunctionPayNode>*
>(&v);
201 auto v1 =
dynamic_cast<Visitor<FunctionLogPayNode>*
>(&v);
209 auto v1 =
dynamic_cast<Visitor<FunctionNpvNode>*
>(&v);
217 auto v1 =
dynamic_cast<Visitor<FunctionNpvMemNode>*
>(&v);
225 auto v1 =
dynamic_cast<Visitor<HistFixingNode>*
>(&v);
233 auto v1 =
dynamic_cast<Visitor<FunctionDiscountNode>*
>(&v);
241 auto v1 =
dynamic_cast<Visitor<FunctionFwdCompNode>*
>(&v);
249 auto v1 =
dynamic_cast<Visitor<FunctionFwdAvgNode>*
>(&v);
257 auto v1 =
dynamic_cast<Visitor<FunctionAboveProbNode>*
>(&v);
265 auto v1 =
dynamic_cast<Visitor<FunctionBelowProbNode>*
>(&v);
273 auto v1 =
dynamic_cast<Visitor<FunctionDateIndexNode>*
>(&v);
281 auto v1 =
dynamic_cast<Visitor<SortNode>*
>(&v);
289 auto v1 =
dynamic_cast<Visitor<PermuteNode>*
>(&v);
297 auto v1 =
dynamic_cast<Visitor<ConstantNumberNode>*
>(&v);
305 auto v1 =
dynamic_cast<Visitor<VariableNode>*
>(&v);
313 auto v1 =
dynamic_cast<Visitor<SizeOpNode>*
>(&v);
321 auto v1 =
dynamic_cast<Visitor<VarEvaluationNode>*
>(&v);
329 auto v1 =
dynamic_cast<Visitor<AssignmentNode>*
>(&v);
337 auto v1 =
dynamic_cast<Visitor<RequireNode>*
>(&v);
345 auto v1 =
dynamic_cast<Visitor<DeclarationNumberNode>*
>(&v);
353 auto v1 =
dynamic_cast<Visitor<SequenceNode>*
>(&v);
361 auto v1 =
dynamic_cast<Visitor<ConditionEqNode>*
>(&v);
369 auto v1 =
dynamic_cast<Visitor<ConditionNeqNode>*
>(&v);
377 auto v1 =
dynamic_cast<Visitor<ConditionLtNode>*
>(&v);
385 auto v1 =
dynamic_cast<Visitor<ConditionLeqNode>*
>(&v);
393 auto v1 =
dynamic_cast<Visitor<ConditionGtNode>*
>(&v);
401 auto v1 =
dynamic_cast<Visitor<ConditionGeqNode>*
>(&v);
409 auto v1 =
dynamic_cast<Visitor<ConditionNotNode>*
>(&v);
417 auto v1 =
dynamic_cast<Visitor<ConditionAndNode>*
>(&v);
425 auto v1 =
dynamic_cast<Visitor<ConditionOrNode>*
>(&v);
433 auto v1 =
dynamic_cast<Visitor<IfThenElseNode>*
>(&v);
441 auto v1 =
dynamic_cast<Visitor<LoopNode>*
>(&v);
abstract syntax tree for payoff scripting
std::string to_string(const LocationInfo &l)
QuantLib::ext::shared_ptr< ASTNode > ASTNodePtr
Serializable Credit Default Swap.
std::vector< ASTNodePtr > args
virtual void accept(AcyclicVisitor &)
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override
void accept(AcyclicVisitor &) override