-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined nonterminal is accepted in bnf parsing #136
Comments
This is a good question! Should an undefined nonterminal be an error? In a similar way, should this code cause an error?: let mut grammar = bnf::Grammar::new();
let production_with_undefined_nonterminal: bnf::Production = "<start> ::= <end>".parse().unwrap();
grammar.add_production(production_with_undefined_nonterminal); The root question seems to be "Is a The current |
I think so. A quick fix would be add |
I agree, though I would prefer |
Describe the bug
A nonterminal that is not defined is not rejected during parsing.
To Reproduce
For example,
does not panic, while 'base' is not defined in the input.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: