mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
make token set a const-fn
This commit is contained in:
parent
b028472481
commit
b82fe73d1a
8 changed files with 52 additions and 57 deletions
|
@ -36,29 +36,26 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> {
|
|||
}
|
||||
|
||||
// E.g. for after the break in `if break {}`, this should not match
|
||||
pub(super) const ATOM_EXPR_FIRST: TokenSet = token_set_union![
|
||||
LITERAL_FIRST,
|
||||
token_set![
|
||||
L_PAREN,
|
||||
L_CURLY,
|
||||
L_BRACK,
|
||||
PIPE,
|
||||
MOVE_KW,
|
||||
IF_KW,
|
||||
WHILE_KW,
|
||||
MATCH_KW,
|
||||
UNSAFE_KW,
|
||||
RETURN_KW,
|
||||
IDENT,
|
||||
SELF_KW,
|
||||
SUPER_KW,
|
||||
CRATE_KW,
|
||||
COLONCOLON,
|
||||
BREAK_KW,
|
||||
CONTINUE_KW,
|
||||
LIFETIME
|
||||
],
|
||||
];
|
||||
pub(super) const ATOM_EXPR_FIRST: TokenSet = LITERAL_FIRST.union(token_set![
|
||||
L_PAREN,
|
||||
L_CURLY,
|
||||
L_BRACK,
|
||||
PIPE,
|
||||
MOVE_KW,
|
||||
IF_KW,
|
||||
WHILE_KW,
|
||||
MATCH_KW,
|
||||
UNSAFE_KW,
|
||||
RETURN_KW,
|
||||
IDENT,
|
||||
SELF_KW,
|
||||
SUPER_KW,
|
||||
CRATE_KW,
|
||||
COLONCOLON,
|
||||
BREAK_KW,
|
||||
CONTINUE_KW,
|
||||
LIFETIME,
|
||||
]);
|
||||
|
||||
const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
|
||||
|
||||
|
@ -363,7 +360,7 @@ pub(crate) fn match_arm_list(p: &mut Parser) {
|
|||
fn match_arm(p: &mut Parser) -> BlockLike {
|
||||
let m = p.start();
|
||||
p.eat(PIPE);
|
||||
patterns::pattern_r(p, TokenSet::EMPTY);
|
||||
patterns::pattern_r(p, TokenSet::empty());
|
||||
while p.eat(PIPE) {
|
||||
patterns::pattern(p);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue