mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
added method get_rule_names() to parser class
This commit is contained in:
parent
469a61f044
commit
99380c2d72
9
peglib.h
9
peglib.h
@ -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_];
|
||||
|
Loading…
Reference in New Issue
Block a user