mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Simplify parsing
This commit is contained in:
parent
5c3ccc5508
commit
ef02296b9f
2 changed files with 19 additions and 19 deletions
|
@ -40,24 +40,24 @@ pub(crate) fn literal(p: &mut Parser) -> Option<CompletedMarker> {
|
||||||
// E.g. for after the break in `if break {}`, this should not match
|
// E.g. for after the break in `if break {}`, this should not match
|
||||||
pub(super) const ATOM_EXPR_FIRST: TokenSet =
|
pub(super) const ATOM_EXPR_FIRST: TokenSet =
|
||||||
LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![
|
LITERAL_FIRST.union(paths::PATH_FIRST).union(token_set![
|
||||||
L_PAREN,
|
T!['('],
|
||||||
L_CURLY,
|
T!['{'],
|
||||||
L_BRACK,
|
T!['['],
|
||||||
PIPE,
|
T![|],
|
||||||
MOVE_KW,
|
T![move],
|
||||||
BOX_KW,
|
T![box],
|
||||||
IF_KW,
|
T![if],
|
||||||
WHILE_KW,
|
T![while],
|
||||||
MATCH_KW,
|
T![match],
|
||||||
UNSAFE_KW,
|
T![unsafe],
|
||||||
RETURN_KW,
|
T![return],
|
||||||
BREAK_KW,
|
T![break],
|
||||||
CONTINUE_KW,
|
T![continue],
|
||||||
|
T![async],
|
||||||
|
T![try],
|
||||||
|
T![loop],
|
||||||
|
T![for],
|
||||||
LIFETIME,
|
LIFETIME,
|
||||||
ASYNC_KW,
|
|
||||||
TRY_KW,
|
|
||||||
LOOP_KW,
|
|
||||||
FOR_KW,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
|
const EXPR_RECOVERY_SET: TokenSet = token_set![LET_KW];
|
||||||
|
|
|
@ -30,8 +30,8 @@ const fn mask(kind: SyntaxKind) -> u128 {
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! token_set {
|
macro_rules! token_set {
|
||||||
($($t:ident),*) => { TokenSet::empty()$(.union(TokenSet::singleton($t)))* };
|
($($t:expr),*) => { TokenSet::empty()$(.union(TokenSet::singleton($t)))* };
|
||||||
($($t:ident),* ,) => { token_set!($($t),*) };
|
($($t:expr),* ,) => { token_set!($($t),*) };
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue