auto merge of #14277 : pczarn/rust/manual-grammar, r=alexcrichton

The grammar for use declarations was outdated. Corrected some other mistakes.
This commit is contained in:
bors 2014-05-20 10:11:20 -07:00
commit 84320a4f4b

View File

@ -848,11 +848,11 @@ extern crate foo = "some/where/rust-foo#foo:1.0"; // a full crate ID for externa
##### Use declarations ##### Use declarations
~~~~ {.notrust .ebnf .gram} ~~~~ {.notrust .ebnf .gram}
use_decl : "pub" ? "use" ident [ '=' path use_decl : "pub" ? "use" [ ident '=' path
| "::" path_glob ] ; | path_glob ] ;
path_glob : ident [ "::" path_glob ] ? path_glob : ident [ "::" [ path_glob
| '*' | '*' ] ] ?
| '{' ident [ ',' ident ] * '}' ; | '{' ident [ ',' ident ] * '}' ;
~~~~ ~~~~
@ -1743,7 +1743,7 @@ import public items from their destination, not private items.
attribute : '#' '!' ? '[' meta_item ']' ; attribute : '#' '!' ? '[' meta_item ']' ;
meta_item : ident [ '=' literal meta_item : ident [ '=' literal
| '(' meta_seq ')' ] ? ; | '(' 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_ Static entities in Rust — crates, modules and items — may have _attributes_
@ -3027,11 +3027,11 @@ then any `else` block is executed.
### Match expressions ### Match expressions
~~~~ {.notrust .ebnf .gram} ~~~~ {.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 A `match` expression branches on a *pattern*. The exact form of matching that
@ -3137,7 +3137,7 @@ using the `ref` keyword,
or to a mutable reference using `ref mut`. or to a mutable reference using `ref mut`.
Subpatterns can also be bound to variables by the use of the syntax Subpatterns can also be bound to variables by the use of the syntax
`variable @ pattern`. `variable @ subpattern`.
For example: For example:
~~~~ ~~~~