diff options
| author | Piotr Czarnecki <pioczarn@gmail.com> | 2014-05-20 15:50:03 +0200 |
|---|---|---|
| committer | Piotr Czarnecki <pioczarn@gmail.com> | 2014-05-20 15:50:03 +0200 |
| commit | 6674913c022f54cef5545e2e4956bc6f6c8528a1 (patch) | |
| tree | b9676148ad68c14b7187d19c465dd9cdc00490ba /src/doc/rust.md | |
| parent | b545a499fad8d58f858e7c14bcdc90171b97efdf (diff) | |
| download | rust-6674913c022f54cef5545e2e4956bc6f6c8528a1.tar.gz rust-6674913c022f54cef5545e2e4956bc6f6c8528a1.zip | |
Correct EBNF grammar in the manual
The grammar for use declarations was outdated.
Diffstat (limited to 'src/doc/rust.md')
| -rw-r--r-- | src/doc/rust.md | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/doc/rust.md b/src/doc/rust.md index 838ddca042d..a4e80788766 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -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 ] * '}' ; ~~~~ @@ -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_ @@ -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 @@ -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: ~~~~ |
