aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/parser/grammar/types.rs10
-rw-r--r--src/syntax_kinds.rs2
2 files changed, 12 insertions, 0 deletions
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) {
7 STAR => pointer_type(p), 7 STAR => pointer_type(p),
8 L_BRACK => array_or_slice_type(p), 8 L_BRACK => array_or_slice_type(p),
9 AMPERSAND => reference_type(p), 9 AMPERSAND => reference_type(p),
10 UNDERSCORE => placeholder_type(p),
10 IDENT => path_type(p), 11 IDENT => path_type(p),
11 _ => { 12 _ => {
12 p.error("expected type"); 13 p.error("expected type");
@@ -130,6 +131,15 @@ fn reference_type(p: &mut Parser) {
130 m.complete(p, REFERENCE_TYPE); 131 m.complete(p, REFERENCE_TYPE);
131} 132}
132 133
134// test placeholder_type
135// type Placeholder = _;
136fn placeholder_type(p: &mut Parser) {
137 assert!(p.at(UNDERSCORE));
138 let m = p.start();
139 p.bump();
140 m.complete(p, PLACEHOLDER_TYPE);
141}
142
133fn path_type(p: &mut Parser) { 143fn path_type(p: &mut Parser) {
134 assert!(p.at(IDENT)); 144 assert!(p.at(IDENT));
135 let m = p.start(); 145 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 {
107 ARRAY_TYPE, 107 ARRAY_TYPE,
108 SLICE_TYPE, 108 SLICE_TYPE,
109 REFERENCE_TYPE, 109 REFERENCE_TYPE,
110 PLACEHOLDER_TYPE,
110 EXTERN_BLOCK, 111 EXTERN_BLOCK,
111 ENUM_VARIANT, 112 ENUM_VARIANT,
112 NAMED_FIELD, 113 NAMED_FIELD,
@@ -240,6 +241,7 @@ impl SyntaxKind {
240 ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" }, 241 ARRAY_TYPE => &SyntaxInfo { name: "ARRAY_TYPE" },
241 SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" }, 242 SLICE_TYPE => &SyntaxInfo { name: "SLICE_TYPE" },
242 REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" }, 243 REFERENCE_TYPE => &SyntaxInfo { name: "REFERENCE_TYPE" },
244 PLACEHOLDER_TYPE => &SyntaxInfo { name: "PLACEHOLDER_TYPE" },
243 EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" }, 245 EXTERN_BLOCK => &SyntaxInfo { name: "EXTERN_BLOCK" },
244 ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" }, 246 ENUM_VARIANT => &SyntaxInfo { name: "ENUM_VARIANT" },
245 NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" }, 247 NAMED_FIELD => &SyntaxInfo { name: "NAMED_FIELD" },