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_];