GbnfRecognizer constructor
Implementation
GbnfRecognizer(String grammar, {this.root = 'root'}) : _rules = _Parser(grammar).parse() {
for (final entry in _rules.entries) {
for (final name in _references(entry.value)) {
if (!_rules.containsKey(name)) throw FormatException('rule ${entry.key} uses the undefined rule $name');
}
}
if (!_rules.containsKey(root)) throw FormatException('no rule named $root');
_checkLeftRecursion();
}