2015-10-01 10:40:51 +00:00
|
|
|
std::map<std::string,mstch::node> specs_lambdas {
|
|
|
|
{"Interpolation", mstch::lambda{[](const std::string&) -> mstch::node {
|
2015-05-05 12:15:47 +00:00
|
|
|
return std::string{"world"};
|
2015-10-01 10:40:51 +00:00
|
|
|
}}},
|
|
|
|
{"Interpolation - Expansion", mstch::lambda{[](const std::string&) -> mstch::node {
|
2015-05-05 12:15:47 +00:00
|
|
|
return std::string{"{{planet}}"};
|
2015-10-01 10:40:51 +00:00
|
|
|
}}},
|
|
|
|
{"Interpolation - Multiple Calls", mstch::lambda{[](const std::string&) -> mstch::node {
|
2015-05-05 12:15:47 +00:00
|
|
|
static int calls = 0; return ++calls;
|
2015-10-01 10:40:51 +00:00
|
|
|
}}},
|
|
|
|
{"Escaping", mstch::lambda{[](const std::string&) -> mstch::node {
|
2015-05-05 12:15:47 +00:00
|
|
|
return std::string{">"};
|
2015-10-01 10:40:51 +00:00
|
|
|
}}},
|
|
|
|
{"Section", mstch::lambda{[](const std::string& txt) -> mstch::node {
|
2015-05-05 12:15:47 +00:00
|
|
|
return std::string{(txt == "{{x}}") ? "yes" : "no"};
|
2015-10-01 10:40:51 +00:00
|
|
|
}}},
|
|
|
|
{"Section - Expansion", mstch::lambda{[](const std::string& txt) -> mstch::node {
|
2015-05-05 12:15:47 +00:00
|
|
|
return txt + std::string{"{{planet}}"} + txt;
|
2015-10-01 10:40:51 +00:00
|
|
|
}}},
|
|
|
|
{"Section - Multiple Calls", mstch::lambda{[](const std::string& txt) -> mstch::node {
|
2015-05-04 14:14:32 +00:00
|
|
|
return "__" + txt + "__";
|
2015-10-01 10:40:51 +00:00
|
|
|
}}},
|
|
|
|
{"Inverted Section", mstch::lambda{[](const std::string& txt) -> mstch::node {
|
2015-05-05 12:15:47 +00:00
|
|
|
return false;
|
2015-10-01 10:40:51 +00:00
|
|
|
}}}
|
2015-05-04 14:14:32 +00:00
|
|
|
};
|