mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
extended parameters for enter and leave callbacks
This commit is contained in:
parent
99380c2d72
commit
fc03a32d1f
8
peglib.h
8
peglib.h
@ -1743,8 +1743,8 @@ public:
|
||||
std::string name;
|
||||
size_t id;
|
||||
Action action;
|
||||
std::function<void (any& dt)> enter;
|
||||
std::function<void (any& dt)> leave;
|
||||
std::function<void (const char* s, size_t n, any& dt)> enter;
|
||||
std::function<void (const char* s, size_t n, size_t matchlen, any& value, any& dt)> leave;
|
||||
std::function<std::string ()> error_message;
|
||||
bool ignoreSemanticValue;
|
||||
std::shared_ptr<Ope> whitespaceOpe;
|
||||
@ -1883,14 +1883,14 @@ inline size_t Holder::parse(const char* s, size_t n, SemanticValues& sv, Context
|
||||
|
||||
c.packrat(s, outer_->id, len, val, [&](any& a_val) {
|
||||
if (outer_->enter) {
|
||||
outer_->enter(dt);
|
||||
outer_->enter(s, n, dt);
|
||||
}
|
||||
|
||||
auto se2 = make_scope_exit([&]() {
|
||||
c.pop();
|
||||
|
||||
if (outer_->leave) {
|
||||
outer_->leave(dt);
|
||||
outer_->leave(s, n, len, a_val, dt);
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user