mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Adjust position to be 1-based index
This commit is contained in:
parent
2ca53be3bf
commit
5374243d77
6
peglib.h
6
peglib.h
@ -4496,8 +4496,8 @@ inline void enable_tracing(parser &parser, std::ostream &os) {
|
|||||||
auto lit = dynamic_cast<const peg::LiteralString *>(&ope);
|
auto lit = dynamic_cast<const peg::LiteralString *>(&ope);
|
||||||
if (lit) { name += " '" + peg::escape_characters(lit->lit_) + "'"; }
|
if (lit) { name += " '" + peg::escape_characters(lit->lit_) + "'"; }
|
||||||
}
|
}
|
||||||
os << "E " << pos << backtrack << "\t" << indent << "┌" << name << " #"
|
os << "E " << pos + 1 << backtrack << "\t" << indent << "┌" << name
|
||||||
<< c.trace_ids.back() << std::endl;
|
<< " #" << c.trace_ids.back() << std::endl;
|
||||||
prev_pos = static_cast<size_t>(pos);
|
prev_pos = static_cast<size_t>(pos);
|
||||||
},
|
},
|
||||||
[&](auto &ope, auto s, auto, auto &sv, auto &c, auto &, auto len,
|
[&](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<peg::Ope &>(ope))) {
|
peg::TokenChecker::is_token(const_cast<peg::Ope &>(ope))) {
|
||||||
matched = ", match '" + peg::escape_characters(s, len) + "'";
|
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
|
<< c.trace_ids.back() << choice.str() << token << matched
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user