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 ++++++++++ src/syntax_kinds.rs | 2 ++ 2 files changed, 12 insertions(+) (limited to 'src') 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(); diff --git a/src/syntax_kinds.rs b/src/syntax_kinds.rs index 597550a32..73539d6d4 100644 --- a/src/syntax_kinds.rs +++ b/src/syntax_kinds.rs @@ -107,6 +107,7 @@ pub enum SyntaxKind { ARRAY_TYPE, SLICE_TYPE, REFERENCE_TYPE, + PLACEHOLDER_TYPE, EXTERN_BLOCK, ENUM_VARIANT, NAMED_FIELD, @@ -240,6 +241,7 @@ impl SyntaxKind { ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" }, SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" }, REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" }, + PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" }, EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" }, ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" }, -- cgit v1.2.3