From 5222b8aba3b1c2c68706aacf6869423a8e4fe6d5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Wed, 20 Feb 2019 15:47:32 +0300 Subject: move all parsing related bits to a separate module --- crates/ra_syntax/src/grammar/type_args.rs | 48 ------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 crates/ra_syntax/src/grammar/type_args.rs (limited to 'crates/ra_syntax/src/grammar/type_args.rs') diff --git a/crates/ra_syntax/src/grammar/type_args.rs b/crates/ra_syntax/src/grammar/type_args.rs deleted file mode 100644 index f889419c5..000000000 --- a/crates/ra_syntax/src/grammar/type_args.rs +++ /dev/null @@ -1,48 +0,0 @@ -use super::*; - -pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) { - let m; - match (colon_colon_required, p.nth(0), p.nth(1)) { - (_, COLONCOLON, L_ANGLE) => { - m = p.start(); - p.bump(); - p.bump(); - } - (false, L_ANGLE, _) => { - m = p.start(); - p.bump(); - } - _ => return, - }; - - while !p.at(EOF) && !p.at(R_ANGLE) { - type_arg(p); - if !p.at(R_ANGLE) && !p.expect(COMMA) { - break; - } - } - p.expect(R_ANGLE); - m.complete(p, TYPE_ARG_LIST); -} - -// test type_arg -// type A = B<'static, i32, Item=u64>; -fn type_arg(p: &mut Parser) { - let m = p.start(); - match p.current() { - LIFETIME => { - p.bump(); - m.complete(p, LIFETIME_ARG); - } - IDENT if p.nth(1) == EQ => { - name_ref(p); - p.bump(); - types::type_(p); - m.complete(p, ASSOC_TYPE_ARG); - } - _ => { - types::type_(p); - m.complete(p, TYPE_ARG); - } - } -} -- cgit v1.2.3