From c8910b0683dfc9ad88d440c22cef71c263837997 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 11 Feb 2018 23:32:49 +0300 Subject: G: for type --- src/parser/grammar/types.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/parser/grammar') 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) { AMPERSAND => reference_type(p), UNDERSCORE => placeholder_type(p), FN_KW | UNSAFE_KW | EXTERN_KW => fn_pointer_type(p), + FOR_KW => for_type(p), IDENT => path_type(p), _ => { p.error("expected type"); @@ -166,6 +167,17 @@ fn fn_pointer_type(p: &mut Parser) { m.complete(p, FN_POINTER_TYPE); } +// test for_type +// type A = for<'a> fn() -> (); +fn for_type(p: &mut Parser) { + assert!(p.at(FOR_KW)); + let m = p.start(); + p.bump(); + type_params::list(p); + type_(p); + m.complete(p, FOR_TYPE); +} + fn path_type(p: &mut Parser) { assert!(p.at(IDENT)); let m = p.start(); -- cgit v1.2.3