diff options
author | Aleksey Kladov <[email protected]> | 2018-02-11 20:32:49 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-02-11 20:32:49 +0000 |
commit | c8910b0683dfc9ad88d440c22cef71c263837997 (patch) | |
tree | 8ec42959ece0d41606416bd43c2dcccedbf5fb0d /src/parser/grammar | |
parent | a6f9b0414cf5bf49ad7f714b9d3fe5af91a16404 (diff) |
G: for type
Diffstat (limited to 'src/parser/grammar')
-rw-r--r-- | src/parser/grammar/types.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/parser/grammar/types.rs b/src/parser/grammar/types.rs index a4967a00a..c25517a51 100644 --- a/src/parser/grammar/types.rs +++ b/src/parser/grammar/types.rs | |||
@@ -9,6 +9,7 @@ pub(super) fn type_(p: &mut Parser) { | |||
9 | AMPERSAND => reference_type(p), | 9 | AMPERSAND => reference_type(p), |
10 | UNDERSCORE => placeholder_type(p), | 10 | UNDERSCORE => placeholder_type(p), |
11 | FN_KW | UNSAFE_KW | EXTERN_KW => fn_pointer_type(p), | 11 | FN_KW | UNSAFE_KW | EXTERN_KW => fn_pointer_type(p), |
12 | FOR_KW => for_type(p), | ||
12 | IDENT => path_type(p), | 13 | IDENT => path_type(p), |
13 | _ => { | 14 | _ => { |
14 | p.error("expected type"); | 15 | p.error("expected type"); |
@@ -166,6 +167,17 @@ fn fn_pointer_type(p: &mut Parser) { | |||
166 | m.complete(p, FN_POINTER_TYPE); | 167 | m.complete(p, FN_POINTER_TYPE); |
167 | } | 168 | } |
168 | 169 | ||
170 | // test for_type | ||
171 | // type A = for<'a> fn() -> (); | ||
172 | fn for_type(p: &mut Parser) { | ||
173 | assert!(p.at(FOR_KW)); | ||
174 | let m = p.start(); | ||
175 | p.bump(); | ||
176 | type_params::list(p); | ||
177 | type_(p); | ||
178 | m.complete(p, FOR_TYPE); | ||
179 | } | ||
180 | |||
169 | fn path_type(p: &mut Parser) { | 181 | fn path_type(p: &mut Parser) { |
170 | assert!(p.at(IDENT)); | 182 | assert!(p.at(IDENT)); |
171 | let m = p.start(); | 183 | let m = p.start(); |