]> git.lizzy.rs Git - rust.git/blobdiff - src/doc/grammar.md
Null exclusions in grammar docs
[rust.git] / src / doc / grammar.md
index 8e803aff4d6fe3a40b12d1da2ebef7f3ec48667b..3ba8b7ae687c6d999479e5e8c549577d42796c8d 100644 (file)
@@ -121,9 +121,9 @@ that does _not_ occur in the set of [keywords](#keywords).
 Some productions are defined by exclusion of particular Unicode characters:
 
 - `non_null` is any single Unicode character aside from `U+0000` (null)
-- `non_eol` is `non_null` restricted to exclude `U+000A` (`'\n'`)
-- `non_single_quote` is `non_null` restricted to exclude `U+0027`  (`'`)
-- `non_double_quote` is `non_null` restricted to exclude `U+0022` (`"`)
+- `non_eol` is any single Unicode character aside from `U+000A` (`'\n'`)
+- `non_single_quote` is any single Unicode character aside from `U+0027`  (`'`)
+- `non_double_quote` is any single Unicode character aside from `U+0022` (`"`)
 
 ## Comments
 
@@ -154,19 +154,19 @@ token : simple_token | ident | literal | symbol | whitespace token ;
 
 <p id="keyword-table-marker"></p>
 
-|          |          |          |          |         |
-|----------|----------|----------|----------|---------|
-| abstract | alignof  | as       | become   | box     |
-| break    | const    | continue | crate    | do      |
-| else     | enum     | extern   | false    | final   |
-| fn       | for      | if       | impl     | in      |
-| let      | loop     | macro    | match    | mod     |
-| move     | mut      | offsetof | override | priv    |
-| proc     | pub      | pure     | ref      | return  |
-| Self     | self     | sizeof   | static   | struct  |
-| super    | trait    | true     | type     | typeof  |
-| unsafe   | unsized  | use      | virtual  | where   |
-| while    | yield    |          |          |         |
+|          |          |          |          |          |
+|----------|----------|----------|----------|----------|
+| _        | abstract | alignof  | as       | become   |
+| box      | break    | const    | continue | crate    |
+| do       | else     | enum     | extern   | false    |
+| final    | fn       | for      | if       | impl     |
+| in       | let      | loop     | macro    | match    |
+| mod      | move     | mut      | offsetof | override |
+| priv     | proc     | pub      | pure     | ref      |
+| return   | Self     | self     | sizeof   | static   |
+| struct   | super    | trait    | true     | type     |
+| typeof   | unsafe   | unsized  | use      | virtual  |
+| where    | while    | yield    |          |          |
 
 
 Each of these keywords has special meaning in its grammar, and all of them are
@@ -761,8 +761,6 @@ closure_type := [ 'unsafe' ] [ '<' lifetime-list '>' ] '|' arg-list '|'
                 [ ':' bound-list ] [ '->' type ]
 lifetime-list := lifetime | lifetime ',' lifetime-list
 arg-list := ident ':' type | ident ':' type ',' arg-list
-bound-list := bound | bound '+' bound-list
-bound := path | lifetime
 ```
 
 ### Never type
@@ -780,6 +778,16 @@ never_type : "!" ;
 
 **FIXME:** grammar?
 
+### Type parameter bounds
+
+```antlr
+bound-list := bound | bound '+' bound-list '+' ?
+bound := ty_bound | lt_bound
+lt_bound := lifetime
+ty_bound := ty_bound_noparen | (ty_bound_noparen)
+ty_bound_noparen := [?] [ for<lt_param_defs> ] simple_path
+```
+
 ### Self types
 
 **FIXME:** grammar?