From 5374243d77ed08e22a785bf5272869057dd6c365 Mon Sep 17 00:00:00 2001 From: yhirose Date: Wed, 8 Jun 2022 08:34:25 -0400 Subject: [PATCH] Adjust position to be 1-based index --- peglib.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/peglib.h b/peglib.h index 0736954..90e84f8 100644 --- a/peglib.h +++ b/peglib.h @@ -4496,8 +4496,8 @@ inline void enable_tracing(parser &parser, std::ostream &os) { auto lit = dynamic_cast(&ope); if (lit) { name += " '" + peg::escape_characters(lit->lit_) + "'"; } } - os << "E " << pos << backtrack << "\t" << indent << "┌" << name << " #" - << c.trace_ids.back() << std::endl; + os << "E " << pos + 1 << backtrack << "\t" << indent << "┌" << name + << " #" << c.trace_ids.back() << std::endl; prev_pos = static_cast(pos); }, [&](auto &ope, auto s, auto, auto &sv, auto &c, auto &, auto len, @@ -4526,7 +4526,7 @@ inline void enable_tracing(parser &parser, std::ostream &os) { peg::TokenChecker::is_token(const_cast(ope))) { matched = ", match '" + peg::escape_characters(s, len) + "'"; } - os << "L " << pos << "\t" << indent << ret << name << " #" + os << "L " << pos + 1 << "\t" << indent << ret << name << " #" << c.trace_ids.back() << choice.str() << token << matched << std::endl; },