diff options
author | Aleksey Kladov <[email protected]> | 2018-02-04 10:53:47 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-02-04 10:53:47 +0000 |
commit | d94124e3b4a4380ad23c1a317fd3943664b7182a (patch) | |
tree | c11b5a548bac9dae6e77bead8f24db98dbea9dc8 /src/parser/event_parser/grammar/type_params.rs | |
parent | a40b715ce1cae4db1b4c3b4c383ee7517d4202c4 (diff) |
Somewhat more san directory structure
Diffstat (limited to 'src/parser/event_parser/grammar/type_params.rs')
-rw-r--r-- | src/parser/event_parser/grammar/type_params.rs | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/parser/event_parser/grammar/type_params.rs b/src/parser/event_parser/grammar/type_params.rs deleted file mode 100644 index 12c9a5362..000000000 --- a/src/parser/event_parser/grammar/type_params.rs +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | use super::*; | ||
2 | |||
3 | pub(super) fn list(p: &mut Parser) { | ||
4 | if !p.at(L_ANGLE) { | ||
5 | return; | ||
6 | } | ||
7 | let m = p.start(); | ||
8 | p.bump(); | ||
9 | |||
10 | while !p.at(EOF) && !p.at(R_ANGLE) { | ||
11 | match p.current() { | ||
12 | LIFETIME => lifetime_param(p), | ||
13 | IDENT => type_param(p), | ||
14 | _ => p.err_and_bump("expected type parameter"), | ||
15 | } | ||
16 | if !p.at(R_ANGLE) && !p.expect(COMMA) { | ||
17 | break; | ||
18 | } | ||
19 | } | ||
20 | p.expect(R_ANGLE); | ||
21 | m.complete(p, TYPE_PARAM_LIST); | ||
22 | |||
23 | fn lifetime_param(p: &mut Parser) { | ||
24 | assert!(p.at(LIFETIME)); | ||
25 | let m = p.start(); | ||
26 | p.bump(); | ||
27 | if p.eat(COLON) { | ||
28 | while p.at(LIFETIME) { | ||
29 | p.bump(); | ||
30 | if !p.eat(PLUS) { | ||
31 | break; | ||
32 | } | ||
33 | } | ||
34 | } | ||
35 | m.complete(p, LIFETIME_PARAM); | ||
36 | } | ||
37 | |||
38 | fn type_param(p: &mut Parser) { | ||
39 | assert!(p.at(IDENT)); | ||
40 | let m = p.start(); | ||
41 | p.bump(); | ||
42 | if p.eat(COLON) { | ||
43 | loop { | ||
44 | let has_paren = p.eat(L_PAREN); | ||
45 | p.eat(QUESTION); | ||
46 | if p.at(FOR_KW) { | ||
47 | //TODO | ||
48 | } | ||
49 | if p.at(LIFETIME) { | ||
50 | p.bump(); | ||
51 | } else if paths::is_path_start(p) { | ||
52 | paths::type_path(p); | ||
53 | } else { | ||
54 | break; | ||
55 | } | ||
56 | if has_paren { | ||
57 | p.expect(R_PAREN); | ||
58 | } | ||
59 | if !p.eat(PLUS) { | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | if p.at(EQ) { | ||
65 | types::type_ref(p) | ||
66 | } | ||
67 | m.complete(p, TYPE_PARAM); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | pub(super) fn where_clause(p: &mut Parser) { | ||
72 | if p.at(WHERE_KW) { | ||
73 | p.bump(); | ||
74 | } | ||
75 | } | ||