diff options
author | Aleksey Kladov <[email protected]> | 2019-01-18 08:02:30 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-01-19 12:36:58 +0000 |
commit | b82fe73d1ab9727ff650382d9c86a231b06245be (patch) | |
tree | e919865c68f78492bab5baa574f1a35a094b0339 /crates/ra_syntax/src/grammar/expressions | |
parent | b028472481df108537b60104314081b65bf51147 (diff) |
make token set a const-fn
Diffstat (limited to 'crates/ra_syntax/src/grammar/expressions')
-rw-r--r-- | crates/ra_syntax/src/grammar/expressions/atom.rs | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/crates/ra_syntax/src/grammar/expressions/atom.rs b/crates/ra_syntax/src/grammar/expressions/atom.rs index 31b09ac5b..167a76551 100644 --- a/crates/ra_syntax/src/grammar/expressions/atom.rs +++ b/crates/ra_syntax/src/grammar/expressions/atom.rs | |||
@@ -36,29 +36,26 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> { | |||
36 | } | 36 | } |
37 | 37 | ||
38 | // E.g. for after the break in `if break {}`, this should not match | 38 | // E.g. for after the break in `if break {}`, this should not match |
39 | pub(super) const ATOM_EXPR_FIRST: TokenSet = token_set_union![ | 39 | pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![ |
40 | LITERAL_FIRST, | 40 | L_PAREN, |
41 | token_set![ | 41 | L_CURLY, |
42 | L_PAREN, | 42 | L_BRACK, |
43 | L_CURLY, | 43 | PIPE, |
44 | L_BRACK, | 44 | MOVE_KW, |
45 | PIPE, | 45 | IF_KW, |
46 | MOVE_KW, | 46 | WHILE_KW, |
47 | IF_KW, | 47 | MATCH_KW, |
48 | WHILE_KW, | 48 | UNSAFE_KW, |
49 | MATCH_KW, | 49 | RETURN_KW, |
50 | UNSAFE_KW, | 50 | IDENT, |
51 | RETURN_KW, | 51 | SELF_KW, |
52 | IDENT, | 52 | SUPER_KW, |
53 | SELF_KW, | 53 | CRATE_KW, |
54 | SUPER_KW, | 54 | COLONCOLON, |
55 | CRATE_KW, | 55 | BREAK_KW, |
56 | COLONCOLON, | 56 | CONTINUE_KW, |
57 | BREAK_KW, | 57 | LIFETIME, |
58 | CONTINUE_KW, | 58 | ]); |
59 | LIFETIME | ||
60 | ], | ||
61 | ]; | ||
62 | 59 | ||
63 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; | 60 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; |
64 | 61 | ||
@@ -363,7 +360,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) { | |||
363 | fn match_arm(p: &mut Parser) -> BlockLike { | 360 | fn match_arm(p: &mut Parser) -> BlockLike { |
364 | let m = p.start(); | 361 | let m = p.start(); |
365 | p.eat(PIPE); | 362 | p.eat(PIPE); |
366 | patterns::pattern_r(p, TokenSet::EMPTY); | 363 | patterns::pattern_r(p, TokenSet::empty()); |
367 | while p.eat(PIPE) { | 364 | while p.eat(PIPE) { |
368 | patterns::pattern(p); | 365 | patterns::pattern(p); |
369 | } | 366 | } |