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 { ... }
549 lines
17 KiB
Plaintext
549 lines
17 KiB
Plaintext
SOURCE_FILE@0..519
|
|
FN@0..37
|
|
FN_KW@0..2 "fn"
|
|
WHITESPACE@2..3 " "
|
|
NAME@3..5
|
|
IDENT@3..5 "g1"
|
|
PARAM_LIST@5..34
|
|
L_PAREN@5..6 "("
|
|
PARAM@6..33
|
|
ATTR@6..14
|
|
POUND@6..7 "#"
|
|
L_BRACK@7..8 "["
|
|
META@8..13
|
|
PATH@8..13
|
|
PATH_SEGMENT@8..13
|
|
NAME_REF@8..13
|
|
IDENT@8..13 "attr1"
|
|
R_BRACK@13..14 "]"
|
|
WHITESPACE@14..15 " "
|
|
ATTR@15..23
|
|
POUND@15..16 "#"
|
|
L_BRACK@16..17 "["
|
|
META@17..22
|
|
PATH@17..22
|
|
PATH_SEGMENT@17..22
|
|
NAME_REF@17..22
|
|
IDENT@17..22 "attr2"
|
|
R_BRACK@22..23 "]"
|
|
WHITESPACE@23..24 " "
|
|
IDENT_PAT@24..27
|
|
NAME@24..27
|
|
IDENT@24..27 "pat"
|
|
COLON@27..28 ":"
|
|
WHITESPACE@28..29 " "
|
|
PATH_TYPE@29..33
|
|
PATH@29..33
|
|
PATH_SEGMENT@29..33
|
|
NAME_REF@29..33
|
|
IDENT@29..33 "Type"
|
|
R_PAREN@33..34 ")"
|
|
WHITESPACE@34..35 " "
|
|
BLOCK_EXPR@35..37
|
|
STMT_LIST@35..37
|
|
L_CURLY@35..36 "{"
|
|
R_CURLY@36..37 "}"
|
|
WHITESPACE@37..38 "\n"
|
|
FN@38..62
|
|
FN_KW@38..40 "fn"
|
|
WHITESPACE@40..41 " "
|
|
NAME@41..43
|
|
IDENT@41..43 "g2"
|
|
PARAM_LIST@43..59
|
|
L_PAREN@43..44 "("
|
|
PARAM@44..58
|
|
ATTR@44..52
|
|
POUND@44..45 "#"
|
|
L_BRACK@45..46 "["
|
|
META@46..51
|
|
PATH@46..51
|
|
PATH_SEGMENT@46..51
|
|
NAME_REF@46..51
|
|
IDENT@46..51 "attr1"
|
|
R_BRACK@51..52 "]"
|
|
WHITESPACE@52..53 " "
|
|
IDENT_PAT@53..54
|
|
NAME@53..54
|
|
IDENT@53..54 "x"
|
|
COLON@54..55 ":"
|
|
WHITESPACE@55..56 " "
|
|
PATH_TYPE@56..58
|
|
PATH@56..58
|
|
PATH_SEGMENT@56..58
|
|
NAME_REF@56..58
|
|
IDENT@56..58 "u8"
|
|
R_PAREN@58..59 ")"
|
|
WHITESPACE@59..60 " "
|
|
BLOCK_EXPR@60..62
|
|
STMT_LIST@60..62
|
|
L_CURLY@60..61 "{"
|
|
R_CURLY@61..62 "}"
|
|
WHITESPACE@62..64 "\n\n"
|
|
EXTERN_BLOCK@64..128
|
|
ABI@64..74
|
|
EXTERN_KW@64..70 "extern"
|
|
WHITESPACE@70..71 " "
|
|
STRING@71..74 "\"C\""
|
|
WHITESPACE@74..75 " "
|
|
EXTERN_ITEM_LIST@75..128
|
|
L_CURLY@75..76 "{"
|
|
WHITESPACE@76..77 " "
|
|
FN@77..126
|
|
FN_KW@77..79 "fn"
|
|
WHITESPACE@79..80 " "
|
|
NAME@80..86
|
|
IDENT@80..86 "printf"
|
|
PARAM_LIST@86..118
|
|
L_PAREN@86..87 "("
|
|
PARAM@87..104
|
|
IDENT_PAT@87..93
|
|
NAME@87..93
|
|
IDENT@87..93 "format"
|
|
COLON@93..94 ":"
|
|
WHITESPACE@94..95 " "
|
|
PTR_TYPE@95..104
|
|
STAR@95..96 "*"
|
|
CONST_KW@96..101 "const"
|
|
WHITESPACE@101..102 " "
|
|
PATH_TYPE@102..104
|
|
PATH@102..104
|
|
PATH_SEGMENT@102..104
|
|
NAME_REF@102..104
|
|
IDENT@102..104 "i8"
|
|
COMMA@104..105 ","
|
|
WHITESPACE@105..106 " "
|
|
PARAM@106..117
|
|
ATTR@106..113
|
|
POUND@106..107 "#"
|
|
L_BRACK@107..108 "["
|
|
META@108..112
|
|
PATH@108..112
|
|
PATH_SEGMENT@108..112
|
|
NAME_REF@108..112
|
|
IDENT@108..112 "attr"
|
|
R_BRACK@112..113 "]"
|
|
WHITESPACE@113..114 " "
|
|
DOT3@114..117 "..."
|
|
R_PAREN@117..118 ")"
|
|
WHITESPACE@118..119 " "
|
|
RET_TYPE@119..125
|
|
THIN_ARROW@119..121 "->"
|
|
WHITESPACE@121..122 " "
|
|
PATH_TYPE@122..125
|
|
PATH@122..125
|
|
PATH_SEGMENT@122..125
|
|
NAME_REF@122..125
|
|
IDENT@122..125 "i32"
|
|
SEMICOLON@125..126 ";"
|
|
WHITESPACE@126..127 " "
|
|
R_CURLY@127..128 "}"
|
|
WHITESPACE@128..130 "\n\n"
|
|
FN@130..172
|
|
FN_KW@130..132 "fn"
|
|
WHITESPACE@132..133 " "
|
|
NAME@133..136
|
|
IDENT@133..136 "foo"
|
|
GENERIC_PARAM_LIST@136..168
|
|
L_ANGLE@136..137 "<"
|
|
TYPE_PARAM@137..167
|
|
NAME@137..138
|
|
IDENT@137..138 "F"
|
|
COLON@138..139 ":"
|
|
WHITESPACE@139..140 " "
|
|
TYPE_BOUND_LIST@140..167
|
|
TYPE_BOUND@140..167
|
|
PATH_TYPE@140..167
|
|
PATH@140..167
|
|
PATH_SEGMENT@140..167
|
|
NAME_REF@140..145
|
|
IDENT@140..145 "FnMut"
|
|
PARAM_LIST@145..167
|
|
L_PAREN@145..146 "("
|
|
PARAM@146..166
|
|
ATTR@146..153
|
|
POUND@146..147 "#"
|
|
L_BRACK@147..148 "["
|
|
META@148..152
|
|
PATH@148..152
|
|
PATH_SEGMENT@148..152
|
|
NAME_REF@148..152
|
|
IDENT@148..152 "attr"
|
|
R_BRACK@152..153 "]"
|
|
WHITESPACE@153..154 " "
|
|
REF_TYPE@154..166
|
|
AMP@154..155 "&"
|
|
MUT_KW@155..158 "mut"
|
|
WHITESPACE@158..159 " "
|
|
PATH_TYPE@159..166
|
|
PATH@159..166
|
|
PATH_SEGMENT@159..166
|
|
NAME_REF@159..162
|
|
IDENT@159..162 "Foo"
|
|
GENERIC_ARG_LIST@162..166
|
|
L_ANGLE@162..163 "<"
|
|
LIFETIME_ARG@163..165
|
|
LIFETIME@163..165
|
|
LIFETIME_IDENT@163..165 "'a"
|
|
R_ANGLE@165..166 ">"
|
|
R_PAREN@166..167 ")"
|
|
R_ANGLE@167..168 ">"
|
|
PARAM_LIST@168..170
|
|
L_PAREN@168..169 "("
|
|
R_PAREN@169..170 ")"
|
|
BLOCK_EXPR@170..172
|
|
STMT_LIST@170..172
|
|
L_CURLY@170..171 "{"
|
|
R_CURLY@171..172 "}"
|
|
WHITESPACE@172..174 "\n\n"
|
|
TRAIT@174..236
|
|
TRAIT_KW@174..179 "trait"
|
|
WHITESPACE@179..180 " "
|
|
NAME@180..183
|
|
IDENT@180..183 "Foo"
|
|
WHITESPACE@183..184 " "
|
|
ASSOC_ITEM_LIST@184..236
|
|
L_CURLY@184..185 "{"
|
|
WHITESPACE@185..190 "\n "
|
|
FN@190..234
|
|
FN_KW@190..192 "fn"
|
|
WHITESPACE@192..193 " "
|
|
NAME@193..196
|
|
IDENT@193..196 "bar"
|
|
PARAM_LIST@196..233
|
|
L_PAREN@196..197 "("
|
|
PARAM@197..211
|
|
ATTR@197..204
|
|
POUND@197..198 "#"
|
|
L_BRACK@198..199 "["
|
|
META@199..203
|
|
PATH@199..203
|
|
PATH_SEGMENT@199..203
|
|
NAME_REF@199..203
|
|
IDENT@199..203 "attr"
|
|
R_BRACK@203..204 "]"
|
|
WHITESPACE@204..205 " "
|
|
WILDCARD_PAT@205..206
|
|
UNDERSCORE@205..206 "_"
|
|
COLON@206..207 ":"
|
|
WHITESPACE@207..208 " "
|
|
PATH_TYPE@208..211
|
|
PATH@208..211
|
|
PATH_SEGMENT@208..211
|
|
NAME_REF@208..211
|
|
IDENT@208..211 "u64"
|
|
COMMA@211..212 ","
|
|
WHITESPACE@212..213 " "
|
|
PARAM@213..232
|
|
ATTR@213..221
|
|
POUND@213..214 "#"
|
|
WHITESPACE@214..215 " "
|
|
L_BRACK@215..216 "["
|
|
META@216..220
|
|
PATH@216..220
|
|
PATH_SEGMENT@216..220
|
|
NAME_REF@216..220
|
|
IDENT@216..220 "attr"
|
|
R_BRACK@220..221 "]"
|
|
WHITESPACE@221..222 " "
|
|
IDENT_PAT@222..227
|
|
MUT_KW@222..225 "mut"
|
|
WHITESPACE@225..226 " "
|
|
NAME@226..227
|
|
IDENT@226..227 "x"
|
|
COLON@227..228 ":"
|
|
WHITESPACE@228..229 " "
|
|
PATH_TYPE@229..232
|
|
PATH@229..232
|
|
PATH_SEGMENT@229..232
|
|
NAME_REF@229..232
|
|
IDENT@229..232 "i32"
|
|
R_PAREN@232..233 ")"
|
|
SEMICOLON@233..234 ";"
|
|
WHITESPACE@234..235 "\n"
|
|
R_CURLY@235..236 "}"
|
|
WHITESPACE@236..238 "\n\n"
|
|
IMPL@238..519
|
|
IMPL_KW@238..242 "impl"
|
|
WHITESPACE@242..243 " "
|
|
PATH_TYPE@243..244
|
|
PATH@243..244
|
|
PATH_SEGMENT@243..244
|
|
NAME_REF@243..244
|
|
IDENT@243..244 "S"
|
|
WHITESPACE@244..245 " "
|
|
ASSOC_ITEM_LIST@245..519
|
|
L_CURLY@245..246 "{"
|
|
WHITESPACE@246..252 "\n "
|
|
FN@252..277
|
|
FN_KW@252..254 "fn"
|
|
WHITESPACE@254..255 " "
|
|
NAME@255..256
|
|
IDENT@255..256 "f"
|
|
PARAM_LIST@256..274
|
|
L_PAREN@256..257 "("
|
|
SELF_PARAM@257..273
|
|
ATTR@257..268
|
|
POUND@257..258 "#"
|
|
L_BRACK@258..259 "["
|
|
META@259..267
|
|
PATH@259..267
|
|
PATH_SEGMENT@259..267
|
|
NAME_REF@259..267
|
|
IDENT@259..267 "must_use"
|
|
R_BRACK@267..268 "]"
|
|
WHITESPACE@268..269 " "
|
|
NAME@269..273
|
|
SELF_KW@269..273 "self"
|
|
R_PAREN@273..274 ")"
|
|
WHITESPACE@274..275 " "
|
|
BLOCK_EXPR@275..277
|
|
STMT_LIST@275..277
|
|
L_CURLY@275..276 "{"
|
|
R_CURLY@276..277 "}"
|
|
WHITESPACE@277..283 "\n "
|
|
FN@283..305
|
|
FN_KW@283..285 "fn"
|
|
WHITESPACE@285..286 " "
|
|
NAME@286..288
|
|
IDENT@286..288 "g1"
|
|
PARAM_LIST@288..302
|
|
L_PAREN@288..289 "("
|
|
SELF_PARAM@289..301
|
|
ATTR@289..296
|
|
POUND@289..290 "#"
|
|
L_BRACK@290..291 "["
|
|
META@291..295
|
|
PATH@291..295
|
|
PATH_SEGMENT@291..295
|
|
NAME_REF@291..295
|
|
IDENT@291..295 "attr"
|
|
R_BRACK@295..296 "]"
|
|
WHITESPACE@296..297 " "
|
|
NAME@297..301
|
|
SELF_KW@297..301 "self"
|
|
R_PAREN@301..302 ")"
|
|
WHITESPACE@302..303 " "
|
|
BLOCK_EXPR@303..305
|
|
STMT_LIST@303..305
|
|
L_CURLY@303..304 "{"
|
|
R_CURLY@304..305 "}"
|
|
WHITESPACE@305..311 "\n "
|
|
FN@311..334
|
|
FN_KW@311..313 "fn"
|
|
WHITESPACE@313..314 " "
|
|
NAME@314..316
|
|
IDENT@314..316 "g2"
|
|
PARAM_LIST@316..331
|
|
L_PAREN@316..317 "("
|
|
SELF_PARAM@317..330
|
|
ATTR@317..324
|
|
POUND@317..318 "#"
|
|
L_BRACK@318..319 "["
|
|
META@319..323
|
|
PATH@319..323
|
|
PATH_SEGMENT@319..323
|
|
NAME_REF@319..323
|
|
IDENT@319..323 "attr"
|
|
R_BRACK@323..324 "]"
|
|
WHITESPACE@324..325 " "
|
|
AMP@325..326 "&"
|
|
NAME@326..330
|
|
SELF_KW@326..330 "self"
|
|
R_PAREN@330..331 ")"
|
|
WHITESPACE@331..332 " "
|
|
BLOCK_EXPR@332..334
|
|
STMT_LIST@332..334
|
|
L_CURLY@332..333 "{"
|
|
R_CURLY@333..334 "}"
|
|
WHITESPACE@334..340 "\n "
|
|
FN@340..371
|
|
FN_KW@340..342 "fn"
|
|
WHITESPACE@342..343 " "
|
|
NAME@343..345
|
|
IDENT@343..345 "g3"
|
|
GENERIC_PARAM_LIST@345..349
|
|
L_ANGLE@345..346 "<"
|
|
LIFETIME_PARAM@346..348
|
|
LIFETIME@346..348
|
|
LIFETIME_IDENT@346..348 "'a"
|
|
R_ANGLE@348..349 ">"
|
|
PARAM_LIST@349..368
|
|
L_PAREN@349..350 "("
|
|
SELF_PARAM@350..367
|
|
ATTR@350..357
|
|
POUND@350..351 "#"
|
|
L_BRACK@351..352 "["
|
|
META@352..356
|
|
PATH@352..356
|
|
PATH_SEGMENT@352..356
|
|
NAME_REF@352..356
|
|
IDENT@352..356 "attr"
|
|
R_BRACK@356..357 "]"
|
|
WHITESPACE@357..358 " "
|
|
AMP@358..359 "&"
|
|
MUT_KW@359..362 "mut"
|
|
WHITESPACE@362..363 " "
|
|
NAME@363..367
|
|
SELF_KW@363..367 "self"
|
|
R_PAREN@367..368 ")"
|
|
WHITESPACE@368..369 " "
|
|
BLOCK_EXPR@369..371
|
|
STMT_LIST@369..371
|
|
L_CURLY@369..370 "{"
|
|
R_CURLY@370..371 "}"
|
|
WHITESPACE@371..377 "\n "
|
|
FN@377..407
|
|
FN_KW@377..379 "fn"
|
|
WHITESPACE@379..380 " "
|
|
NAME@380..382
|
|
IDENT@380..382 "g4"
|
|
GENERIC_PARAM_LIST@382..386
|
|
L_ANGLE@382..383 "<"
|
|
LIFETIME_PARAM@383..385
|
|
LIFETIME@383..385
|
|
LIFETIME_IDENT@383..385 "'a"
|
|
R_ANGLE@385..386 ">"
|
|
PARAM_LIST@386..404
|
|
L_PAREN@386..387 "("
|
|
SELF_PARAM@387..403
|
|
ATTR@387..394
|
|
POUND@387..388 "#"
|
|
L_BRACK@388..389 "["
|
|
META@389..393
|
|
PATH@389..393
|
|
PATH_SEGMENT@389..393
|
|
NAME_REF@389..393
|
|
IDENT@389..393 "attr"
|
|
R_BRACK@393..394 "]"
|
|
WHITESPACE@394..395 " "
|
|
AMP@395..396 "&"
|
|
LIFETIME@396..398
|
|
LIFETIME_IDENT@396..398 "'a"
|
|
WHITESPACE@398..399 " "
|
|
NAME@399..403
|
|
SELF_KW@399..403 "self"
|
|
R_PAREN@403..404 ")"
|
|
WHITESPACE@404..405 " "
|
|
BLOCK_EXPR@405..407
|
|
STMT_LIST@405..407
|
|
L_CURLY@405..406 "{"
|
|
R_CURLY@406..407 "}"
|
|
WHITESPACE@407..413 "\n "
|
|
FN@413..447
|
|
FN_KW@413..415 "fn"
|
|
WHITESPACE@415..416 " "
|
|
NAME@416..418
|
|
IDENT@416..418 "g5"
|
|
GENERIC_PARAM_LIST@418..422
|
|
L_ANGLE@418..419 "<"
|
|
LIFETIME_PARAM@419..421
|
|
LIFETIME@419..421
|
|
LIFETIME_IDENT@419..421 "'a"
|
|
R_ANGLE@421..422 ">"
|
|
PARAM_LIST@422..444
|
|
L_PAREN@422..423 "("
|
|
SELF_PARAM@423..443
|
|
ATTR@423..430
|
|
POUND@423..424 "#"
|
|
L_BRACK@424..425 "["
|
|
META@425..429
|
|
PATH@425..429
|
|
PATH_SEGMENT@425..429
|
|
NAME_REF@425..429
|
|
IDENT@425..429 "attr"
|
|
R_BRACK@429..430 "]"
|
|
WHITESPACE@430..431 " "
|
|
AMP@431..432 "&"
|
|
LIFETIME@432..434
|
|
LIFETIME_IDENT@432..434 "'a"
|
|
WHITESPACE@434..435 " "
|
|
MUT_KW@435..438 "mut"
|
|
WHITESPACE@438..439 " "
|
|
NAME@439..443
|
|
SELF_KW@439..443 "self"
|
|
R_PAREN@443..444 ")"
|
|
WHITESPACE@444..445 " "
|
|
BLOCK_EXPR@445..447
|
|
STMT_LIST@445..447
|
|
L_CURLY@445..446 "{"
|
|
R_CURLY@446..447 "}"
|
|
WHITESPACE@447..453 "\n "
|
|
FN@453..480
|
|
FN_KW@453..455 "fn"
|
|
WHITESPACE@455..456 " "
|
|
NAME@456..457
|
|
IDENT@456..457 "c"
|
|
PARAM_LIST@457..477
|
|
L_PAREN@457..458 "("
|
|
SELF_PARAM@458..476
|
|
ATTR@458..465
|
|
POUND@458..459 "#"
|
|
L_BRACK@459..460 "["
|
|
META@460..464
|
|
PATH@460..464
|
|
PATH_SEGMENT@460..464
|
|
NAME_REF@460..464
|
|
IDENT@460..464 "attr"
|
|
R_BRACK@464..465 "]"
|
|
WHITESPACE@465..466 " "
|
|
NAME@466..470
|
|
SELF_KW@466..470 "self"
|
|
COLON@470..471 ":"
|
|
WHITESPACE@471..472 " "
|
|
PATH_TYPE@472..476
|
|
PATH@472..476
|
|
PATH_SEGMENT@472..476
|
|
NAME_REF@472..476
|
|
IDENT@472..476 "Self"
|
|
R_PAREN@476..477 ")"
|
|
WHITESPACE@477..478 " "
|
|
BLOCK_EXPR@478..480
|
|
STMT_LIST@478..480
|
|
L_CURLY@478..479 "{"
|
|
R_CURLY@479..480 "}"
|
|
WHITESPACE@480..486 "\n "
|
|
FN@486..517
|
|
FN_KW@486..488 "fn"
|
|
WHITESPACE@488..489 " "
|
|
NAME@489..490
|
|
IDENT@489..490 "d"
|
|
PARAM_LIST@490..514
|
|
L_PAREN@490..491 "("
|
|
SELF_PARAM@491..513
|
|
ATTR@491..498
|
|
POUND@491..492 "#"
|
|
L_BRACK@492..493 "["
|
|
META@493..497
|
|
PATH@493..497
|
|
PATH_SEGMENT@493..497
|
|
NAME_REF@493..497
|
|
IDENT@493..497 "attr"
|
|
R_BRACK@497..498 "]"
|
|
WHITESPACE@498..499 " "
|
|
NAME@499..503
|
|
SELF_KW@499..503 "self"
|
|
COLON@503..504 ":"
|
|
WHITESPACE@504..505 " "
|
|
PATH_TYPE@505..513
|
|
PATH@505..513
|
|
PATH_SEGMENT@505..513
|
|
NAME_REF@505..507
|
|
IDENT@505..507 "Rc"
|
|
GENERIC_ARG_LIST@507..513
|
|
L_ANGLE@507..508 "<"
|
|
TYPE_ARG@508..512
|
|
PATH_TYPE@508..512
|
|
PATH@508..512
|
|
PATH_SEGMENT@508..512
|
|
NAME_REF@508..512
|
|
IDENT@508..512 "Self"
|
|
R_ANGLE@512..513 ">"
|
|
R_PAREN@513..514 ")"
|
|
WHITESPACE@514..515 " "
|
|
BLOCK_EXPR@515..517
|
|
STMT_LIST@515..517
|
|
L_CURLY@515..516 "{"
|
|
R_CURLY@516..517 "}"
|
|
WHITESPACE@517..518 "\n"
|
|
R_CURLY@518..519 "}"
|