Skip to content

Commit

Permalink
Correct EBNF grammar in the manual
Browse files Browse the repository at this point in the history
The grammar for use declarations was outdated.
  • Loading branch information
pczarn committed May 20, 2014
1 parent b545a49 commit 6674913
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/doc/rust.md
Expand Up @@ -848,11 +848,11 @@ extern crate foo = "some/where/rust-foo#foo:1.0"; // a full crate ID for externa
##### Use declarations

~~~~ {.notrust .ebnf .gram}
use_decl : "pub" ? "use" ident [ '=' path
| "::" path_glob ] ;
use_decl : "pub" ? "use" [ ident '=' path
| path_glob ] ;
path_glob : ident [ "::" path_glob ] ?
| '*'
path_glob : ident [ "::" [ path_glob
| '*' ] ] ?
| '{' ident [ ',' ident ] * '}' ;
~~~~

Expand Down Expand Up @@ -1743,7 +1743,7 @@ import public items from their destination, not private items.
attribute : '#' '!' ? '[' meta_item ']' ;
meta_item : ident [ '=' literal
| '(' meta_seq ')' ] ? ;
meta_seq : meta_item [ ',' meta_seq ]* ;
meta_seq : meta_item [ ',' meta_seq ] ? ;
~~~~

Static entities in Rust — crates, modules and items — may have _attributes_
Expand Down Expand Up @@ -3027,11 +3027,11 @@ then any `else` block is executed.
### Match expressions

~~~~ {.notrust .ebnf .gram}
match_expr : "match" expr '{' match_arm [ '|' match_arm ] * '}' ;
match_expr : "match" expr '{' match_arm * '}' ;
match_arm : match_pat "=>" [ expr "," | '{' block '}' ] ;
match_arm : attribute * match_pat "=>" [ expr "," | '{' block '}' ] ;
match_pat : pat [ ".." pat ] ? [ "if" expr ] ;
match_pat : pat [ '|' pat ] * [ "if" expr ] ? ;
~~~~

A `match` expression branches on a *pattern*. The exact form of matching that
Expand Down Expand Up @@ -3137,7 +3137,7 @@ using the `ref` keyword,
or to a mutable reference using `ref mut`.

Subpatterns can also be bound to variables by the use of the syntax
`variable @ pattern`.
`variable @ subpattern`.
For example:

~~~~
Expand Down

5 comments on commit 6674913

@bors
Copy link
Contributor

@bors bors commented on 6674913 May 20, 2014

Choose a reason for hiding this comment

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

saw approval from alexcrichton
at pczarn@6674913

@bors
Copy link
Contributor

@bors bors commented on 6674913 May 20, 2014

Choose a reason for hiding this comment

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

merging pczarn/rust/manual-grammar = 6674913 into auto

@bors
Copy link
Contributor

@bors bors commented on 6674913 May 20, 2014

Choose a reason for hiding this comment

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

pczarn/rust/manual-grammar = 6674913 merged ok, testing candidate = 84320a4

@bors
Copy link
Contributor

@bors bors commented on 6674913 May 20, 2014

@bors
Copy link
Contributor

@bors bors commented on 6674913 May 20, 2014

Choose a reason for hiding this comment

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

fast-forwarding master to auto = 84320a4

Please sign in to comment.