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

Corrected EBNF grammar in the manual #14277

Merged
merged 1 commit into from
May 20, 2014
Merged

Conversation

pczarn
Copy link
Contributor

@pczarn pczarn commented May 18, 2014

The grammar for use declarations was outdated. Corrected some other mistakes.

use_decl : "pub" ? "use" ident [ '=' path
| "::" path_glob ] ;
use_decl : "pub" ? "use" [ ident '=' path
| path_glob ] ;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Um… what? These changes would make use; valid, which it is certainly not. A use statement must be followed by an identifier.

The grammar already existing appears to me to be correct.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I take back what I said about the grammar existing being correct—I’ve been reading other grammar rules too much recently (the IETF RFC ones in particular) and was thinking […] meant optional. There is a problem with the current grammar, but the new one is wrong also. I think that just tacking a question mark after the ] on the existing grammar would be correct? OK, OK, that responsibility got shifted to the path_glob rule… not doing well today, am I?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My line of thought is that a single identifier is also a path. path_glob can match multiple paths.

// Valid declarations
use ident = simple::path;
use simple::path;
use {many, idents}; // doesn't start with an ident!
// Invalid
use simple::path = another::path;
use *;
use;

@alexcrichton
Copy link
Member

I think @chris-morgan is right about the meta_item grammar. Let's leave it as a literal for now instead of a string_lit, otherwise these look great to me, thanks!

The grammar for use declarations was outdated.
@pczarn
Copy link
Contributor Author

pczarn commented May 20, 2014

Alright, it's done.

bors added a commit that referenced this pull request May 20, 2014
The grammar for use declarations was outdated. Corrected some other mistakes.
@bors bors closed this May 20, 2014
@bors bors merged commit 6674913 into rust-lang:master May 20, 2014
@pczarn pczarn deleted the manual-grammar branch July 7, 2014 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants