diff options
author | Aleksey Kladov <[email protected]> | 2019-11-14 14:36:27 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-14 14:36:27 +0000 |
commit | ef02296b9fe2c2e42b9390a3a14ee860f08fd02c (patch) | |
tree | 69c93778505bc88031b3f945fb89c72d3e4659bb /crates/ra_parser | |
parent | 5c3ccc55082838524f695ffe40138fd8e805db70 (diff) |
Simplify parsing
Diffstat (limited to 'crates/ra_parser')
-rw-r--r-- | crates/ra_parser/src/grammar/expressions/atom.rs | 34 | ||||
-rw-r--r-- | crates/ra_parser/src/token_set.rs | 4 |
2 files changed, 19 insertions, 19 deletions
diff --git a/crates/ra_parser/src/grammar/expressions/atom.rs b/crates/ra_parser/src/grammar/expressions/atom.rs index 4952bd189..f06191963 100644 --- a/crates/ra_parser/src/grammar/expressions/atom.rs +++ b/crates/ra_parser/src/grammar/expressions/atom.rs | |||
@@ -40,24 +40,24 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> { | |||
40 | // E.g. for after the break in `if break {}`, this should not match | 40 | // E.g. for after the break in `if break {}`, this should not match |
41 | pub(super) const ATOM_EXPR_FIRST: TokenSet = | 41 | pub(super) const ATOM_EXPR_FIRST: TokenSet = |
42 | LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![ | 42 | LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![ |
43 | L_PAREN, | 43 | T!['('], |
44 | L_CURLY, | 44 | T!['{'], |
45 | L_BRACK, | 45 | T!['['], |
46 | PIPE, | 46 | T![|], |
47 | MOVE_KW, | 47 | T![move], |
48 | BOX_KW, | 48 | T![box], |
49 | IF_KW, | 49 | T![if], |
50 | WHILE_KW, | 50 | T![while], |
51 | MATCH_KW, | 51 | T![match], |
52 | UNSAFE_KW, | 52 | T![unsafe], |
53 | RETURN_KW, | 53 | T![return], |
54 | BREAK_KW, | 54 | T![break], |
55 | CONTINUE_KW, | 55 | T![continue], |
56 | T![async], | ||
57 | T![try], | ||
58 | T![loop], | ||
59 | T![for], | ||
56 | LIFETIME, | 60 | LIFETIME, |
57 | ASYNC_KW, | ||
58 | TRY_KW, | ||
59 | LOOP_KW, | ||
60 | FOR_KW, | ||
61 | ]); | 61 | ]); |
62 | 62 | ||
63 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; | 63 | const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW]; |
diff --git a/crates/ra_parser/src/token_set.rs b/crates/ra_parser/src/token_set.rs index 6dc061889..2a6952c01 100644 --- a/crates/ra_parser/src/token_set.rs +++ b/crates/ra_parser/src/token_set.rs | |||
@@ -30,8 +30,8 @@ const fn mask(kind: SyntaxKind) -> u128 { | |||
30 | 30 | ||
31 | #[macro_export] | 31 | #[macro_export] |
32 | macro_rules! token_set { | 32 | macro_rules! token_set { |
33 | ($($t:ident),*) => { TokenSet::empty()$(.union(TokenSet::singleton($t)))* }; | 33 | ($($t:expr),*) => { TokenSet::empty()$(.union(TokenSet::singleton($t)))* }; |
34 | ($($t:ident),* ,) => { token_set!($($t),*) }; | 34 | ($($t:expr),* ,) => { token_set!($($t),*) }; |
35 | } | 35 | } |
36 | 36 | ||
37 | #[test] | 37 | #[test] |