Skip to content
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

Nonterminal identifiers disallow whitespace in their name #16

Closed
shnewto opened this issue Oct 30, 2017 · 4 comments
Closed

Nonterminal identifiers disallow whitespace in their name #16

shnewto opened this issue Oct 30, 2017 · 4 comments
Assignees
Milestone

Comments

@shnewto
Copy link
Owner

shnewto commented Oct 30, 2017

At the moment, identifying a nonterminal rule silently disallows whitespace, i.e. my name in <my name> will parse as a nonterminal identified as my. This is certainly not ideal. I do wonder whether it's reasonable to disallow whitespace by raising an error in cases like the above or if we should just handle and allow it. Probably we need to review the standard for BNF in this case and in general to ensure compliance.

@shnewto shnewto added this to the 0.2.0 milestone Oct 30, 2017
@CrockAgile
Copy link
Collaborator

I don't think BNF allows for whitespace in the nonterminals, but then again I am not sure there is a formal specification. The wikipedia article does not allow whitespace and encourages the alternative hyphen, <my-name>. I could accept either way if supporting whitespace does not massively complicate parsing.

@shnewto
Copy link
Owner Author

shnewto commented Oct 30, 2017

I'll do some more digging and see if there is any consensus that addresses it (preliminary digging indicates maybe not?) but probably adding logic to throw an error on nonterminal identifier whitespace would be as much work as just allowing it and at least one of them does need to happen.

@shnewto shnewto self-assigned this Oct 31, 2017
@shnewto
Copy link
Owner Author

shnewto commented Nov 1, 2017

@CrockAgile A change that was made to accomplish #14 that "kind of" addressed this one, would like your opinion on that. Before, the real bug was that <my name> resulted in a nonterminal identified as my. After #14 everything between the < and the corresponding > is wrapped into the nonterminal identifier. That also means that < somename > results in the identifier somename which seems weird. My question is do think we should leave it there / don't make any guesses, or do we trim \n\r\t from either side of the nonterminal identiffer? It's pretty trivial to trim, just interested in another opinion.

@CrockAgile
Copy link
Collaborator

@Snewt trimming doesn't seem necessary to me. It does make a weird term like you said, but as long as they behave the same as the rest, I don't feel any urge to trim them. Would change my mind if adding extra whitespace became a common accident for users. But I like the simplicity of "whatever is between the < and > is what you get".

@shnewto shnewto closed this as completed Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants