mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-29 06:23:25 +00:00
2bf81922f7
Consider these expples { 92 } async { 92 } 'a: { 92 } #[a] { 92 } Previously the tree for them were BLOCK_EXPR { ... } EFFECT_EXPR async BLOCK_EXPR { ... } EFFECT_EXPR 'a: BLOCK_EXPR { ... } BLOCK_EXPR #[a] { ... } As you see, it gets progressively worse :) The last two items are especially odd. The last one even violates the balanced curleys invariant we have (#10357) The new approach is to say that the stuff in `{}` is stmt_list, and the block is stmt_list + optional modifiers BLOCK_EXPR STMT_LIST { ... } BLOCK_EXPR async STMT_LIST { ... } BLOCK_EXPR 'a: STMT_LIST { ... } BLOCK_EXPR #[a] STMT_LIST { ... }
133 lines
3.2 KiB
Text
133 lines
3.2 KiB
Text
SOURCE_FILE@0..122
|
|
FN@0..9
|
|
FN_KW@0..2 "fn"
|
|
WHITESPACE@2..3 " "
|
|
NAME@3..4
|
|
IDENT@3..4 "a"
|
|
PARAM_LIST@4..6
|
|
L_PAREN@4..5 "("
|
|
R_PAREN@5..6 ")"
|
|
WHITESPACE@6..7 " "
|
|
BLOCK_EXPR@7..9
|
|
STMT_LIST@7..9
|
|
L_CURLY@7..8 "{"
|
|
R_CURLY@8..9 "}"
|
|
WHITESPACE@9..10 "\n"
|
|
FN@10..23
|
|
VISIBILITY@10..13
|
|
PUB_KW@10..13 "pub"
|
|
WHITESPACE@13..14 " "
|
|
FN_KW@14..16 "fn"
|
|
WHITESPACE@16..17 " "
|
|
NAME@17..18
|
|
IDENT@17..18 "b"
|
|
PARAM_LIST@18..20
|
|
L_PAREN@18..19 "("
|
|
R_PAREN@19..20 ")"
|
|
WHITESPACE@20..21 " "
|
|
BLOCK_EXPR@21..23
|
|
STMT_LIST@21..23
|
|
L_CURLY@21..22 "{"
|
|
R_CURLY@22..23 "}"
|
|
WHITESPACE@23..24 "\n"
|
|
MACRO_DEF@24..47
|
|
VISIBILITY@24..27
|
|
PUB_KW@24..27 "pub"
|
|
WHITESPACE@27..28 " "
|
|
MACRO_KW@28..33 "macro"
|
|
WHITESPACE@33..34 " "
|
|
NAME@34..35
|
|
IDENT@34..35 "m"
|
|
TOKEN_TREE@35..47
|
|
TOKEN_TREE@35..44
|
|
L_PAREN@35..36 "("
|
|
DOLLAR@36..37 "$"
|
|
COLON@37..38 ":"
|
|
IDENT@38..43 "ident"
|
|
R_PAREN@43..44 ")"
|
|
WHITESPACE@44..45 " "
|
|
TOKEN_TREE@45..47
|
|
L_CURLY@45..46 "{"
|
|
R_CURLY@46..47 "}"
|
|
WHITESPACE@47..48 "\n"
|
|
FN@48..68
|
|
VISIBILITY@48..58
|
|
PUB_KW@48..51 "pub"
|
|
L_PAREN@51..52 "("
|
|
PATH@52..57
|
|
PATH_SEGMENT@52..57
|
|
NAME_REF@52..57
|
|
CRATE_KW@52..57 "crate"
|
|
R_PAREN@57..58 ")"
|
|
WHITESPACE@58..59 " "
|
|
FN_KW@59..61 "fn"
|
|
WHITESPACE@61..62 " "
|
|
NAME@62..63
|
|
IDENT@62..63 "c"
|
|
PARAM_LIST@63..65
|
|
L_PAREN@63..64 "("
|
|
R_PAREN@64..65 ")"
|
|
WHITESPACE@65..66 " "
|
|
BLOCK_EXPR@66..68
|
|
STMT_LIST@66..68
|
|
L_CURLY@66..67 "{"
|
|
R_CURLY@67..68 "}"
|
|
WHITESPACE@68..69 "\n"
|
|
FN@69..89
|
|
VISIBILITY@69..79
|
|
PUB_KW@69..72 "pub"
|
|
L_PAREN@72..73 "("
|
|
PATH@73..78
|
|
PATH_SEGMENT@73..78
|
|
NAME_REF@73..78
|
|
SUPER_KW@73..78 "super"
|
|
R_PAREN@78..79 ")"
|
|
WHITESPACE@79..80 " "
|
|
FN_KW@80..82 "fn"
|
|
WHITESPACE@82..83 " "
|
|
NAME@83..84
|
|
IDENT@83..84 "d"
|
|
PARAM_LIST@84..86
|
|
L_PAREN@84..85 "("
|
|
R_PAREN@85..86 ")"
|
|
WHITESPACE@86..87 " "
|
|
BLOCK_EXPR@87..89
|
|
STMT_LIST@87..89
|
|
L_CURLY@87..88 "{"
|
|
R_CURLY@88..89 "}"
|
|
WHITESPACE@89..90 "\n"
|
|
FN@90..121
|
|
VISIBILITY@90..111
|
|
PUB_KW@90..93 "pub"
|
|
L_PAREN@93..94 "("
|
|
IN_KW@94..96 "in"
|
|
WHITESPACE@96..97 " "
|
|
PATH@97..110
|
|
PATH@97..105
|
|
PATH@97..100
|
|
PATH_SEGMENT@97..100
|
|
NAME_REF@97..100
|
|
IDENT@97..100 "foo"
|
|
COLON2@100..102 "::"
|
|
PATH_SEGMENT@102..105
|
|
NAME_REF@102..105
|
|
IDENT@102..105 "bar"
|
|
COLON2@105..107 "::"
|
|
PATH_SEGMENT@107..110
|
|
NAME_REF@107..110
|
|
IDENT@107..110 "baz"
|
|
R_PAREN@110..111 ")"
|
|
WHITESPACE@111..112 " "
|
|
FN_KW@112..114 "fn"
|
|
WHITESPACE@114..115 " "
|
|
NAME@115..116
|
|
IDENT@115..116 "e"
|
|
PARAM_LIST@116..118
|
|
L_PAREN@116..117 "("
|
|
R_PAREN@117..118 ")"
|
|
WHITESPACE@118..119 " "
|
|
BLOCK_EXPR@119..121
|
|
STMT_LIST@119..121
|
|
L_CURLY@119..120 "{"
|
|
R_CURLY@120..121 "}"
|
|
WHITESPACE@121..122 "\n"
|