mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Fixed semantic values stack leak
This commit is contained in:
parent
0d601b4b2c
commit
fe6314a6e0
8
peglib.h
8
peglib.h
@ -829,12 +829,15 @@ public:
|
||||
, enablePackratParsing(a_enablePackratParsing)
|
||||
, cache_registered(enablePackratParsing ? def_count * (l + 1) : 0)
|
||||
, cache_success(enablePackratParsing ? def_count * (l + 1) : 0)
|
||||
, tracer(a_tracer)
|
||||
{
|
||||
, tracer(a_tracer) {
|
||||
args_stack.resize(1);
|
||||
capture_scope_stack.resize(1);
|
||||
}
|
||||
|
||||
~Context() {
|
||||
assert(!value_stack_size);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void packrat(const char* a_s, size_t def_id, size_t& len, any& val, T fn) {
|
||||
if (!enablePackratParsing) {
|
||||
@ -948,6 +951,7 @@ public:
|
||||
size_t parse(const char* s, size_t n, SemanticValues& sv, Context& c, any& dt) const override {
|
||||
c.trace("Sequence", s, n, sv, dt);
|
||||
auto& chldsv = c.push();
|
||||
auto pop_se = make_scope_exit([&]() { c.pop(); });
|
||||
size_t i = 0;
|
||||
for (const auto& ope : opes_) {
|
||||
c.nest_level++;
|
||||
|
Loading…
Reference in New Issue
Block a user