From ee2dad387d94e9680c87d31e98fe4ef1eaf85d3d Mon Sep 17 00:00:00 2001 From: yhirose Date: Wed, 8 Jun 2022 08:35:15 -0400 Subject: [PATCH] Code cleanup --- peglib.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/peglib.h b/peglib.h index 90e84f8..03d811f 100644 --- a/peglib.h +++ b/peglib.h @@ -3363,8 +3363,6 @@ private: data.instructions[name].push_back(instruction); types.insert(instruction.type); } else { - // data.duplicates_of_instruction.emplace_back(type, - // vs.sv().data()); data.duplicates_of_instruction.emplace_back(type, instruction.sv.data()); } @@ -4386,10 +4384,9 @@ public: } template - bool parse(const char *s, std::any &dt, T &val, + bool parse(std::string_view sv, std::any &dt, T &val, const char *path = nullptr) const { - auto n = strlen(s); - return parse_n(s, n, dt, val, path); + return parse_n(sv.data(), sv.size(), dt, val, path); } Definition &operator[](const char *s) { return (*grammar_)[s]; }