added method get_rule_names() to parser class

This commit is contained in:
Mirko 2018-09-03 21:20:05 +02:00
parent 469a61f044
commit 99380c2d72

View File

@ -2877,6 +2877,15 @@ public:
return (*grammar_)[s];
}
std::vector<std::string> get_rule_names(){
std::vector<std::string> 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_];