Renamed 'before/after' to 'enter/exit'.

This commit is contained in:
yhirose 2015-12-02 22:51:37 -05:00
parent bbd7699c81
commit a9cea16325
2 changed files with 9 additions and 9 deletions

View File

@ -1301,8 +1301,8 @@ public:
std::string name;
size_t id;
Action action;
std::function<void (any& dt)> before;
std::function<void (any& dt)> after;
std::function<void (any& dt)> enter;
std::function<void (any& dt)> exit;
std::function<std::string ()> error_message;
bool ignoreSemanticValue;
std::shared_ptr<Ope> whiteSpaceOpe;
@ -1373,8 +1373,8 @@ inline size_t Holder::parse(const char* s, size_t n, SemanticValues& sv, Context
auto& chldsv = c.push();
if (outer_->before) {
outer_->before(dt);
if (outer_->enter) {
outer_->enter(dt);
}
auto ope = ope_;
@ -1415,8 +1415,8 @@ inline size_t Holder::parse(const char* s, size_t n, SemanticValues& sv, Context
}
}
if (outer_->after) {
outer_->after(dt);
if (outer_->exit) {
outer_->exit(dt);
}
c.pop();

View File

@ -213,7 +213,7 @@ TEST_CASE("Lambda action test", "[general]")
REQUIRE(ss == "hello");
}
TEST_CASE("before/after handlers test", "[general]")
TEST_CASE("enter/exit handlers test", "[general]")
{
parser parser(R"(
START <- LTOKEN '=' RTOKEN
@ -222,11 +222,11 @@ TEST_CASE("before/after handlers test", "[general]")
TOKEN <- [A-Za-z]+
)");
parser["LTOKEN"].before = [&](any& dt) {
parser["LTOKEN"].enter = [&](any& dt) {
auto& require_upper_case = *dt.get<bool*>();
require_upper_case = false;
};
parser["LTOKEN"].after = [&](any& dt) {
parser["LTOKEN"].exit = [&](any& dt) {
auto& require_upper_case = *dt.get<bool*>();
require_upper_case = true;
};