aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/grammar.ron7
-rw-r--r--src/parser/grammar/type_args.rs24
-rw-r--r--src/syntax_kinds/generated.rs14
3 files changed, 38 insertions, 7 deletions
diff --git a/src/grammar.ron b/src/grammar.ron
index e10e5aaf4..6c67db739 100644
--- a/src/grammar.ron
+++ b/src/grammar.ron
@@ -152,10 +152,13 @@ Grammar(
152 "LET_STMT", 152 "LET_STMT",
153 "EXPR_STMT", 153 "EXPR_STMT",
154 154
155 "TYPE_PARAM",
156 "LIFETIME_PARAM",
157 "TYPE_PARAM_LIST", 155 "TYPE_PARAM_LIST",
156 "LIFETIME_PARAM",
157 "TYPE_PARAM",
158 "TYPE_ARG_LIST", 158 "TYPE_ARG_LIST",
159 "LIFETIME_ARG",
160 "TYPE_ARG",
161 "ASSOC_TYPE_ARG",
159 162
160 "PARAM_LIST", 163 "PARAM_LIST",
161 "SELF_PARAM", 164 "SELF_PARAM",
diff --git a/src/parser/grammar/type_args.rs b/src/parser/grammar/type_args.rs
index adac73e7e..6b2217012 100644
--- a/src/parser/grammar/type_args.rs
+++ b/src/parser/grammar/type_args.rs
@@ -16,7 +16,7 @@ pub(super) fn list(p: &mut Parser, colon_colon_required: bool) {
16 }; 16 };
17 17
18 while !p.at(EOF) && !p.at(R_ANGLE) { 18 while !p.at(EOF) && !p.at(R_ANGLE) {
19 types::type_(p); 19 type_arg(p);
20 if !p.at(R_ANGLE) && !p.expect(COMMA) { 20 if !p.at(R_ANGLE) && !p.expect(COMMA) {
21 break; 21 break;
22 } 22 }
@@ -24,3 +24,25 @@ pub(super) fn list(p: &mut Parser, colon_colon_required: bool) {
24 p.expect(R_ANGLE); 24 p.expect(R_ANGLE);
25 m.complete(p, TYPE_ARG_LIST); 25 m.complete(p, TYPE_ARG_LIST);
26} 26}
27
28// test type_arg
29// type A = B<'static, i32, Item=u64>
30fn type_arg(p: &mut Parser) {
31 let m = p.start();
32 match p.current() {
33 LIFETIME => {
34 p.bump();
35 m.complete(p, LIFETIME_ARG);
36 },
37 IDENT if p.nth(1) == EQ => {
38 p.bump();
39 p.bump();
40 types::type_(p);
41 m.complete(p, ASSOC_TYPE_ARG);
42 },
43 _ => {
44 types::type_(p);
45 m.complete(p, TYPE_ARG);
46 },
47 }
48}
diff --git a/src/syntax_kinds/generated.rs b/src/syntax_kinds/generated.rs
index 0603f53fd..7c9333fc5 100644
--- a/src/syntax_kinds/generated.rs
+++ b/src/syntax_kinds/generated.rs
@@ -140,10 +140,13 @@ pub enum SyntaxKind {
140 BLOCK, 140 BLOCK,
141 LET_STMT, 141 LET_STMT,
142 EXPR_STMT, 142 EXPR_STMT,
143 TYPE_PARAM,
144 LIFETIME_PARAM,
145 TYPE_PARAM_LIST, 143 TYPE_PARAM_LIST,
144 LIFETIME_PARAM,
145 TYPE_PARAM,
146 TYPE_ARG_LIST, 146 TYPE_ARG_LIST,
147 LIFETIME_ARG,
148 TYPE_ARG,
149 ASSOC_TYPE_ARG,
147 PARAM_LIST, 150 PARAM_LIST,
148 SELF_PARAM, 151 SELF_PARAM,
149 ARG_LIST, 152 ARG_LIST,
@@ -294,10 +297,13 @@ impl SyntaxKind {
294 BLOCK => &SyntaxInfo { name: "BLOCK" }, 297 BLOCK => &SyntaxInfo { name: "BLOCK" },
295 LET_STMT => &SyntaxInfo { name: "LET_STMT" }, 298 LET_STMT => &SyntaxInfo { name: "LET_STMT" },
296 EXPR_STMT => &SyntaxInfo { name: "EXPR_STMT" }, 299 EXPR_STMT => &SyntaxInfo { name: "EXPR_STMT" },
297 TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" },
298 LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" },
299 TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" }, 300 TYPE_PARAM_LIST => &SyntaxInfo { name: "TYPE_PARAM_LIST" },
301 LIFETIME_PARAM => &SyntaxInfo { name: "LIFETIME_PARAM" },
302 TYPE_PARAM => &SyntaxInfo { name: "TYPE_PARAM" },
300 TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" }, 303 TYPE_ARG_LIST => &SyntaxInfo { name: "TYPE_ARG_LIST" },
304 LIFETIME_ARG => &SyntaxInfo { name: "LIFETIME_ARG" },
305 TYPE_ARG => &SyntaxInfo { name: "TYPE_ARG" },
306 ASSOC_TYPE_ARG => &SyntaxInfo { name: "ASSOC_TYPE_ARG" },
301 PARAM_LIST => &SyntaxInfo { name: "PARAM_LIST" }, 307 PARAM_LIST => &SyntaxInfo { name: "PARAM_LIST" },
302 SELF_PARAM => &SyntaxInfo { name: "SELF_PARAM" }, 308 SELF_PARAM => &SyntaxInfo { name: "SELF_PARAM" },
303 ARG_LIST => &SyntaxInfo { name: "ARG_LIST" }, 309 ARG_LIST => &SyntaxInfo { name: "ARG_LIST" },