diff options
author | Aleksey Kladov <[email protected]> | 2018-07-31 13:40:40 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-07-31 13:40:40 +0100 |
commit | 9ce7e8110254e8db476c96bce2eecb2d16983159 (patch) | |
tree | abaddbafc4593948849394b430e3bde5c624fa22 /src/parser | |
parent | 2a2815266b35de12bd3c48cc405e8b3e8fcf8885 (diff) |
cleanups
Diffstat (limited to 'src/parser')
-rw-r--r-- | src/parser/grammar/expressions.rs | 2 | ||||
-rw-r--r-- | src/parser/grammar/items/mod.rs | 1 | ||||
-rw-r--r-- | src/parser/grammar/items/traits.rs | 1 | ||||
-rw-r--r-- | src/parser/grammar/mod.rs | 7 | ||||
-rw-r--r-- | src/parser/grammar/paths.rs | 8 | ||||
-rw-r--r-- | src/parser/grammar/patterns.rs | 7 | ||||
-rw-r--r-- | src/parser/grammar/type_args.rs | 2 |
7 files changed, 15 insertions, 13 deletions
diff --git a/src/parser/grammar/expressions.rs b/src/parser/grammar/expressions.rs index a6456c8d5..11bb3436b 100644 --- a/src/parser/grammar/expressions.rs +++ b/src/parser/grammar/expressions.rs | |||
@@ -39,7 +39,7 @@ pub(super) fn expr(p: &mut Parser) { | |||
39 | fn prefix_expr(p: &mut Parser) -> Option<CompletedMarker> { | 39 | fn prefix_expr(p: &mut Parser) -> Option<CompletedMarker> { |
40 | match p.current() { | 40 | match p.current() { |
41 | AMPERSAND => Some(ref_expr(p)), | 41 | AMPERSAND => Some(ref_expr(p)), |
42 | _ => atom_expr(p) | 42 | _ => atom_expr(p), |
43 | } | 43 | } |
44 | } | 44 | } |
45 | 45 | ||
diff --git a/src/parser/grammar/items/mod.rs b/src/parser/grammar/items/mod.rs index 0d9eccd2f..9147df87d 100644 --- a/src/parser/grammar/items/mod.rs +++ b/src/parser/grammar/items/mod.rs | |||
@@ -218,7 +218,6 @@ fn extern_block(p: &mut Parser) { | |||
218 | p.expect(R_CURLY); | 218 | p.expect(R_CURLY); |
219 | } | 219 | } |
220 | 220 | ||
221 | |||
222 | fn fn_item(p: &mut Parser) { | 221 | fn fn_item(p: &mut Parser) { |
223 | assert!(p.at(FN_KW)); | 222 | assert!(p.at(FN_KW)); |
224 | p.bump(); | 223 | p.bump(); |
diff --git a/src/parser/grammar/items/traits.rs b/src/parser/grammar/items/traits.rs index c7450b761..812cacfb7 100644 --- a/src/parser/grammar/items/traits.rs +++ b/src/parser/grammar/items/traits.rs | |||
@@ -8,7 +8,6 @@ pub(super) fn trait_item(p: &mut Parser) { | |||
8 | p.expect(R_CURLY); | 8 | p.expect(R_CURLY); |
9 | } | 9 | } |
10 | 10 | ||
11 | |||
12 | // test impl_item | 11 | // test impl_item |
13 | // impl Foo {} | 12 | // impl Foo {} |
14 | pub(super) fn impl_item(p: &mut Parser) { | 13 | pub(super) fn impl_item(p: &mut Parser) { |
diff --git a/src/parser/grammar/mod.rs b/src/parser/grammar/mod.rs index c2da775a2..498b45d44 100644 --- a/src/parser/grammar/mod.rs +++ b/src/parser/grammar/mod.rs | |||
@@ -26,12 +26,15 @@ mod expressions; | |||
26 | mod items; | 26 | mod items; |
27 | mod paths; | 27 | mod paths; |
28 | mod patterns; | 28 | mod patterns; |
29 | mod type_params; | ||
30 | mod type_args; | 29 | mod type_args; |
30 | mod type_params; | ||
31 | mod types; | 31 | mod types; |
32 | 32 | ||
33 | use { | 33 | use { |
34 | parser::{parser::{Parser, CompletedMarker}, token_set::TokenSet}, | 34 | parser::{ |
35 | parser::{CompletedMarker, Parser}, | ||
36 | token_set::TokenSet, | ||
37 | }, | ||
35 | SyntaxKind::{self, *}, | 38 | SyntaxKind::{self, *}, |
36 | }; | 39 | }; |
37 | 40 | ||
diff --git a/src/parser/grammar/paths.rs b/src/parser/grammar/paths.rs index 69ed84665..6f66701ac 100644 --- a/src/parser/grammar/paths.rs +++ b/src/parser/grammar/paths.rs | |||
@@ -20,7 +20,11 @@ pub(super) fn expr_path(p: &mut Parser) { | |||
20 | } | 20 | } |
21 | 21 | ||
22 | #[derive(Clone, Copy, Eq, PartialEq)] | 22 | #[derive(Clone, Copy, Eq, PartialEq)] |
23 | enum Mode { Use, Type, Expr } | 23 | enum Mode { |
24 | Use, | ||
25 | Type, | ||
26 | Expr, | ||
27 | } | ||
24 | 28 | ||
25 | fn path(p: &mut Parser, mode: Mode) { | 29 | fn path(p: &mut Parser, mode: Mode) { |
26 | if !is_path_start(p) { | 30 | if !is_path_start(p) { |
@@ -55,7 +59,7 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) { | |||
55 | IDENT => { | 59 | IDENT => { |
56 | name_ref(p); | 60 | name_ref(p); |
57 | path_generic_args(p, mode); | 61 | path_generic_args(p, mode); |
58 | }, | 62 | } |
59 | SELF_KW | SUPER_KW => p.bump(), | 63 | SELF_KW | SUPER_KW => p.bump(), |
60 | _ => { | 64 | _ => { |
61 | p.error("expected identifier"); | 65 | p.error("expected identifier"); |
diff --git a/src/parser/grammar/patterns.rs b/src/parser/grammar/patterns.rs index a5d13a124..7216807fd 100644 --- a/src/parser/grammar/patterns.rs +++ b/src/parser/grammar/patterns.rs | |||
@@ -43,11 +43,8 @@ fn ref_pat(p: &mut Parser) { | |||
43 | // } | 43 | // } |
44 | fn bind_pat(p: &mut Parser) { | 44 | fn bind_pat(p: &mut Parser) { |
45 | let m = p.start(); | 45 | let m = p.start(); |
46 | if p.eat(REF_KW) { | 46 | p.eat(REF_KW); |
47 | p.eat(MUT_KW); | 47 | p.eat(MUT_KW); |
48 | } else { | ||
49 | p.eat(MUT_KW); | ||
50 | } | ||
51 | name(p); | 48 | name(p); |
52 | if p.eat(AT) { | 49 | if p.eat(AT) { |
53 | pattern(p); | 50 | pattern(p); |
diff --git a/src/parser/grammar/type_args.rs b/src/parser/grammar/type_args.rs index 20e75b4b0..adac73e7e 100644 --- a/src/parser/grammar/type_args.rs +++ b/src/parser/grammar/type_args.rs | |||
@@ -12,7 +12,7 @@ pub(super) fn list(p: &mut Parser, colon_colon_required: bool) { | |||
12 | m = p.start(); | 12 | m = p.start(); |
13 | p.bump(); | 13 | p.bump(); |
14 | } | 14 | } |
15 | _ => return | 15 | _ => return, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | while !p.at(EOF) && !p.at(R_ANGLE) { | 18 | while !p.at(EOF) && !p.at(R_ANGLE) { |