From 99380c2d72655da0dae6fcd327ae048992b32078 Mon Sep 17 00:00:00 2001 From: Mirko Date: Mon, 3 Sep 2018 21:20:05 +0200 Subject: [PATCH] added method get_rule_names() to parser class --- peglib.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/peglib.h b/peglib.h index 0350317..780eb34 100644 --- a/peglib.h +++ b/peglib.h @@ -2877,6 +2877,15 @@ public: return (*grammar_)[s]; } + std::vector get_rule_names(){ + std::vector rules; + rules.reserve(grammar_->size()); + for (auto const& r : *grammar_) { + rules.emplace_back(r.first); + } + return rules; + } + void enable_packrat_parsing() { if (grammar_ != nullptr) { auto& rule = (*grammar_)[start_];