diff options
Diffstat (limited to 'src/parser/grammar')
-rw-r--r-- | src/parser/grammar/types.rs | 10 |
1 files changed, 10 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 = _; | ||
136 | fn 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 | |||
133 | fn path_type(p: &mut Parser) { | 143 | fn 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(); |