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 { ... }
84 lines
2.6 KiB
Plaintext
84 lines
2.6 KiB
Plaintext
SOURCE_FILE@0..83
|
|
FN@0..82
|
|
FN_KW@0..2 "fn"
|
|
WHITESPACE@2..3 " "
|
|
NAME@3..6
|
|
IDENT@3..6 "foo"
|
|
PARAM_LIST@6..8
|
|
L_PAREN@6..7 "("
|
|
R_PAREN@7..8 ")"
|
|
WHITESPACE@8..9 " "
|
|
RET_TYPE@9..15
|
|
THIN_ARROW@9..11 "->"
|
|
WHITESPACE@11..12 " "
|
|
PATH_TYPE@12..15
|
|
PATH@12..15
|
|
PATH_SEGMENT@12..15
|
|
NAME_REF@12..15
|
|
IDENT@12..15 "i32"
|
|
WHITESPACE@15..16 " "
|
|
BLOCK_EXPR@16..82
|
|
STMT_LIST@16..82
|
|
L_CURLY@16..17 "{"
|
|
WHITESPACE@17..22 "\n "
|
|
EXPR_STMT@22..80
|
|
METHOD_CALL_EXPR@22..79
|
|
METHOD_CALL_EXPR@22..57
|
|
METHOD_CALL_EXPR@22..38
|
|
ARRAY_EXPR@22..31
|
|
L_BRACK@22..23 "["
|
|
LITERAL@23..24
|
|
INT_NUMBER@23..24 "1"
|
|
COMMA@24..25 ","
|
|
WHITESPACE@25..26 " "
|
|
LITERAL@26..27
|
|
INT_NUMBER@26..27 "2"
|
|
COMMA@27..28 ","
|
|
WHITESPACE@28..29 " "
|
|
LITERAL@29..30
|
|
INT_NUMBER@29..30 "3"
|
|
R_BRACK@30..31 "]"
|
|
DOT@31..32 "."
|
|
NAME_REF@32..36
|
|
IDENT@32..36 "iter"
|
|
ARG_LIST@36..38
|
|
L_PAREN@36..37 "("
|
|
R_PAREN@37..38 ")"
|
|
WHITESPACE@38..47 "\n "
|
|
DOT@47..48 "."
|
|
NAME_REF@48..51
|
|
IDENT@48..51 "map"
|
|
ARG_LIST@51..57
|
|
L_PAREN@51..52 "("
|
|
CLOSURE_EXPR@52..56
|
|
PARAM_LIST@52..56
|
|
PIPE@52..53 "|"
|
|
PARAM@53..55
|
|
IDENT_PAT@53..55
|
|
NAME@53..55
|
|
IDENT@53..55 "it"
|
|
PIPE@55..56 "|"
|
|
R_PAREN@56..57 ")"
|
|
WHITESPACE@57..66 "\n "
|
|
DOT@66..67 "."
|
|
NAME_REF@67..70
|
|
IDENT@67..70 "max"
|
|
GENERIC_ARG_LIST@70..77
|
|
COLON2@70..72 "::"
|
|
L_ANGLE@72..73 "<"
|
|
TYPE_ARG@73..76
|
|
PATH_TYPE@73..76
|
|
PATH@73..76
|
|
PATH_SEGMENT@73..76
|
|
NAME_REF@73..76
|
|
IDENT@73..76 "i32"
|
|
R_ANGLE@76..77 ">"
|
|
ARG_LIST@77..79
|
|
L_PAREN@77..78 "("
|
|
R_PAREN@78..79 ")"
|
|
SEMICOLON@79..80 ";"
|
|
WHITESPACE@80..81 "\n"
|
|
R_CURLY@81..82 "}"
|
|
WHITESPACE@82..83 "\n"
|
|
error 56..56: expected expression
|