From 2fb33b2d0d14f09ee06a42bca252dccbf57185e1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 11 Feb 2018 11:57:05 +0300 Subject: G: placeholder types --- src/parser/grammar/types.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/parser') diff --git a/src/parser/grammar/types.rs b/src/parser/grammar/types.rs index 003341db5..37b74bfe7 100644 --- a/src/parser/grammar/types.rs +++ b/src/parser/grammar/types.rs @@ -7,6 +7,7 @@ pub(super) fn type_(p: &mut Parser) { STAR => pointer_type(p), L_BRACK => array_or_slice_type(p), AMPERSAND => reference_type(p), + UNDERSCORE => placeholder_type(p), IDENT => path_type(p), _ => { p.error("expected type"); @@ -130,6 +131,15 @@ fn reference_type(p: &mut Parser) { m.complete(p, REFERENCE_TYPE); } +// test placeholder_type +// type Placeholder = _; +fn placeholder_type(p: &mut Parser) { + assert!(p.at(UNDERSCORE)); + let m = p.start(); + p.bump(); + m.complete(p, PLACEHOLDER_TYPE); +} + fn path_type(p: &mut Parser) { assert!(p.at(IDENT)); let m = p.start(); -- cgit v1.2.3