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 { ... }
37 lines
924 B
Plaintext
37 lines
924 B
Plaintext
SOURCE_FILE@0..24
|
|
FN@0..23
|
|
FN_KW@0..2 "fn"
|
|
WHITESPACE@2..3 " "
|
|
NAME@3..6
|
|
IDENT@3..6 "foo"
|
|
PARAM_LIST@6..12
|
|
L_PAREN@6..7 "("
|
|
PARAM@7..11
|
|
IDENT_PAT@7..8
|
|
NAME@7..8
|
|
IDENT@7..8 "a"
|
|
COLON@8..9 ":"
|
|
WHITESPACE@9..10 " "
|
|
PATH_TYPE@10..11
|
|
PATH@10..11
|
|
PATH_SEGMENT@10..11
|
|
NAME_REF@10..11
|
|
IDENT@10..11 "A"
|
|
R_PAREN@11..12 ")"
|
|
WHITESPACE@12..13 " "
|
|
BLOCK_EXPR@13..23
|
|
STMT_LIST@13..23
|
|
L_CURLY@13..14 "{"
|
|
WHITESPACE@14..19 "\n "
|
|
FIELD_EXPR@19..21
|
|
PATH_EXPR@19..20
|
|
PATH@19..20
|
|
PATH_SEGMENT@19..20
|
|
NAME_REF@19..20
|
|
IDENT@19..20 "a"
|
|
DOT@20..21 "."
|
|
WHITESPACE@21..22 "\n"
|
|
R_CURLY@22..23 "}"
|
|
WHITESPACE@23..24 "\n"
|
|
error 21..21: expected field name or number
|