From 642a3392d94b85cf5802cef9ceaa3de7e4571680 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 May 2020 01:18:35 +0200 Subject: Update test data --- .../parser/err/0005_attribute_recover.rast | 7 +- .../parser/err/0007_stray_curly_in_file.rast | 5 +- .../parser/err/0008_item_block_recovery.rast | 52 ++- .../parser/err/0010_unsafe_lambda_block.rast | 61 ++- .../test_data/parser/err/0014_where_no_bounds.rast | 5 +- .../test_data/parser/err/0016_missing_semi.rast | 61 ++- .../parser/err/0017_incomplete_binexpr.rast | 45 ++- .../test_data/parser/err/0018_incomplete_fn.rast | 165 ++++---- .../test_data/parser/err/0019_let_recover.rast | 166 ++++---- .../test_data/parser/err/0020_fn_recover.rast | 5 +- .../parser/err/0021_incomplete_param.rast | 7 +- .../test_data/parser/err/0022_bad_exprs.rast | 229 ++++++----- .../parser/err/0023_mismatched_paren.rast | 49 ++- .../parser/err/0024_many_type_parens.rast | 430 ++++++++++----------- .../ra_syntax/test_data/parser/err/0025_nope.rast | 360 +++++++++-------- .../parser/err/0027_incomplere_where_for.rast | 5 +- .../parser/err/0029_field_completion.rast | 23 +- .../parser/err/0031_block_inner_attrs.rast | 214 +++++----- .../parser/err/0032_match_arms_inner_attrs.rast | 361 +++++++++-------- .../parser/err/0033_match_arms_outer_attrs.rast | 103 +++-- .../test_data/parser/err/0034_bad_box_pattern.rast | 155 ++++---- .../test_data/parser/err/0035_use_recover.rast | 5 +- .../parser/err/0037_visibility_in_traits.rast | 10 +- .../parser/err/0038_endless_inclusive_range.rast | 31 +- .../test_data/parser/err/0039_lambda_recovery.rast | 121 +++--- 25 files changed, 1318 insertions(+), 1357 deletions(-) (limited to 'crates/ra_syntax/test_data/parser/err') diff --git a/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast index 95cc83caa..375ed45e0 100644 --- a/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast @@ -28,10 +28,9 @@ SOURCE_FILE@0..54 R_PAREN@26..27 ")" WHITESPACE@27..28 " " BLOCK_EXPR@28..31 - BLOCK@28..31 - L_CURLY@28..29 "{" - WHITESPACE@29..30 "\n" - R_CURLY@30..31 "}" + L_CURLY@28..29 "{" + WHITESPACE@29..30 "\n" + R_CURLY@30..31 "}" WHITESPACE@31..34 "\n\n\n" ATTR@34..53 POUND@34..35 "#" diff --git a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast index dc3e12091..b72c92c33 100644 --- a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast +++ b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast @@ -21,9 +21,8 @@ SOURCE_FILE@0..31 L_PAREN@23..24 "(" R_PAREN@24..25 ")" BLOCK_EXPR@25..27 - BLOCK@25..27 - L_CURLY@25..26 "{" - R_CURLY@26..27 "}" + L_CURLY@25..26 "{" + R_CURLY@26..27 "}" WHITESPACE@27..29 "\n\n" ERROR@29..30 R_CURLY@29..30 "}" diff --git a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast index 97539fcf2..33953d8d7 100644 --- a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast @@ -9,10 +9,9 @@ SOURCE_FILE@0..95 R_PAREN@7..8 ")" WHITESPACE@8..9 " " BLOCK_EXPR@9..12 - BLOCK@9..12 - L_CURLY@9..10 "{" - WHITESPACE@10..11 "\n" - R_CURLY@11..12 "}" + L_CURLY@9..10 "{" + WHITESPACE@10..11 "\n" + R_CURLY@11..12 "}" WHITESPACE@12..14 "\n\n" MACRO_CALL@14..19 PATH@14..17 @@ -34,30 +33,28 @@ SOURCE_FILE@0..95 TRUE_KW@29..33 "true" WHITESPACE@33..34 " " BLOCK_EXPR@34..51 - BLOCK@34..51 - L_CURLY@34..35 "{" - WHITESPACE@35..44 "\n " - LITERAL@44..45 - INT_NUMBER@44..45 "1" - WHITESPACE@45..50 "\n " - R_CURLY@50..51 "}" + L_CURLY@34..35 "{" + WHITESPACE@35..44 "\n " + LITERAL@44..45 + INT_NUMBER@44..45 "1" + WHITESPACE@45..50 "\n " + R_CURLY@50..51 "}" WHITESPACE@51..52 " " ELSE_KW@52..56 "else" WHITESPACE@56..57 " " BLOCK_EXPR@57..78 - BLOCK@57..78 - L_CURLY@57..58 "{" - WHITESPACE@58..67 "\n " - BIN_EXPR@67..72 - LITERAL@67..68 - INT_NUMBER@67..68 "2" - WHITESPACE@68..69 " " - PLUS@69..70 "+" - WHITESPACE@70..71 " " - LITERAL@71..72 - INT_NUMBER@71..72 "3" - WHITESPACE@72..77 "\n " - R_CURLY@77..78 "}" + L_CURLY@57..58 "{" + WHITESPACE@58..67 "\n " + BIN_EXPR@67..72 + LITERAL@67..68 + INT_NUMBER@67..68 "2" + WHITESPACE@68..69 " " + PLUS@69..70 "+" + WHITESPACE@70..71 " " + LITERAL@71..72 + INT_NUMBER@71..72 "3" + WHITESPACE@72..77 "\n " + R_CURLY@77..78 "}" WHITESPACE@78..79 "\n" R_CURLY@79..80 "}" WHITESPACE@80..82 "\n\n" @@ -71,10 +68,9 @@ SOURCE_FILE@0..95 R_PAREN@89..90 ")" WHITESPACE@90..91 " " BLOCK_EXPR@91..94 - BLOCK@91..94 - L_CURLY@91..92 "{" - WHITESPACE@92..93 "\n" - R_CURLY@93..94 "}" + L_CURLY@91..92 "{" + WHITESPACE@92..93 "\n" + R_CURLY@93..94 "}" WHITESPACE@94..95 "\n" error 17..17: expected BANG error 19..19: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast index e10bb8174..06a326d26 100644 --- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast +++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast @@ -9,37 +9,36 @@ SOURCE_FILE@0..42 R_PAREN@8..9 ")" WHITESPACE@9..10 " " BLOCK_EXPR@10..41 - BLOCK@10..41 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - EXPR_STMT@16..24 - LAMBDA_EXPR@16..24 - PARAM_LIST@16..18 - PIPE@16..17 "|" - PIPE@17..18 "|" - WHITESPACE@18..19 " " - RET_TYPE@19..24 - THIN_ARROW@19..21 "->" - WHITESPACE@21..22 " " - TUPLE_TYPE@22..24 - L_PAREN@22..23 "(" - R_PAREN@23..24 ")" - WHITESPACE@24..25 " " - EXPR_STMT@25..39 - BLOCK_EXPR@25..38 - UNSAFE_KW@25..31 "unsafe" - WHITESPACE@31..32 " " - BLOCK@32..38 - L_CURLY@32..33 "{" - WHITESPACE@33..34 " " - TUPLE_EXPR@34..36 - L_PAREN@34..35 "(" - R_PAREN@35..36 ")" - WHITESPACE@36..37 " " - R_CURLY@37..38 "}" - SEMICOLON@38..39 ";" - WHITESPACE@39..40 "\n" - R_CURLY@40..41 "}" + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + EXPR_STMT@16..24 + LAMBDA_EXPR@16..24 + PARAM_LIST@16..18 + PIPE@16..17 "|" + PIPE@17..18 "|" + WHITESPACE@18..19 " " + RET_TYPE@19..24 + THIN_ARROW@19..21 "->" + WHITESPACE@21..22 " " + TUPLE_TYPE@22..24 + L_PAREN@22..23 "(" + R_PAREN@23..24 ")" + WHITESPACE@24..25 " " + EXPR_STMT@25..39 + EFFECT_EXPR@25..38 + UNSAFE_KW@25..31 "unsafe" + WHITESPACE@31..32 " " + BLOCK_EXPR@32..38 + L_CURLY@32..33 "{" + WHITESPACE@33..34 " " + TUPLE_EXPR@34..36 + L_PAREN@34..35 "(" + R_PAREN@35..36 ")" + WHITESPACE@36..37 " " + R_CURLY@37..38 "}" + SEMICOLON@38..39 ";" + WHITESPACE@39..40 "\n" + R_CURLY@40..41 "}" WHITESPACE@41..42 "\n" error 24..24: expected `{` error 24..24: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast index 61c361833..9323b7890 100644 --- a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast +++ b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast @@ -25,8 +25,7 @@ SOURCE_FILE@0..23 IDENT@18..19 "T" WHITESPACE@19..20 " " BLOCK_EXPR@20..22 - BLOCK@20..22 - L_CURLY@20..21 "{" - R_CURLY@21..22 "}" + L_CURLY@20..21 "{" + R_CURLY@21..22 "}" WHITESPACE@22..23 "\n" error 19..19: expected colon diff --git a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast index 92bb47316..93434f34f 100644 --- a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast +++ b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast @@ -9,36 +9,35 @@ SOURCE_FILE@0..56 R_PAREN@7..8 ")" WHITESPACE@8..9 " " BLOCK_EXPR@9..55 - BLOCK@9..55 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - EXPR_STMT@15..38 - CALL_EXPR@15..38 - PATH_EXPR@15..18 - PATH@15..18 - PATH_SEGMENT@15..18 - NAME_REF@15..18 - IDENT@15..18 "foo" - ARG_LIST@18..38 - L_PAREN@18..19 "(" - WHITESPACE@19..28 "\n " - LITERAL@28..29 - INT_NUMBER@28..29 "1" - COMMA@29..30 "," - WHITESPACE@30..31 " " - LITERAL@31..32 - INT_NUMBER@31..32 "2" - WHITESPACE@32..37 "\n " - R_PAREN@37..38 ")" - WHITESPACE@38..43 "\n " - EXPR_STMT@43..53 - RETURN_EXPR@43..52 - RETURN_KW@43..49 "return" - WHITESPACE@49..50 " " - LITERAL@50..52 - INT_NUMBER@50..52 "92" - SEMICOLON@52..53 ";" - WHITESPACE@53..54 "\n" - R_CURLY@54..55 "}" + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + EXPR_STMT@15..38 + CALL_EXPR@15..38 + PATH_EXPR@15..18 + PATH@15..18 + PATH_SEGMENT@15..18 + NAME_REF@15..18 + IDENT@15..18 "foo" + ARG_LIST@18..38 + L_PAREN@18..19 "(" + WHITESPACE@19..28 "\n " + LITERAL@28..29 + INT_NUMBER@28..29 "1" + COMMA@29..30 "," + WHITESPACE@30..31 " " + LITERAL@31..32 + INT_NUMBER@31..32 "2" + WHITESPACE@32..37 "\n " + R_PAREN@37..38 ")" + WHITESPACE@38..43 "\n " + EXPR_STMT@43..53 + RETURN_EXPR@43..52 + RETURN_KW@43..49 "return" + WHITESPACE@49..50 " " + LITERAL@50..52 + INT_NUMBER@50..52 "92" + SEMICOLON@52..53 ";" + WHITESPACE@53..54 "\n" + R_CURLY@54..55 "}" WHITESPACE@55..56 "\n" error 38..38: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast index 7bc718302..628315c78 100644 --- a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast +++ b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast @@ -20,28 +20,27 @@ SOURCE_FILE@0..47 R_PAREN@15..16 ")" WHITESPACE@16..17 " " BLOCK_EXPR@17..46 - BLOCK@17..46 - L_CURLY@17..18 "{" - WHITESPACE@18..23 "\n " - LET_STMT@23..36 - LET_KW@23..26 "let" - WHITESPACE@26..27 " " - BIND_PAT@27..30 - NAME@27..30 - IDENT@27..30 "bar" - WHITESPACE@30..31 " " - EQ@31..32 "=" - WHITESPACE@32..33 " " - LITERAL@33..35 - INT_NUMBER@33..35 "92" - SEMICOLON@35..36 ";" - WHITESPACE@36..41 "\n " - BIN_EXPR@41..44 - LITERAL@41..42 - INT_NUMBER@41..42 "1" - WHITESPACE@42..43 " " - PLUS@43..44 "+" - WHITESPACE@44..45 "\n" - R_CURLY@45..46 "}" + L_CURLY@17..18 "{" + WHITESPACE@18..23 "\n " + LET_STMT@23..36 + LET_KW@23..26 "let" + WHITESPACE@26..27 " " + BIND_PAT@27..30 + NAME@27..30 + IDENT@27..30 "bar" + WHITESPACE@30..31 " " + EQ@31..32 "=" + WHITESPACE@32..33 " " + LITERAL@33..35 + INT_NUMBER@33..35 "92" + SEMICOLON@35..36 ";" + WHITESPACE@36..41 "\n " + BIN_EXPR@41..44 + LITERAL@41..42 + INT_NUMBER@41..42 "1" + WHITESPACE@42..43 " " + PLUS@43..44 "+" + WHITESPACE@44..45 "\n" + R_CURLY@45..46 "}" WHITESPACE@46..47 "\n" error 44..44: expected expression diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast index 63194f974..31cc4e551 100644 --- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast +++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast @@ -33,89 +33,88 @@ SOURCE_FILE@0..183 IDENT@39..46 "ScopeId" WHITESPACE@46..47 " " BLOCK_EXPR@47..161 - BLOCK@47..161 - L_CURLY@47..48 "{" - WHITESPACE@48..57 "\n " - LET_STMT@57..85 - LET_KW@57..60 "let" - WHITESPACE@60..61 " " - BIND_PAT@61..64 - NAME@61..64 - IDENT@61..64 "res" - WHITESPACE@64..65 " " - EQ@65..66 "=" - WHITESPACE@66..67 " " - METHOD_CALL_EXPR@67..84 - FIELD_EXPR@67..78 - PATH_EXPR@67..71 - PATH@67..71 - PATH_SEGMENT@67..71 - SELF_KW@67..71 "self" - DOT@71..72 "." - NAME_REF@72..78 - IDENT@72..78 "scopes" - DOT@78..79 "." - NAME_REF@79..82 - IDENT@79..82 "len" - ARG_LIST@82..84 - L_PAREN@82..83 "(" - R_PAREN@83..84 ")" - SEMICOLON@84..85 ";" - WHITESPACE@85..94 "\n " - METHOD_CALL_EXPR@94..155 - FIELD_EXPR@94..105 - PATH_EXPR@94..98 - PATH@94..98 - PATH_SEGMENT@94..98 - SELF_KW@94..98 "self" - DOT@98..99 "." - NAME_REF@99..105 - IDENT@99..105 "scopes" - DOT@105..106 "." - NAME_REF@106..110 - IDENT@106..110 "push" - ARG_LIST@110..155 - L_PAREN@110..111 "(" - RECORD_LIT@111..154 - PATH@111..120 - PATH_SEGMENT@111..120 - NAME_REF@111..120 - IDENT@111..120 "ScopeData" - WHITESPACE@120..121 " " - RECORD_FIELD_LIST@121..154 - L_CURLY@121..122 "{" - WHITESPACE@122..123 " " - RECORD_FIELD@123..135 - NAME_REF@123..129 - IDENT@123..129 "parent" - COLON@129..130 ":" - WHITESPACE@130..131 " " - PATH_EXPR@131..135 - PATH@131..135 - PATH_SEGMENT@131..135 - NAME_REF@131..135 - IDENT@131..135 "None" - COMMA@135..136 "," - WHITESPACE@136..137 " " - RECORD_FIELD@137..152 - NAME_REF@137..144 - IDENT@137..144 "entries" - COLON@144..145 ":" - WHITESPACE@145..146 " " - MACRO_CALL@146..152 - PATH@146..149 - PATH_SEGMENT@146..149 - NAME_REF@146..149 - IDENT@146..149 "vec" - BANG@149..150 "!" - TOKEN_TREE@150..152 - L_BRACK@150..151 "[" - R_BRACK@151..152 "]" - WHITESPACE@152..153 " " - R_CURLY@153..154 "}" - R_PAREN@154..155 ")" - WHITESPACE@155..160 "\n " - R_CURLY@160..161 "}" + L_CURLY@47..48 "{" + WHITESPACE@48..57 "\n " + LET_STMT@57..85 + LET_KW@57..60 "let" + WHITESPACE@60..61 " " + BIND_PAT@61..64 + NAME@61..64 + IDENT@61..64 "res" + WHITESPACE@64..65 " " + EQ@65..66 "=" + WHITESPACE@66..67 " " + METHOD_CALL_EXPR@67..84 + FIELD_EXPR@67..78 + PATH_EXPR@67..71 + PATH@67..71 + PATH_SEGMENT@67..71 + SELF_KW@67..71 "self" + DOT@71..72 "." + NAME_REF@72..78 + IDENT@72..78 "scopes" + DOT@78..79 "." + NAME_REF@79..82 + IDENT@79..82 "len" + ARG_LIST@82..84 + L_PAREN@82..83 "(" + R_PAREN@83..84 ")" + SEMICOLON@84..85 ";" + WHITESPACE@85..94 "\n " + METHOD_CALL_EXPR@94..155 + FIELD_EXPR@94..105 + PATH_EXPR@94..98 + PATH@94..98 + PATH_SEGMENT@94..98 + SELF_KW@94..98 "self" + DOT@98..99 "." + NAME_REF@99..105 + IDENT@99..105 "scopes" + DOT@105..106 "." + NAME_REF@106..110 + IDENT@106..110 "push" + ARG_LIST@110..155 + L_PAREN@110..111 "(" + RECORD_LIT@111..154 + PATH@111..120 + PATH_SEGMENT@111..120 + NAME_REF@111..120 + IDENT@111..120 "ScopeData" + WHITESPACE@120..121 " " + RECORD_FIELD_LIST@121..154 + L_CURLY@121..122 "{" + WHITESPACE@122..123 " " + RECORD_FIELD@123..135 + NAME_REF@123..129 + IDENT@123..129 "parent" + COLON@129..130 ":" + WHITESPACE@130..131 " " + PATH_EXPR@131..135 + PATH@131..135 + PATH_SEGMENT@131..135 + NAME_REF@131..135 + IDENT@131..135 "None" + COMMA@135..136 "," + WHITESPACE@136..137 " " + RECORD_FIELD@137..152 + NAME_REF@137..144 + IDENT@137..144 "entries" + COLON@144..145 ":" + WHITESPACE@145..146 " " + MACRO_CALL@146..152 + PATH@146..149 + PATH_SEGMENT@146..149 + NAME_REF@146..149 + IDENT@146..149 "vec" + BANG@149..150 "!" + TOKEN_TREE@150..152 + L_BRACK@150..151 "[" + R_BRACK@151..152 "]" + WHITESPACE@152..153 " " + R_CURLY@153..154 "}" + R_PAREN@154..155 ")" + WHITESPACE@155..160 "\n " + R_CURLY@160..161 "}" WHITESPACE@161..167 "\n\n " FN_DEF@167..180 FN_KW@167..169 "fn" diff --git a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast index d20bb60f1..4ff27f5c8 100644 --- a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast @@ -9,91 +9,87 @@ SOURCE_FILE@0..139 R_PAREN@7..8 ")" WHITESPACE@8..9 " " BLOCK_EXPR@9..138 - BLOCK@9..138 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - LET_STMT@15..24 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - BIND_PAT@19..22 - NAME@19..22 - IDENT@19..22 "foo" - WHITESPACE@22..23 " " - EQ@23..24 "=" - WHITESPACE@24..29 "\n " - LET_STMT@29..41 - LET_KW@29..32 "let" - WHITESPACE@32..33 " " - BIND_PAT@33..36 - NAME@33..36 - IDENT@33..36 "bar" - WHITESPACE@36..37 " " - EQ@37..38 "=" - WHITESPACE@38..39 " " - LITERAL@39..40 - INT_NUMBER@39..40 "1" - SEMICOLON@40..41 ";" - WHITESPACE@41..46 "\n " - LET_STMT@46..49 - LET_KW@46..49 "let" - WHITESPACE@49..54 "\n " - LET_STMT@54..67 - LET_KW@54..57 "let" - WHITESPACE@57..58 " " - BIND_PAT@58..61 - NAME@58..61 - IDENT@58..61 "baz" - WHITESPACE@61..62 " " - EQ@62..63 "=" - WHITESPACE@63..64 " " - LITERAL@64..66 - INT_NUMBER@64..66 "92" - SEMICOLON@66..67 ";" - WHITESPACE@67..72 "\n " - LET_STMT@72..75 - LET_KW@72..75 "let" - WHITESPACE@75..80 "\n " - EXPR_STMT@80..90 - IF_EXPR@80..90 - IF_KW@80..82 "if" - WHITESPACE@82..83 " " - CONDITION@83..87 - LITERAL@83..87 - TRUE_KW@83..87 "true" - WHITESPACE@87..88 " " - BLOCK_EXPR@88..90 - BLOCK@88..90 - L_CURLY@88..89 "{" - R_CURLY@89..90 "}" - WHITESPACE@90..95 "\n " - LET_STMT@95..98 - LET_KW@95..98 "let" - WHITESPACE@98..103 "\n " - EXPR_STMT@103..116 - WHILE_EXPR@103..116 - WHILE_KW@103..108 "while" - WHITESPACE@108..109 " " - CONDITION@109..113 - LITERAL@109..113 - TRUE_KW@109..113 "true" - WHITESPACE@113..114 " " - BLOCK_EXPR@114..116 - BLOCK@114..116 - L_CURLY@114..115 "{" - R_CURLY@115..116 "}" - WHITESPACE@116..121 "\n " - LET_STMT@121..124 - LET_KW@121..124 "let" - WHITESPACE@124..129 "\n " - LOOP_EXPR@129..136 - LOOP_KW@129..133 "loop" - WHITESPACE@133..134 " " - BLOCK_EXPR@134..136 - BLOCK@134..136 - L_CURLY@134..135 "{" - R_CURLY@135..136 "}" - WHITESPACE@136..137 "\n" - R_CURLY@137..138 "}" + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + LET_STMT@15..24 + LET_KW@15..18 "let" + WHITESPACE@18..19 " " + BIND_PAT@19..22 + NAME@19..22 + IDENT@19..22 "foo" + WHITESPACE@22..23 " " + EQ@23..24 "=" + WHITESPACE@24..29 "\n " + LET_STMT@29..41 + LET_KW@29..32 "let" + WHITESPACE@32..33 " " + BIND_PAT@33..36 + NAME@33..36 + IDENT@33..36 "bar" + WHITESPACE@36..37 " " + EQ@37..38 "=" + WHITESPACE@38..39 " " + LITERAL@39..40 + INT_NUMBER@39..40 "1" + SEMICOLON@40..41 ";" + WHITESPACE@41..46 "\n " + LET_STMT@46..49 + LET_KW@46..49 "let" + WHITESPACE@49..54 "\n " + LET_STMT@54..67 + LET_KW@54..57 "let" + WHITESPACE@57..58 " " + BIND_PAT@58..61 + NAME@58..61 + IDENT@58..61 "baz" + WHITESPACE@61..62 " " + EQ@62..63 "=" + WHITESPACE@63..64 " " + LITERAL@64..66 + INT_NUMBER@64..66 "92" + SEMICOLON@66..67 ";" + WHITESPACE@67..72 "\n " + LET_STMT@72..75 + LET_KW@72..75 "let" + WHITESPACE@75..80 "\n " + EXPR_STMT@80..90 + IF_EXPR@80..90 + IF_KW@80..82 "if" + WHITESPACE@82..83 " " + CONDITION@83..87 + LITERAL@83..87 + TRUE_KW@83..87 "true" + WHITESPACE@87..88 " " + BLOCK_EXPR@88..90 + L_CURLY@88..89 "{" + R_CURLY@89..90 "}" + WHITESPACE@90..95 "\n " + LET_STMT@95..98 + LET_KW@95..98 "let" + WHITESPACE@98..103 "\n " + EXPR_STMT@103..116 + WHILE_EXPR@103..116 + WHILE_KW@103..108 "while" + WHITESPACE@108..109 " " + CONDITION@109..113 + LITERAL@109..113 + TRUE_KW@109..113 "true" + WHITESPACE@113..114 " " + BLOCK_EXPR@114..116 + L_CURLY@114..115 "{" + R_CURLY@115..116 "}" + WHITESPACE@116..121 "\n " + LET_STMT@121..124 + LET_KW@121..124 "let" + WHITESPACE@124..129 "\n " + LOOP_EXPR@129..136 + LOOP_KW@129..133 "loop" + WHITESPACE@133..134 " " + BLOCK_EXPR@134..136 + L_CURLY@134..135 "{" + R_CURLY@135..136 "}" + WHITESPACE@136..137 "\n" + R_CURLY@137..138 "}" WHITESPACE@138..139 "\n" error 24..24: expected expression error 24..24: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast index 1185f44f9..5f3a31473 100644 --- a/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast @@ -12,9 +12,8 @@ SOURCE_FILE@0..16 R_PAREN@11..12 ")" WHITESPACE@12..13 " " BLOCK_EXPR@13..15 - BLOCK@13..15 - L_CURLY@13..14 "{" - R_CURLY@14..15 "}" + L_CURLY@13..14 "{" + R_CURLY@14..15 "}" WHITESPACE@15..16 "\n" error 2..2: expected a name error 2..2: expected function arguments diff --git a/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast index c7bf4caa0..1746bd3c1 100644 --- a/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast +++ b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast @@ -26,10 +26,9 @@ SOURCE_FILE@0..22 R_PAREN@16..17 ")" WHITESPACE@17..18 " " BLOCK_EXPR@18..21 - BLOCK@18..21 - L_CURLY@18..19 "{" - WHITESPACE@19..20 "\n" - R_CURLY@20..21 "}" + L_CURLY@18..19 "{" + WHITESPACE@19..20 "\n" + R_CURLY@20..21 "}" WHITESPACE@21..22 "\n" error 16..16: expected COLON error 16..16: expected type diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast index cc0d75cc8..28146f44e 100644 --- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast +++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast @@ -9,37 +9,36 @@ SOURCE_FILE@0..112 R_PAREN@5..6 ")" WHITESPACE@6..7 " " BLOCK_EXPR@7..33 - BLOCK@7..33 - L_CURLY@7..8 "{" - WHITESPACE@8..9 " " - EXPR_STMT@9..17 - ARRAY_EXPR@9..17 - L_BRACK@9..10 "[" - LITERAL@10..11 - INT_NUMBER@10..11 "1" - COMMA@11..12 "," - WHITESPACE@12..13 " " - LITERAL@13..14 - INT_NUMBER@13..14 "2" - COMMA@14..15 "," - WHITESPACE@15..16 " " - ERROR@16..17 - AT@16..17 "@" - EXPR_STMT@17..18 - ERROR@17..18 - COMMA@17..18 "," - WHITESPACE@18..19 " " - STRUCT_DEF@19..26 - STRUCT_KW@19..25 "struct" - ERROR@25..26 - COMMA@25..26 "," - WHITESPACE@26..27 " " - LET_STMT@27..31 - LET_KW@27..30 "let" - ERROR@30..31 - R_BRACK@30..31 "]" - WHITESPACE@31..32 " " - R_CURLY@32..33 "}" + L_CURLY@7..8 "{" + WHITESPACE@8..9 " " + EXPR_STMT@9..17 + ARRAY_EXPR@9..17 + L_BRACK@9..10 "[" + LITERAL@10..11 + INT_NUMBER@10..11 "1" + COMMA@11..12 "," + WHITESPACE@12..13 " " + LITERAL@13..14 + INT_NUMBER@13..14 "2" + COMMA@14..15 "," + WHITESPACE@15..16 " " + ERROR@16..17 + AT@16..17 "@" + EXPR_STMT@17..18 + ERROR@17..18 + COMMA@17..18 "," + WHITESPACE@18..19 " " + STRUCT_DEF@19..26 + STRUCT_KW@19..25 "struct" + ERROR@25..26 + COMMA@25..26 "," + WHITESPACE@26..27 " " + LET_STMT@27..31 + LET_KW@27..30 "let" + ERROR@30..31 + R_BRACK@30..31 "]" + WHITESPACE@31..32 " " + R_CURLY@32..33 "}" WHITESPACE@33..34 "\n" FN_DEF@34..68 FN_KW@34..36 "fn" @@ -51,44 +50,43 @@ SOURCE_FILE@0..112 R_PAREN@39..40 ")" WHITESPACE@40..41 " " BLOCK_EXPR@41..68 - BLOCK@41..68 - L_CURLY@41..42 "{" - WHITESPACE@42..43 " " - EXPR_STMT@43..54 - CALL_EXPR@43..54 - PATH_EXPR@43..46 - PATH@43..46 - PATH_SEGMENT@43..46 - NAME_REF@43..46 - IDENT@43..46 "foo" - ARG_LIST@46..54 - L_PAREN@46..47 "(" - LITERAL@47..48 - INT_NUMBER@47..48 "1" - COMMA@48..49 "," - WHITESPACE@49..50 " " - LITERAL@50..51 - INT_NUMBER@50..51 "2" - COMMA@51..52 "," - WHITESPACE@52..53 " " - ERROR@53..54 - AT@53..54 "@" - EXPR_STMT@54..55 - ERROR@54..55 - COMMA@54..55 "," - WHITESPACE@55..56 " " - IMPL_DEF@56..60 - IMPL_KW@56..60 "impl" - EXPR_STMT@60..61 - ERROR@60..61 - COMMA@60..61 "," - WHITESPACE@61..62 " " - LET_STMT@62..65 - LET_KW@62..65 "let" - ERROR@65..66 - R_PAREN@65..66 ")" - WHITESPACE@66..67 " " - R_CURLY@67..68 "}" + L_CURLY@41..42 "{" + WHITESPACE@42..43 " " + EXPR_STMT@43..54 + CALL_EXPR@43..54 + PATH_EXPR@43..46 + PATH@43..46 + PATH_SEGMENT@43..46 + NAME_REF@43..46 + IDENT@43..46 "foo" + ARG_LIST@46..54 + L_PAREN@46..47 "(" + LITERAL@47..48 + INT_NUMBER@47..48 "1" + COMMA@48..49 "," + WHITESPACE@49..50 " " + LITERAL@50..51 + INT_NUMBER@50..51 "2" + COMMA@51..52 "," + WHITESPACE@52..53 " " + ERROR@53..54 + AT@53..54 "@" + EXPR_STMT@54..55 + ERROR@54..55 + COMMA@54..55 "," + WHITESPACE@55..56 " " + IMPL_DEF@56..60 + IMPL_KW@56..60 "impl" + EXPR_STMT@60..61 + ERROR@60..61 + COMMA@60..61 "," + WHITESPACE@61..62 " " + LET_STMT@62..65 + LET_KW@62..65 "let" + ERROR@65..66 + R_PAREN@65..66 ")" + WHITESPACE@66..67 " " + R_CURLY@67..68 "}" WHITESPACE@68..69 "\n" FN_DEF@69..111 FN_KW@69..71 "fn" @@ -100,53 +98,52 @@ SOURCE_FILE@0..112 R_PAREN@74..75 ")" WHITESPACE@75..76 " " BLOCK_EXPR@76..111 - BLOCK@76..111 - L_CURLY@76..77 "{" - WHITESPACE@77..78 " " - EXPR_STMT@78..93 - METHOD_CALL_EXPR@78..93 - PATH_EXPR@78..81 - PATH@78..81 - PATH_SEGMENT@78..81 - NAME_REF@78..81 - IDENT@78..81 "foo" - DOT@81..82 "." - NAME_REF@82..85 - IDENT@82..85 "bar" - ARG_LIST@85..93 - L_PAREN@85..86 "(" - LITERAL@86..87 - INT_NUMBER@86..87 "1" - COMMA@87..88 "," - WHITESPACE@88..89 " " - LITERAL@89..90 - INT_NUMBER@89..90 "2" - COMMA@90..91 "," - WHITESPACE@91..92 " " - ERROR@92..93 - AT@92..93 "@" - EXPR_STMT@93..94 - ERROR@93..94 - COMMA@93..94 "," - WHITESPACE@94..95 " " - EXPR_STMT@95..96 - ERROR@95..96 - R_BRACK@95..96 "]" - EXPR_STMT@96..97 - ERROR@96..97 - COMMA@96..97 "," - WHITESPACE@97..98 " " - TRAIT_DEF@98..104 - TRAIT_KW@98..103 "trait" - ERROR@103..104 - COMMA@103..104 "," - WHITESPACE@104..105 " " - LET_STMT@105..108 - LET_KW@105..108 "let" - ERROR@108..109 - R_PAREN@108..109 ")" - WHITESPACE@109..110 " " - R_CURLY@110..111 "}" + L_CURLY@76..77 "{" + WHITESPACE@77..78 " " + EXPR_STMT@78..93 + METHOD_CALL_EXPR@78..93 + PATH_EXPR@78..81 + PATH@78..81 + PATH_SEGMENT@78..81 + NAME_REF@78..81 + IDENT@78..81 "foo" + DOT@81..82 "." + NAME_REF@82..85 + IDENT@82..85 "bar" + ARG_LIST@85..93 + L_PAREN@85..86 "(" + LITERAL@86..87 + INT_NUMBER@86..87 "1" + COMMA@87..88 "," + WHITESPACE@88..89 " " + LITERAL@89..90 + INT_NUMBER@89..90 "2" + COMMA@90..91 "," + WHITESPACE@91..92 " " + ERROR@92..93 + AT@92..93 "@" + EXPR_STMT@93..94 + ERROR@93..94 + COMMA@93..94 "," + WHITESPACE@94..95 " " + EXPR_STMT@95..96 + ERROR@95..96 + R_BRACK@95..96 "]" + EXPR_STMT@96..97 + ERROR@96..97 + COMMA@96..97 "," + WHITESPACE@97..98 " " + TRAIT_DEF@98..104 + TRAIT_KW@98..103 "trait" + ERROR@103..104 + COMMA@103..104 "," + WHITESPACE@104..105 " " + LET_STMT@105..108 + LET_KW@105..108 "let" + ERROR@108..109 + R_PAREN@108..109 ")" + WHITESPACE@109..110 " " + R_CURLY@110..111 "}" WHITESPACE@111..112 "\n" error 16..16: expected expression error 17..17: expected R_BRACK diff --git a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast index c37594146..9ea9d715e 100644 --- a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast +++ b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast @@ -9,31 +9,30 @@ SOURCE_FILE@0..94 R_PAREN@8..9 ")" WHITESPACE@9..10 " " BLOCK_EXPR@10..55 - BLOCK@10..55 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - MACRO_CALL@16..49 - PATH@16..19 - PATH_SEGMENT@16..19 - NAME_REF@16..19 - IDENT@16..19 "foo" - BANG@19..20 "!" - WHITESPACE@20..21 " " - TOKEN_TREE@21..49 - L_PAREN@21..22 "(" - WHITESPACE@22..31 "\n " - IDENT@31..34 "bar" - COMMA@34..35 "," - WHITESPACE@35..36 " " - STRING@36..41 "\"baz\"" - COMMA@41..42 "," - WHITESPACE@42..43 " " - INT_NUMBER@43..44 "1" - COMMA@44..45 "," - WHITESPACE@45..46 " " - FLOAT_NUMBER@46..49 "2.0" - WHITESPACE@49..54 "\n " - R_CURLY@54..55 "}" + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + MACRO_CALL@16..49 + PATH@16..19 + PATH_SEGMENT@16..19 + NAME_REF@16..19 + IDENT@16..19 "foo" + BANG@19..20 "!" + WHITESPACE@20..21 " " + TOKEN_TREE@21..49 + L_PAREN@21..22 "(" + WHITESPACE@22..31 "\n " + IDENT@31..34 "bar" + COMMA@34..35 "," + WHITESPACE@35..36 " " + STRING@36..41 "\"baz\"" + COMMA@41..42 "," + WHITESPACE@42..43 " " + INT_NUMBER@43..44 "1" + COMMA@44..45 "," + WHITESPACE@45..46 " " + FLOAT_NUMBER@46..49 "2.0" + WHITESPACE@49..54 "\n " + R_CURLY@54..55 "}" WHITESPACE@55..56 " " COMMENT@56..91 "//~ ERROR incorrect c ..." WHITESPACE@91..92 "\n" diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast index 4296355f2..7c957fdde 100644 --- a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast +++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast @@ -62,9 +62,8 @@ SOURCE_FILE@0..240 R_PAREN@49..50 ")" WHITESPACE@50..51 " " BLOCK_EXPR@51..53 - BLOCK@51..53 - L_CURLY@51..52 "{" - R_CURLY@52..53 "}" + L_CURLY@51..52 "{" + R_CURLY@52..53 "}" WHITESPACE@53..55 "\n\n" FN_DEF@55..239 FN_KW@55..57 "fn" @@ -76,219 +75,218 @@ SOURCE_FILE@0..240 R_PAREN@63..64 ")" WHITESPACE@64..65 " " BLOCK_EXPR@65..239 - BLOCK@65..239 - L_CURLY@65..66 "{" - WHITESPACE@66..71 "\n " - LET_STMT@71..121 - LET_KW@71..74 "let" - WHITESPACE@74..75 " " - PLACEHOLDER_PAT@75..76 - UNDERSCORE@75..76 "_" - COLON@76..77 ":" - WHITESPACE@77..78 " " - DYN_TRAIT_TYPE@78..121 - TYPE_BOUND_LIST@78..121 - TYPE_BOUND@78..88 - PATH_TYPE@78..88 - PATH@78..88 - PATH_SEGMENT@78..88 - NAME_REF@78..81 - IDENT@78..81 "Box" - TYPE_ARG_LIST@81..88 - L_ANGLE@81..82 "<" - TYPE_ARG@82..88 - PAREN_TYPE@82..88 - L_PAREN@82..83 "(" - PATH_TYPE@83..87 - PATH@83..87 - PATH_SEGMENT@83..87 - NAME_REF@83..87 - IDENT@83..87 "Copy" - R_PAREN@87..88 ")" - WHITESPACE@88..89 " " - PLUS@89..90 "+" - WHITESPACE@90..91 " " - TYPE_BOUND@91..99 - L_PAREN@91..92 "(" - QUESTION@92..93 "?" - PATH_TYPE@93..98 - PATH@93..98 - PATH_SEGMENT@93..98 - NAME_REF@93..98 - IDENT@93..98 "Sized" - R_PAREN@98..99 ")" - WHITESPACE@99..100 " " - PLUS@100..101 "+" - WHITESPACE@101..102 " " - TYPE_BOUND@102..121 - L_PAREN@102..103 "(" - FOR_TYPE@103..120 - FOR_KW@103..106 "for" - TYPE_PARAM_LIST@106..110 - L_ANGLE@106..107 "<" - LIFETIME_PARAM@107..109 - LIFETIME@107..109 "\'a" - R_ANGLE@109..110 ">" - WHITESPACE@110..111 " " - PATH_TYPE@111..120 - PATH@111..120 - PATH_SEGMENT@111..120 - NAME_REF@111..116 - IDENT@111..116 "Trait" - TYPE_ARG_LIST@116..120 - L_ANGLE@116..117 "<" - LIFETIME_ARG@117..119 - LIFETIME@117..119 "\'a" - R_ANGLE@119..120 ">" - R_PAREN@120..121 ")" - EXPR_STMT@121..123 - ERROR@121..122 - R_ANGLE@121..122 ">" - SEMICOLON@122..123 ";" - WHITESPACE@123..128 "\n " - LET_STMT@128..141 - LET_KW@128..131 "let" - WHITESPACE@131..132 " " - PLACEHOLDER_PAT@132..133 - UNDERSCORE@132..133 "_" - COLON@133..134 ":" - WHITESPACE@134..135 " " - PATH_TYPE@135..141 - PATH@135..141 - PATH_SEGMENT@135..141 - NAME_REF@135..138 - IDENT@135..138 "Box" - TYPE_ARG_LIST@138..141 - L_ANGLE@138..139 "<" - TYPE_ARG@139..141 - PAREN_TYPE@139..141 - L_PAREN@139..140 "(" - ERROR@140..141 - QUESTION@140..141 "?" - EXPR_STMT@141..146 - PATH_EXPR@141..146 - PATH@141..146 - PATH_SEGMENT@141..146 - NAME_REF@141..146 - IDENT@141..146 "Sized" - EXPR_STMT@146..147 - ERROR@146..147 - R_PAREN@146..147 ")" - WHITESPACE@147..148 " " - EXPR_STMT@148..149 - ERROR@148..149 - PLUS@148..149 "+" - WHITESPACE@149..150 " " - EXPR_STMT@150..180 - TUPLE_EXPR@150..180 - L_PAREN@150..151 "(" - BIN_EXPR@151..180 - BIN_EXPR@151..178 - BIN_EXPR@151..169 - BIN_EXPR@151..167 - BIN_EXPR@151..164 - FOR_EXPR@151..157 - FOR_KW@151..154 "for" - ERROR@154..155 - L_ANGLE@154..155 "<" - ERROR@155..157 - LIFETIME@155..157 "\'a" - R_ANGLE@157..158 ">" - WHITESPACE@158..159 " " - PATH_EXPR@159..164 - PATH@159..164 - PATH_SEGMENT@159..164 - NAME_REF@159..164 - IDENT@159..164 "Trait" - L_ANGLE@164..165 "<" - ERROR@165..167 - LIFETIME@165..167 "\'a" - R_ANGLE@167..168 ">" - ERROR@168..169 - R_PAREN@168..169 ")" - WHITESPACE@169..170 " " - PLUS@170..171 "+" - WHITESPACE@171..172 " " - PAREN_EXPR@172..178 - L_PAREN@172..173 "(" - PATH_EXPR@173..177 - PATH@173..177 - PATH_SEGMENT@173..177 - NAME_REF@173..177 - IDENT@173..177 "Copy" - R_PAREN@177..178 ")" - R_ANGLE@178..179 ">" - ERROR@179..180 - SEMICOLON@179..180 ";" - WHITESPACE@180..185 "\n " - LET_STMT@185..235 - LET_KW@185..188 "let" - WHITESPACE@188..189 " " - PLACEHOLDER_PAT@189..190 - UNDERSCORE@189..190 "_" - COLON@190..191 ":" - WHITESPACE@191..192 " " - DYN_TRAIT_TYPE@192..235 - TYPE_BOUND_LIST@192..235 - TYPE_BOUND@192..215 - PATH_TYPE@192..215 - PATH@192..215 - PATH_SEGMENT@192..215 - NAME_REF@192..195 - IDENT@192..195 "Box" - TYPE_ARG_LIST@195..215 - L_ANGLE@195..196 "<" - TYPE_ARG@196..215 - PAREN_TYPE@196..215 - L_PAREN@196..197 "(" - FOR_TYPE@197..214 - FOR_KW@197..200 "for" - TYPE_PARAM_LIST@200..204 - L_ANGLE@200..201 "<" - LIFETIME_PARAM@201..203 - LIFETIME@201..203 "\'a" - R_ANGLE@203..204 ">" - WHITESPACE@204..205 " " - PATH_TYPE@205..214 - PATH@205..214 - PATH_SEGMENT@205..214 - NAME_REF@205..210 - IDENT@205..210 "Trait" - TYPE_ARG_LIST@210..214 - L_ANGLE@210..211 "<" - LIFETIME_ARG@211..213 - LIFETIME@211..213 "\'a" - R_ANGLE@213..214 ">" - R_PAREN@214..215 ")" - WHITESPACE@215..216 " " - PLUS@216..217 "+" - WHITESPACE@217..218 " " - TYPE_BOUND@218..224 - L_PAREN@218..219 "(" - PATH_TYPE@219..223 - PATH@219..223 - PATH_SEGMENT@219..223 - NAME_REF@219..223 - IDENT@219..223 "Copy" - R_PAREN@223..224 ")" - WHITESPACE@224..225 " " - PLUS@225..226 "+" - WHITESPACE@226..227 " " - TYPE_BOUND@227..235 - L_PAREN@227..228 "(" - QUESTION@228..229 "?" - PATH_TYPE@229..234 - PATH@229..234 - PATH_SEGMENT@229..234 - NAME_REF@229..234 - IDENT@229..234 "Sized" - R_PAREN@234..235 ")" - EXPR_STMT@235..237 - ERROR@235..236 - R_ANGLE@235..236 ">" - SEMICOLON@236..237 ";" - WHITESPACE@237..238 "\n" - R_CURLY@238..239 "}" + L_CURLY@65..66 "{" + WHITESPACE@66..71 "\n " + LET_STMT@71..121 + LET_KW@71..74 "let" + WHITESPACE@74..75 " " + PLACEHOLDER_PAT@75..76 + UNDERSCORE@75..76 "_" + COLON@76..77 ":" + WHITESPACE@77..78 " " + DYN_TRAIT_TYPE@78..121 + TYPE_BOUND_LIST@78..121 + TYPE_BOUND@78..88 + PATH_TYPE@78..88 + PATH@78..88 + PATH_SEGMENT@78..88 + NAME_REF@78..81 + IDENT@78..81 "Box" + TYPE_ARG_LIST@81..88 + L_ANGLE@81..82 "<" + TYPE_ARG@82..88 + PAREN_TYPE@82..88 + L_PAREN@82..83 "(" + PATH_TYPE@83..87 + PATH@83..87 + PATH_SEGMENT@83..87 + NAME_REF@83..87 + IDENT@83..87 "Copy" + R_PAREN@87..88 ")" + WHITESPACE@88..89 " " + PLUS@89..90 "+" + WHITESPACE@90..91 " " + TYPE_BOUND@91..99 + L_PAREN@91..92 "(" + QUESTION@92..93 "?" + PATH_TYPE@93..98 + PATH@93..98 + PATH_SEGMENT@93..98 + NAME_REF@93..98 + IDENT@93..98 "Sized" + R_PAREN@98..99 ")" + WHITESPACE@99..100 " " + PLUS@100..101 "+" + WHITESPACE@101..102 " " + TYPE_BOUND@102..121 + L_PAREN@102..103 "(" + FOR_TYPE@103..120 + FOR_KW@103..106 "for" + TYPE_PARAM_LIST@106..110 + L_ANGLE@106..107 "<" + LIFETIME_PARAM@107..109 + LIFETIME@107..109 "\'a" + R_ANGLE@109..110 ">" + WHITESPACE@110..111 " " + PATH_TYPE@111..120 + PATH@111..120 + PATH_SEGMENT@111..120 + NAME_REF@111..116 + IDENT@111..116 "Trait" + TYPE_ARG_LIST@116..120 + L_ANGLE@116..117 "<" + LIFETIME_ARG@117..119 + LIFETIME@117..119 "\'a" + R_ANGLE@119..120 ">" + R_PAREN@120..121 ")" + EXPR_STMT@121..123 + ERROR@121..122 + R_ANGLE@121..122 ">" + SEMICOLON@122..123 ";" + WHITESPACE@123..128 "\n " + LET_STMT@128..141 + LET_KW@128..131 "let" + WHITESPACE@131..132 " " + PLACEHOLDER_PAT@132..133 + UNDERSCORE@132..133 "_" + COLON@133..134 ":" + WHITESPACE@134..135 " " + PATH_TYPE@135..141 + PATH@135..141 + PATH_SEGMENT@135..141 + NAME_REF@135..138 + IDENT@135..138 "Box" + TYPE_ARG_LIST@138..141 + L_ANGLE@138..139 "<" + TYPE_ARG@139..141 + PAREN_TYPE@139..141 + L_PAREN@139..140 "(" + ERROR@140..141 + QUESTION@140..141 "?" + EXPR_STMT@141..146 + PATH_EXPR@141..146 + PATH@141..146 + PATH_SEGMENT@141..146 + NAME_REF@141..146 + IDENT@141..146 "Sized" + EXPR_STMT@146..147 + ERROR@146..147 + R_PAREN@146..147 ")" + WHITESPACE@147..148 " " + EXPR_STMT@148..149 + ERROR@148..149 + PLUS@148..149 "+" + WHITESPACE@149..150 " " + EXPR_STMT@150..180 + TUPLE_EXPR@150..180 + L_PAREN@150..151 "(" + BIN_EXPR@151..180 + BIN_EXPR@151..178 + BIN_EXPR@151..169 + BIN_EXPR@151..167 + BIN_EXPR@151..164 + FOR_EXPR@151..157 + FOR_KW@151..154 "for" + ERROR@154..155 + L_ANGLE@154..155 "<" + ERROR@155..157 + LIFETIME@155..157 "\'a" + R_ANGLE@157..158 ">" + WHITESPACE@158..159 " " + PATH_EXPR@159..164 + PATH@159..164 + PATH_SEGMENT@159..164 + NAME_REF@159..164 + IDENT@159..164 "Trait" + L_ANGLE@164..165 "<" + ERROR@165..167 + LIFETIME@165..167 "\'a" + R_ANGLE@167..168 ">" + ERROR@168..169 + R_PAREN@168..169 ")" + WHITESPACE@169..170 " " + PLUS@170..171 "+" + WHITESPACE@171..172 " " + PAREN_EXPR@172..178 + L_PAREN@172..173 "(" + PATH_EXPR@173..177 + PATH@173..177 + PATH_SEGMENT@173..177 + NAME_REF@173..177 + IDENT@173..177 "Copy" + R_PAREN@177..178 ")" + R_ANGLE@178..179 ">" + ERROR@179..180 + SEMICOLON@179..180 ";" + WHITESPACE@180..185 "\n " + LET_STMT@185..235 + LET_KW@185..188 "let" + WHITESPACE@188..189 " " + PLACEHOLDER_PAT@189..190 + UNDERSCORE@189..190 "_" + COLON@190..191 ":" + WHITESPACE@191..192 " " + DYN_TRAIT_TYPE@192..235 + TYPE_BOUND_LIST@192..235 + TYPE_BOUND@192..215 + PATH_TYPE@192..215 + PATH@192..215 + PATH_SEGMENT@192..215 + NAME_REF@192..195 + IDENT@192..195 "Box" + TYPE_ARG_LIST@195..215 + L_ANGLE@195..196 "<" + TYPE_ARG@196..215 + PAREN_TYPE@196..215 + L_PAREN@196..197 "(" + FOR_TYPE@197..214 + FOR_KW@197..200 "for" + TYPE_PARAM_LIST@200..204 + L_ANGLE@200..201 "<" + LIFETIME_PARAM@201..203 + LIFETIME@201..203 "\'a" + R_ANGLE@203..204 ">" + WHITESPACE@204..205 " " + PATH_TYPE@205..214 + PATH@205..214 + PATH_SEGMENT@205..214 + NAME_REF@205..210 + IDENT@205..210 "Trait" + TYPE_ARG_LIST@210..214 + L_ANGLE@210..211 "<" + LIFETIME_ARG@211..213 + LIFETIME@211..213 "\'a" + R_ANGLE@213..214 ">" + R_PAREN@214..215 ")" + WHITESPACE@215..216 " " + PLUS@216..217 "+" + WHITESPACE@217..218 " " + TYPE_BOUND@218..224 + L_PAREN@218..219 "(" + PATH_TYPE@219..223 + PATH@219..223 + PATH_SEGMENT@219..223 + NAME_REF@219..223 + IDENT@219..223 "Copy" + R_PAREN@223..224 ")" + WHITESPACE@224..225 " " + PLUS@225..226 "+" + WHITESPACE@226..227 " " + TYPE_BOUND@227..235 + L_PAREN@227..228 "(" + QUESTION@228..229 "?" + PATH_TYPE@229..234 + PATH@229..234 + PATH_SEGMENT@229..234 + NAME_REF@229..234 + IDENT@229..234 "Sized" + R_PAREN@234..235 ")" + EXPR_STMT@235..237 + ERROR@235..236 + R_ANGLE@235..236 ">" + SEMICOLON@236..237 ";" + WHITESPACE@237..238 "\n" + R_CURLY@238..239 "}" WHITESPACE@239..240 "\n" error 88..88: expected COMMA error 88..88: expected R_ANGLE diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast index 195c08bd9..88b086daf 100644 --- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast @@ -9,187 +9,185 @@ SOURCE_FILE@0..575 R_PAREN@8..9 ")" WHITESPACE@9..10 " " BLOCK_EXPR@10..574 - BLOCK@10..574 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - ENUM_DEF@16..152 - ENUM_KW@16..20 "enum" - WHITESPACE@20..21 " " - NAME@21..25 - IDENT@21..25 "Test" - WHITESPACE@25..26 " " - ENUM_VARIANT_LIST@26..152 - L_CURLY@26..27 "{" - WHITESPACE@27..36 "\n " - ENUM_VARIANT@36..40 - NAME@36..40 - IDENT@36..40 "Var1" - COMMA@40..41 "," - WHITESPACE@41..50 "\n " - ENUM_VARIANT@50..62 - NAME@50..54 - IDENT@50..54 "Var2" - TUPLE_FIELD_DEF_LIST@54..62 - L_PAREN@54..55 "(" - TUPLE_FIELD_DEF@55..61 - PATH_TYPE@55..61 - PATH@55..61 - PATH_SEGMENT@55..61 - NAME_REF@55..61 - IDENT@55..61 "String" - R_PAREN@61..62 ")" - COMMA@62..63 "," - WHITESPACE@63..72 "\n " - ENUM_VARIANT@72..145 - NAME@72..76 - IDENT@72..76 "Var3" - WHITESPACE@76..77 " " - RECORD_FIELD_DEF_LIST@77..145 - L_CURLY@77..78 "{" - WHITESPACE@78..91 "\n " - RECORD_FIELD_DEF@91..95 - NAME@91..94 - IDENT@91..94 "abc" - COLON@94..95 ":" - WHITESPACE@95..96 " " - ERROR@96..98 - L_CURLY@96..97 "{" - R_CURLY@97..98 "}" - ERROR@98..99 - COMMA@98..99 "," - WHITESPACE@99..100 " " - COMMENT@100..135 "//~ ERROR: expected t ..." - WHITESPACE@135..144 "\n " - R_CURLY@144..145 "}" - COMMA@145..146 "," - WHITESPACE@146..151 "\n " - R_CURLY@151..152 "}" - WHITESPACE@152..158 "\n\n " - COMMENT@158..171 "// recover..." - WHITESPACE@171..176 "\n " - LET_STMT@176..186 - LET_KW@176..179 "let" - WHITESPACE@179..180 " " - BIND_PAT@180..181 - NAME@180..181 - IDENT@180..181 "a" - WHITESPACE@181..182 " " - EQ@182..183 "=" - WHITESPACE@183..184 " " - LITERAL@184..185 - INT_NUMBER@184..185 "1" - SEMICOLON@185..186 ";" - WHITESPACE@186..191 "\n " - ENUM_DEF@191..223 - ENUM_KW@191..195 "enum" - WHITESPACE@195..196 " " - NAME@196..201 - IDENT@196..201 "Test2" - WHITESPACE@201..202 " " - ENUM_VARIANT_LIST@202..223 - L_CURLY@202..203 "{" - WHITESPACE@203..212 "\n " - ENUM_VARIANT@212..216 - NAME@212..216 - IDENT@212..216 "Fine" - COMMA@216..217 "," - WHITESPACE@217..222 "\n " - R_CURLY@222..223 "}" - WHITESPACE@223..229 "\n\n " - ENUM_DEF@229..300 - ENUM_KW@229..233 "enum" - WHITESPACE@233..234 " " - NAME@234..239 - IDENT@234..239 "Test3" - WHITESPACE@239..240 " " - ENUM_VARIANT_LIST@240..300 - L_CURLY@240..241 "{" - WHITESPACE@241..250 "\n " - ENUM_VARIANT@250..293 - NAME@250..259 - IDENT@250..259 "StillFine" - WHITESPACE@259..260 " " - RECORD_FIELD_DEF_LIST@260..293 - L_CURLY@260..261 "{" - WHITESPACE@261..274 "\n " - RECORD_FIELD_DEF@274..282 - NAME@274..277 - IDENT@274..277 "def" - COLON@277..278 ":" - WHITESPACE@278..279 " " - PATH_TYPE@279..282 - PATH@279..282 - PATH_SEGMENT@279..282 - NAME_REF@279..282 - IDENT@279..282 "i32" - COMMA@282..283 "," - WHITESPACE@283..292 "\n " - R_CURLY@292..293 "}" - COMMA@293..294 "," - WHITESPACE@294..299 "\n " - R_CURLY@299..300 "}" - WHITESPACE@300..306 "\n\n " - EXPR_STMT@306..459 - BLOCK_EXPR@306..459 - BLOCK@306..459 - L_CURLY@306..307 "{" - WHITESPACE@307..316 "\n " - ENUM_DEF@316..453 - COMMENT@316..329 "// fail again" - WHITESPACE@329..338 "\n " - ENUM_KW@338..342 "enum" - WHITESPACE@342..343 " " - NAME@343..348 - IDENT@343..348 "Test4" - WHITESPACE@348..349 " " - ENUM_VARIANT_LIST@349..453 - L_CURLY@349..350 "{" - WHITESPACE@350..363 "\n " - ENUM_VARIANT@363..372 - NAME@363..367 - IDENT@363..367 "Nope" - TUPLE_FIELD_DEF_LIST@367..372 - L_PAREN@367..368 "(" - TUPLE_FIELD_DEF@368..371 - PATH_TYPE@368..371 - PATH@368..371 - PATH_SEGMENT@368..371 - NAME_REF@368..371 - IDENT@368..371 "i32" - WHITESPACE@371..372 " " - ERROR@372..372 - ERROR@372..374 - L_CURLY@372..373 "{" - R_CURLY@373..374 "}" - ERROR@374..375 - R_PAREN@374..375 ")" - WHITESPACE@375..376 " " - COMMENT@376..396 "//~ ERROR: found `{`" - WHITESPACE@396..422 "\n ..." - COMMENT@422..443 "//~^ ERROR: found `{`" - WHITESPACE@443..452 "\n " - R_CURLY@452..453 "}" - WHITESPACE@453..458 "\n " - R_CURLY@458..459 "}" - WHITESPACE@459..464 "\n " - COMMENT@464..486 "// still recover later" - WHITESPACE@486..491 "\n " - LET_STMT@491..510 - LET_KW@491..494 "let" - WHITESPACE@494..495 " " - BIND_PAT@495..505 - NAME@495..505 - IDENT@495..505 "bad_syntax" - WHITESPACE@505..506 " " - EQ@506..507 "=" - WHITESPACE@507..508 " " - ERROR@508..509 - UNDERSCORE@508..509 "_" - SEMICOLON@509..510 ";" - WHITESPACE@510..511 " " - COMMENT@511..572 "//~ ERROR: expected e ..." - WHITESPACE@572..573 "\n" - R_CURLY@573..574 "}" + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + ENUM_DEF@16..152 + ENUM_KW@16..20 "enum" + WHITESPACE@20..21 " " + NAME@21..25 + IDENT@21..25 "Test" + WHITESPACE@25..26 " " + ENUM_VARIANT_LIST@26..152 + L_CURLY@26..27 "{" + WHITESPACE@27..36 "\n " + ENUM_VARIANT@36..40 + NAME@36..40 + IDENT@36..40 "Var1" + COMMA@40..41 "," + WHITESPACE@41..50 "\n " + ENUM_VARIANT@50..62 + NAME@50..54 + IDENT@50..54 "Var2" + TUPLE_FIELD_DEF_LIST@54..62 + L_PAREN@54..55 "(" + TUPLE_FIELD_DEF@55..61 + PATH_TYPE@55..61 + PATH@55..61 + PATH_SEGMENT@55..61 + NAME_REF@55..61 + IDENT@55..61 "String" + R_PAREN@61..62 ")" + COMMA@62..63 "," + WHITESPACE@63..72 "\n " + ENUM_VARIANT@72..145 + NAME@72..76 + IDENT@72..76 "Var3" + WHITESPACE@76..77 " " + RECORD_FIELD_DEF_LIST@77..145 + L_CURLY@77..78 "{" + WHITESPACE@78..91 "\n " + RECORD_FIELD_DEF@91..95 + NAME@91..94 + IDENT@91..94 "abc" + COLON@94..95 ":" + WHITESPACE@95..96 " " + ERROR@96..98 + L_CURLY@96..97 "{" + R_CURLY@97..98 "}" + ERROR@98..99 + COMMA@98..99 "," + WHITESPACE@99..100 " " + COMMENT@100..135 "//~ ERROR: expected t ..." + WHITESPACE@135..144 "\n " + R_CURLY@144..145 "}" + COMMA@145..146 "," + WHITESPACE@146..151 "\n " + R_CURLY@151..152 "}" + WHITESPACE@152..158 "\n\n " + COMMENT@158..171 "// recover..." + WHITESPACE@171..176 "\n " + LET_STMT@176..186 + LET_KW@176..179 "let" + WHITESPACE@179..180 " " + BIND_PAT@180..181 + NAME@180..181 + IDENT@180..181 "a" + WHITESPACE@181..182 " " + EQ@182..183 "=" + WHITESPACE@183..184 " " + LITERAL@184..185 + INT_NUMBER@184..185 "1" + SEMICOLON@185..186 ";" + WHITESPACE@186..191 "\n " + ENUM_DEF@191..223 + ENUM_KW@191..195 "enum" + WHITESPACE@195..196 " " + NAME@196..201 + IDENT@196..201 "Test2" + WHITESPACE@201..202 " " + ENUM_VARIANT_LIST@202..223 + L_CURLY@202..203 "{" + WHITESPACE@203..212 "\n " + ENUM_VARIANT@212..216 + NAME@212..216 + IDENT@212..216 "Fine" + COMMA@216..217 "," + WHITESPACE@217..222 "\n " + R_CURLY@222..223 "}" + WHITESPACE@223..229 "\n\n " + ENUM_DEF@229..300 + ENUM_KW@229..233 "enum" + WHITESPACE@233..234 " " + NAME@234..239 + IDENT@234..239 "Test3" + WHITESPACE@239..240 " " + ENUM_VARIANT_LIST@240..300 + L_CURLY@240..241 "{" + WHITESPACE@241..250 "\n " + ENUM_VARIANT@250..293 + NAME@250..259 + IDENT@250..259 "StillFine" + WHITESPACE@259..260 " " + RECORD_FIELD_DEF_LIST@260..293 + L_CURLY@260..261 "{" + WHITESPACE@261..274 "\n " + RECORD_FIELD_DEF@274..282 + NAME@274..277 + IDENT@274..277 "def" + COLON@277..278 ":" + WHITESPACE@278..279 " " + PATH_TYPE@279..282 + PATH@279..282 + PATH_SEGMENT@279..282 + NAME_REF@279..282 + IDENT@279..282 "i32" + COMMA@282..283 "," + WHITESPACE@283..292 "\n " + R_CURLY@292..293 "}" + COMMA@293..294 "," + WHITESPACE@294..299 "\n " + R_CURLY@299..300 "}" + WHITESPACE@300..306 "\n\n " + EXPR_STMT@306..459 + BLOCK_EXPR@306..459 + L_CURLY@306..307 "{" + WHITESPACE@307..316 "\n " + ENUM_DEF@316..453 + COMMENT@316..329 "// fail again" + WHITESPACE@329..338 "\n " + ENUM_KW@338..342 "enum" + WHITESPACE@342..343 " " + NAME@343..348 + IDENT@343..348 "Test4" + WHITESPACE@348..349 " " + ENUM_VARIANT_LIST@349..453 + L_CURLY@349..350 "{" + WHITESPACE@350..363 "\n " + ENUM_VARIANT@363..372 + NAME@363..367 + IDENT@363..367 "Nope" + TUPLE_FIELD_DEF_LIST@367..372 + L_PAREN@367..368 "(" + TUPLE_FIELD_DEF@368..371 + PATH_TYPE@368..371 + PATH@368..371 + PATH_SEGMENT@368..371 + NAME_REF@368..371 + IDENT@368..371 "i32" + WHITESPACE@371..372 " " + ERROR@372..372 + ERROR@372..374 + L_CURLY@372..373 "{" + R_CURLY@373..374 "}" + ERROR@374..375 + R_PAREN@374..375 ")" + WHITESPACE@375..376 " " + COMMENT@376..396 "//~ ERROR: found `{`" + WHITESPACE@396..422 "\n ..." + COMMENT@422..443 "//~^ ERROR: found `{`" + WHITESPACE@443..452 "\n " + R_CURLY@452..453 "}" + WHITESPACE@453..458 "\n " + R_CURLY@458..459 "}" + WHITESPACE@459..464 "\n " + COMMENT@464..486 "// still recover later" + WHITESPACE@486..491 "\n " + LET_STMT@491..510 + LET_KW@491..494 "let" + WHITESPACE@494..495 " " + BIND_PAT@495..505 + NAME@495..505 + IDENT@495..505 "bad_syntax" + WHITESPACE@505..506 " " + EQ@506..507 "=" + WHITESPACE@507..508 " " + ERROR@508..509 + UNDERSCORE@508..509 "_" + SEMICOLON@509..510 ";" + WHITESPACE@510..511 " " + COMMENT@511..572 "//~ ERROR: expected e ..." + WHITESPACE@572..573 "\n" + R_CURLY@573..574 "}" WHITESPACE@574..575 "\n" error 95..95: expected type error 95..95: expected COMMA diff --git a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast index f2fada510..568a4cc02 100644 --- a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast +++ b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast @@ -21,9 +21,8 @@ SOURCE_FILE@0..30 R_ANGLE@25..26 ">" WHITESPACE@26..27 "\n" BLOCK_EXPR@27..29 - BLOCK@27..29 - L_CURLY@27..28 "{" - R_CURLY@28..29 "}" + L_CURLY@27..28 "{" + R_CURLY@28..29 "}" WHITESPACE@29..30 "\n" error 26..26: expected a path error 26..26: expected colon diff --git a/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast b/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast index 56682f966..0da8f59f0 100644 --- a/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast +++ b/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast @@ -20,17 +20,16 @@ SOURCE_FILE@0..24 R_PAREN@11..12 ")" WHITESPACE@12..13 " " BLOCK_EXPR@13..23 - BLOCK@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 "}" + 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 diff --git a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast index aac476430..515819e42 100644 --- a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast @@ -9,115 +9,111 @@ SOURCE_FILE@0..350 R_PAREN@9..10 ")" WHITESPACE@10..11 " " BLOCK_EXPR@11..349 - BLOCK@11..349 - L_CURLY@11..12 "{" - WHITESPACE@12..17 "\n " - LET_STMT@17..129 - LET_KW@17..20 "let" - WHITESPACE@20..21 " " - BIND_PAT@21..26 - NAME@21..26 - IDENT@21..26 "inner" - WHITESPACE@26..27 " " - EQ@27..28 "=" - WHITESPACE@28..29 " " - BLOCK_EXPR@29..128 - BLOCK@29..128 - L_CURLY@29..30 "{" - WHITESPACE@30..39 "\n " - ATTR@39..83 - POUND@39..40 "#" - BANG@40..41 "!" - L_BRACK@41..42 "[" - PATH@42..45 - PATH_SEGMENT@42..45 - NAME_REF@42..45 - IDENT@42..45 "doc" - TOKEN_TREE@45..82 - L_PAREN@45..46 "(" - STRING@46..81 "\"Inner attributes not ..." - R_PAREN@81..82 ")" - R_BRACK@82..83 "]" - WHITESPACE@83..92 "\n " - COMMENT@92..122 "//! Nor are ModuleDoc ..." - WHITESPACE@122..127 "\n " - R_CURLY@127..128 "}" - SEMICOLON@128..129 ";" - WHITESPACE@129..134 "\n " - EXPR_STMT@134..257 - IF_EXPR@134..257 - IF_KW@134..136 "if" - WHITESPACE@136..137 " " - CONDITION@137..141 - LITERAL@137..141 - TRUE_KW@137..141 "true" - WHITESPACE@141..142 " " - BLOCK_EXPR@142..257 - BLOCK@142..257 - L_CURLY@142..143 "{" - WHITESPACE@143..152 "\n " - ATTR@152..171 - POUND@152..153 "#" - BANG@153..154 "!" - L_BRACK@154..155 "[" - PATH@155..158 - PATH_SEGMENT@155..158 - NAME_REF@155..158 - IDENT@155..158 "doc" - TOKEN_TREE@158..170 - L_PAREN@158..159 "(" - STRING@159..169 "\"Nor here\"" - R_PAREN@169..170 ")" - R_BRACK@170..171 "]" - WHITESPACE@171..180 "\n " - ATTR@180..212 - POUND@180..181 "#" - BANG@181..182 "!" - L_BRACK@182..183 "[" - PATH@183..186 - PATH_SEGMENT@183..186 - NAME_REF@183..186 - IDENT@183..186 "doc" - TOKEN_TREE@186..211 - L_PAREN@186..187 "(" - STRING@187..210 "\"We error on each attr\"" - R_PAREN@210..211 ")" - R_BRACK@211..212 "]" - WHITESPACE@212..221 "\n " - COMMENT@221..251 "//! Nor are ModuleDoc ..." - WHITESPACE@251..256 "\n " - R_CURLY@256..257 "}" - WHITESPACE@257..262 "\n " - WHILE_EXPR@262..347 - WHILE_KW@262..267 "while" - WHITESPACE@267..268 " " - CONDITION@268..272 - LITERAL@268..272 - TRUE_KW@268..272 "true" - WHITESPACE@272..273 " " - BLOCK_EXPR@273..347 - BLOCK@273..347 - L_CURLY@273..274 "{" - WHITESPACE@274..283 "\n " - ATTR@283..302 - POUND@283..284 "#" - BANG@284..285 "!" - L_BRACK@285..286 "[" - PATH@286..289 - PATH_SEGMENT@286..289 - NAME_REF@286..289 - IDENT@286..289 "doc" - TOKEN_TREE@289..301 - L_PAREN@289..290 "(" - STRING@290..300 "\"Nor here\"" - R_PAREN@300..301 ")" - R_BRACK@301..302 "]" - WHITESPACE@302..311 "\n " - COMMENT@311..341 "//! Nor are ModuleDoc ..." - WHITESPACE@341..346 "\n " - R_CURLY@346..347 "}" - WHITESPACE@347..348 "\n" - R_CURLY@348..349 "}" + L_CURLY@11..12 "{" + WHITESPACE@12..17 "\n " + LET_STMT@17..129 + LET_KW@17..20 "let" + WHITESPACE@20..21 " " + BIND_PAT@21..26 + NAME@21..26 + IDENT@21..26 "inner" + WHITESPACE@26..27 " " + EQ@27..28 "=" + WHITESPACE@28..29 " " + BLOCK_EXPR@29..128 + L_CURLY@29..30 "{" + WHITESPACE@30..39 "\n " + ATTR@39..83 + POUND@39..40 "#" + BANG@40..41 "!" + L_BRACK@41..42 "[" + PATH@42..45 + PATH_SEGMENT@42..45 + NAME_REF@42..45 + IDENT@42..45 "doc" + TOKEN_TREE@45..82 + L_PAREN@45..46 "(" + STRING@46..81 "\"Inner attributes not ..." + R_PAREN@81..82 ")" + R_BRACK@82..83 "]" + WHITESPACE@83..92 "\n " + COMMENT@92..122 "//! Nor are ModuleDoc ..." + WHITESPACE@122..127 "\n " + R_CURLY@127..128 "}" + SEMICOLON@128..129 ";" + WHITESPACE@129..134 "\n " + EXPR_STMT@134..257 + IF_EXPR@134..257 + IF_KW@134..136 "if" + WHITESPACE@136..137 " " + CONDITION@137..141 + LITERAL@137..141 + TRUE_KW@137..141 "true" + WHITESPACE@141..142 " " + BLOCK_EXPR@142..257 + L_CURLY@142..143 "{" + WHITESPACE@143..152 "\n " + ATTR@152..171 + POUND@152..153 "#" + BANG@153..154 "!" + L_BRACK@154..155 "[" + PATH@155..158 + PATH_SEGMENT@155..158 + NAME_REF@155..158 + IDENT@155..158 "doc" + TOKEN_TREE@158..170 + L_PAREN@158..159 "(" + STRING@159..169 "\"Nor here\"" + R_PAREN@169..170 ")" + R_BRACK@170..171 "]" + WHITESPACE@171..180 "\n " + ATTR@180..212 + POUND@180..181 "#" + BANG@181..182 "!" + L_BRACK@182..183 "[" + PATH@183..186 + PATH_SEGMENT@183..186 + NAME_REF@183..186 + IDENT@183..186 "doc" + TOKEN_TREE@186..211 + L_PAREN@186..187 "(" + STRING@187..210 "\"We error on each attr\"" + R_PAREN@210..211 ")" + R_BRACK@211..212 "]" + WHITESPACE@212..221 "\n " + COMMENT@221..251 "//! Nor are ModuleDoc ..." + WHITESPACE@251..256 "\n " + R_CURLY@256..257 "}" + WHITESPACE@257..262 "\n " + WHILE_EXPR@262..347 + WHILE_KW@262..267 "while" + WHITESPACE@267..268 " " + CONDITION@268..272 + LITERAL@268..272 + TRUE_KW@268..272 "true" + WHITESPACE@272..273 " " + BLOCK_EXPR@273..347 + L_CURLY@273..274 "{" + WHITESPACE@274..283 "\n " + ATTR@283..302 + POUND@283..284 "#" + BANG@284..285 "!" + L_BRACK@285..286 "[" + PATH@286..289 + PATH_SEGMENT@286..289 + NAME_REF@286..289 + IDENT@286..289 "doc" + TOKEN_TREE@289..301 + L_PAREN@289..290 "(" + STRING@290..300 "\"Nor here\"" + R_PAREN@300..301 ")" + R_BRACK@301..302 "]" + WHITESPACE@302..311 "\n " + COMMENT@311..341 "//! Nor are ModuleDoc ..." + WHITESPACE@341..346 "\n " + R_CURLY@346..347 "}" + WHITESPACE@347..348 "\n" + R_CURLY@348..349 "}" WHITESPACE@349..350 "\n" error 39..83: A block in this position cannot accept inner attributes error 152..171: A block in this position cannot accept inner attributes diff --git a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast index f98de7f15..c6859eca8 100644 --- a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast @@ -9,187 +9,186 @@ SOURCE_FILE@0..293 R_PAREN@7..8 ")" WHITESPACE@8..9 " " BLOCK_EXPR@9..292 - BLOCK@9..292 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - EXPR_STMT@15..101 - MATCH_EXPR@15..101 - MATCH_KW@15..20 "match" - WHITESPACE@20..21 " " - TUPLE_EXPR@21..23 - L_PAREN@21..22 "(" - R_PAREN@22..23 ")" - WHITESPACE@23..24 " " - MATCH_ARM_LIST@24..101 - L_CURLY@24..25 "{" - WHITESPACE@25..34 "\n " - MATCH_ARM@34..41 - PLACEHOLDER_PAT@34..35 - UNDERSCORE@34..35 "_" - WHITESPACE@35..36 " " - FAT_ARROW@36..38 "=>" - WHITESPACE@38..39 " " - TUPLE_EXPR@39..41 - L_PAREN@39..40 "(" - R_PAREN@40..41 ")" - COMMA@41..42 "," - WHITESPACE@42..51 "\n " - MATCH_ARM@51..78 - ATTR@51..52 - POUND@51..52 "#" - ERROR@52..53 - BANG@52..53 "!" - ARRAY_EXPR@53..78 - L_BRACK@53..54 "[" - CALL_EXPR@54..77 - PATH_EXPR@54..57 - PATH@54..57 - PATH_SEGMENT@54..57 - NAME_REF@54..57 - IDENT@54..57 "doc" - ARG_LIST@57..77 - L_PAREN@57..58 "(" - LITERAL@58..76 - STRING@58..76 "\"Not allowed here\"" - R_PAREN@76..77 ")" - R_BRACK@77..78 "]" - WHITESPACE@78..87 "\n " - MATCH_ARM@87..94 - PLACEHOLDER_PAT@87..88 - UNDERSCORE@87..88 "_" - WHITESPACE@88..89 " " - FAT_ARROW@89..91 "=>" - WHITESPACE@91..92 " " - TUPLE_EXPR@92..94 - L_PAREN@92..93 "(" - R_PAREN@93..94 ")" - COMMA@94..95 "," - WHITESPACE@95..100 "\n " - R_CURLY@100..101 "}" - WHITESPACE@101..107 "\n\n " - EXPR_STMT@107..185 - MATCH_EXPR@107..185 - MATCH_KW@107..112 "match" - WHITESPACE@112..113 " " - TUPLE_EXPR@113..115 - L_PAREN@113..114 "(" - R_PAREN@114..115 ")" - WHITESPACE@115..116 " " - MATCH_ARM_LIST@116..185 - L_CURLY@116..117 "{" - WHITESPACE@117..126 "\n " - MATCH_ARM@126..133 - PLACEHOLDER_PAT@126..127 - UNDERSCORE@126..127 "_" - WHITESPACE@127..128 " " - FAT_ARROW@128..130 "=>" - WHITESPACE@130..131 " " - TUPLE_EXPR@131..133 - L_PAREN@131..132 "(" - R_PAREN@132..133 ")" - COMMA@133..134 "," - WHITESPACE@134..143 "\n " - MATCH_ARM@143..150 - PLACEHOLDER_PAT@143..144 - UNDERSCORE@143..144 "_" - WHITESPACE@144..145 " " - FAT_ARROW@145..147 "=>" - WHITESPACE@147..148 " " - TUPLE_EXPR@148..150 - L_PAREN@148..149 "(" - R_PAREN@149..150 ")" - COMMA@150..151 "," - WHITESPACE@151..160 "\n " - MATCH_ARM@160..179 - ATTR@160..161 - POUND@160..161 "#" - ERROR@161..162 - BANG@161..162 "!" - ARRAY_EXPR@162..179 - L_BRACK@162..163 "[" - CALL_EXPR@163..178 - PATH_EXPR@163..166 - PATH@163..166 - PATH_SEGMENT@163..166 - NAME_REF@163..166 - IDENT@163..166 "doc" - ARG_LIST@166..178 - L_PAREN@166..167 "(" - LITERAL@167..177 - STRING@167..177 "\"Nor here\"" - R_PAREN@177..178 ")" - R_BRACK@178..179 "]" - WHITESPACE@179..184 "\n " - R_CURLY@184..185 "}" - WHITESPACE@185..191 "\n\n " - MATCH_EXPR@191..290 - MATCH_KW@191..196 "match" - WHITESPACE@196..197 " " - TUPLE_EXPR@197..199 - L_PAREN@197..198 "(" - R_PAREN@198..199 ")" - WHITESPACE@199..200 " " - MATCH_ARM_LIST@200..290 - L_CURLY@200..201 "{" - WHITESPACE@201..210 "\n " - MATCH_ARM@210..250 - ATTR@210..222 - POUND@210..211 "#" - L_BRACK@211..212 "[" - PATH@212..215 - PATH_SEGMENT@212..215 - NAME_REF@212..215 - IDENT@212..215 "cfg" - TOKEN_TREE@215..221 - L_PAREN@215..216 "(" - IDENT@216..220 "test" - R_PAREN@220..221 ")" - R_BRACK@221..222 "]" - WHITESPACE@222..231 "\n " - ATTR@231..232 - POUND@231..232 "#" - ERROR@232..233 - BANG@232..233 "!" - ARRAY_EXPR@233..250 - L_BRACK@233..234 "[" - CALL_EXPR@234..249 - PATH_EXPR@234..237 - PATH@234..237 - PATH_SEGMENT@234..237 - NAME_REF@234..237 - IDENT@234..237 "doc" - ARG_LIST@237..249 - L_PAREN@237..238 "(" - LITERAL@238..248 - STRING@238..248 "\"Nor here\"" - R_PAREN@248..249 ")" - R_BRACK@249..250 "]" - WHITESPACE@250..259 "\n " - MATCH_ARM@259..266 - PLACEHOLDER_PAT@259..260 - UNDERSCORE@259..260 "_" - WHITESPACE@260..261 " " - FAT_ARROW@261..263 "=>" - WHITESPACE@263..264 " " - TUPLE_EXPR@264..266 - L_PAREN@264..265 "(" - R_PAREN@265..266 ")" - COMMA@266..267 "," - WHITESPACE@267..276 "\n " - MATCH_ARM@276..283 - PLACEHOLDER_PAT@276..277 - UNDERSCORE@276..277 "_" - WHITESPACE@277..278 " " - FAT_ARROW@278..280 "=>" - WHITESPACE@280..281 " " - TUPLE_EXPR@281..283 - L_PAREN@281..282 "(" - R_PAREN@282..283 ")" - COMMA@283..284 "," - WHITESPACE@284..289 "\n " - R_CURLY@289..290 "}" - WHITESPACE@290..291 "\n" - R_CURLY@291..292 "}" + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + EXPR_STMT@15..101 + MATCH_EXPR@15..101 + MATCH_KW@15..20 "match" + WHITESPACE@20..21 " " + TUPLE_EXPR@21..23 + L_PAREN@21..22 "(" + R_PAREN@22..23 ")" + WHITESPACE@23..24 " " + MATCH_ARM_LIST@24..101 + L_CURLY@24..25 "{" + WHITESPACE@25..34 "\n " + MATCH_ARM@34..41 + PLACEHOLDER_PAT@34..35 + UNDERSCORE@34..35 "_" + WHITESPACE@35..36 " " + FAT_ARROW@36..38 "=>" + WHITESPACE@38..39 " " + TUPLE_EXPR@39..41 + L_PAREN@39..40 "(" + R_PAREN@40..41 ")" + COMMA@41..42 "," + WHITESPACE@42..51 "\n " + MATCH_ARM@51..78 + ATTR@51..52 + POUND@51..52 "#" + ERROR@52..53 + BANG@52..53 "!" + ARRAY_EXPR@53..78 + L_BRACK@53..54 "[" + CALL_EXPR@54..77 + PATH_EXPR@54..57 + PATH@54..57 + PATH_SEGMENT@54..57 + NAME_REF@54..57 + IDENT@54..57 "doc" + ARG_LIST@57..77 + L_PAREN@57..58 "(" + LITERAL@58..76 + STRING@58..76 "\"Not allowed here\"" + R_PAREN@76..77 ")" + R_BRACK@77..78 "]" + WHITESPACE@78..87 "\n " + MATCH_ARM@87..94 + PLACEHOLDER_PAT@87..88 + UNDERSCORE@87..88 "_" + WHITESPACE@88..89 " " + FAT_ARROW@89..91 "=>" + WHITESPACE@91..92 " " + TUPLE_EXPR@92..94 + L_PAREN@92..93 "(" + R_PAREN@93..94 ")" + COMMA@94..95 "," + WHITESPACE@95..100 "\n " + R_CURLY@100..101 "}" + WHITESPACE@101..107 "\n\n " + EXPR_STMT@107..185 + MATCH_EXPR@107..185 + MATCH_KW@107..112 "match" + WHITESPACE@112..113 " " + TUPLE_EXPR@113..115 + L_PAREN@113..114 "(" + R_PAREN@114..115 ")" + WHITESPACE@115..116 " " + MATCH_ARM_LIST@116..185 + L_CURLY@116..117 "{" + WHITESPACE@117..126 "\n " + MATCH_ARM@126..133 + PLACEHOLDER_PAT@126..127 + UNDERSCORE@126..127 "_" + WHITESPACE@127..128 " " + FAT_ARROW@128..130 "=>" + WHITESPACE@130..131 " " + TUPLE_EXPR@131..133 + L_PAREN@131..132 "(" + R_PAREN@132..133 ")" + COMMA@133..134 "," + WHITESPACE@134..143 "\n " + MATCH_ARM@143..150 + PLACEHOLDER_PAT@143..144 + UNDERSCORE@143..144 "_" + WHITESPACE@144..145 " " + FAT_ARROW@145..147 "=>" + WHITESPACE@147..148 " " + TUPLE_EXPR@148..150 + L_PAREN@148..149 "(" + R_PAREN@149..150 ")" + COMMA@150..151 "," + WHITESPACE@151..160 "\n " + MATCH_ARM@160..179 + ATTR@160..161 + POUND@160..161 "#" + ERROR@161..162 + BANG@161..162 "!" + ARRAY_EXPR@162..179 + L_BRACK@162..163 "[" + CALL_EXPR@163..178 + PATH_EXPR@163..166 + PATH@163..166 + PATH_SEGMENT@163..166 + NAME_REF@163..166 + IDENT@163..166 "doc" + ARG_LIST@166..178 + L_PAREN@166..167 "(" + LITERAL@167..177 + STRING@167..177 "\"Nor here\"" + R_PAREN@177..178 ")" + R_BRACK@178..179 "]" + WHITESPACE@179..184 "\n " + R_CURLY@184..185 "}" + WHITESPACE@185..191 "\n\n " + MATCH_EXPR@191..290 + MATCH_KW@191..196 "match" + WHITESPACE@196..197 " " + TUPLE_EXPR@197..199 + L_PAREN@197..198 "(" + R_PAREN@198..199 ")" + WHITESPACE@199..200 " " + MATCH_ARM_LIST@200..290 + L_CURLY@200..201 "{" + WHITESPACE@201..210 "\n " + MATCH_ARM@210..250 + ATTR@210..222 + POUND@210..211 "#" + L_BRACK@211..212 "[" + PATH@212..215 + PATH_SEGMENT@212..215 + NAME_REF@212..215 + IDENT@212..215 "cfg" + TOKEN_TREE@215..221 + L_PAREN@215..216 "(" + IDENT@216..220 "test" + R_PAREN@220..221 ")" + R_BRACK@221..222 "]" + WHITESPACE@222..231 "\n " + ATTR@231..232 + POUND@231..232 "#" + ERROR@232..233 + BANG@232..233 "!" + ARRAY_EXPR@233..250 + L_BRACK@233..234 "[" + CALL_EXPR@234..249 + PATH_EXPR@234..237 + PATH@234..237 + PATH_SEGMENT@234..237 + NAME_REF@234..237 + IDENT@234..237 "doc" + ARG_LIST@237..249 + L_PAREN@237..238 "(" + LITERAL@238..248 + STRING@238..248 "\"Nor here\"" + R_PAREN@248..249 ")" + R_BRACK@249..250 "]" + WHITESPACE@250..259 "\n " + MATCH_ARM@259..266 + PLACEHOLDER_PAT@259..260 + UNDERSCORE@259..260 "_" + WHITESPACE@260..261 " " + FAT_ARROW@261..263 "=>" + WHITESPACE@263..264 " " + TUPLE_EXPR@264..266 + L_PAREN@264..265 "(" + R_PAREN@265..266 ")" + COMMA@266..267 "," + WHITESPACE@267..276 "\n " + MATCH_ARM@276..283 + PLACEHOLDER_PAT@276..277 + UNDERSCORE@276..277 "_" + WHITESPACE@277..278 " " + FAT_ARROW@278..280 "=>" + WHITESPACE@280..281 " " + TUPLE_EXPR@281..283 + L_PAREN@281..282 "(" + R_PAREN@282..283 ")" + COMMA@283..284 "," + WHITESPACE@284..289 "\n " + R_CURLY@289..290 "}" + WHITESPACE@290..291 "\n" + R_CURLY@291..292 "}" WHITESPACE@292..293 "\n" error 52..52: expected `[` error 52..52: expected pattern diff --git a/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast index d0017c883..53e445459 100644 --- a/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast @@ -9,58 +9,57 @@ SOURCE_FILE@0..89 R_PAREN@7..8 ")" WHITESPACE@8..9 " " BLOCK_EXPR@9..88 - BLOCK@9..88 - L_CURLY@9..10 "{" - WHITESPACE@10..15 "\n " - MATCH_EXPR@15..86 - MATCH_KW@15..20 "match" - WHITESPACE@20..21 " " - TUPLE_EXPR@21..23 - L_PAREN@21..22 "(" - R_PAREN@22..23 ")" - WHITESPACE@23..24 " " - MATCH_ARM_LIST@24..86 - L_CURLY@24..25 "{" - WHITESPACE@25..34 "\n " - MATCH_ARM@34..41 - PLACEHOLDER_PAT@34..35 - UNDERSCORE@34..35 "_" - WHITESPACE@35..36 " " - FAT_ARROW@36..38 "=>" - WHITESPACE@38..39 " " - TUPLE_EXPR@39..41 - L_PAREN@39..40 "(" - R_PAREN@40..41 ")" - COMMA@41..42 "," - WHITESPACE@42..51 "\n " - MATCH_ARM@51..58 - PLACEHOLDER_PAT@51..52 - UNDERSCORE@51..52 "_" - WHITESPACE@52..53 " " - FAT_ARROW@53..55 "=>" - WHITESPACE@55..56 " " - TUPLE_EXPR@56..58 - L_PAREN@56..57 "(" - R_PAREN@57..58 ")" - COMMA@58..59 "," - WHITESPACE@59..68 "\n " - MATCH_ARM@68..80 - ATTR@68..80 - POUND@68..69 "#" - L_BRACK@69..70 "[" - PATH@70..73 - PATH_SEGMENT@70..73 - NAME_REF@70..73 - IDENT@70..73 "cfg" - TOKEN_TREE@73..79 - L_PAREN@73..74 "(" - IDENT@74..78 "test" - R_PAREN@78..79 ")" - R_BRACK@79..80 "]" - WHITESPACE@80..85 "\n " - R_CURLY@85..86 "}" - WHITESPACE@86..87 "\n" - R_CURLY@87..88 "}" + L_CURLY@9..10 "{" + WHITESPACE@10..15 "\n " + MATCH_EXPR@15..86 + MATCH_KW@15..20 "match" + WHITESPACE@20..21 " " + TUPLE_EXPR@21..23 + L_PAREN@21..22 "(" + R_PAREN@22..23 ")" + WHITESPACE@23..24 " " + MATCH_ARM_LIST@24..86 + L_CURLY@24..25 "{" + WHITESPACE@25..34 "\n " + MATCH_ARM@34..41 + PLACEHOLDER_PAT@34..35 + UNDERSCORE@34..35 "_" + WHITESPACE@35..36 " " + FAT_ARROW@36..38 "=>" + WHITESPACE@38..39 " " + TUPLE_EXPR@39..41 + L_PAREN@39..40 "(" + R_PAREN@40..41 ")" + COMMA@41..42 "," + WHITESPACE@42..51 "\n " + MATCH_ARM@51..58 + PLACEHOLDER_PAT@51..52 + UNDERSCORE@51..52 "_" + WHITESPACE@52..53 " " + FAT_ARROW@53..55 "=>" + WHITESPACE@55..56 " " + TUPLE_EXPR@56..58 + L_PAREN@56..57 "(" + R_PAREN@57..58 ")" + COMMA@58..59 "," + WHITESPACE@59..68 "\n " + MATCH_ARM@68..80 + ATTR@68..80 + POUND@68..69 "#" + L_BRACK@69..70 "[" + PATH@70..73 + PATH_SEGMENT@70..73 + NAME_REF@70..73 + IDENT@70..73 "cfg" + TOKEN_TREE@73..79 + L_PAREN@73..74 "(" + IDENT@74..78 "test" + R_PAREN@78..79 ")" + R_BRACK@79..80 "]" + WHITESPACE@80..85 "\n " + R_CURLY@85..86 "}" + WHITESPACE@86..87 "\n" + R_CURLY@87..88 "}" WHITESPACE@88..89 "\n" error 80..80: expected pattern error 80..80: expected FAT_ARROW diff --git a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast index 2c0bddec8..1b2ac5011 100644 --- a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast +++ b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast @@ -9,84 +9,83 @@ SOURCE_FILE@0..91 R_PAREN@8..9 ")" WHITESPACE@9..10 " " BLOCK_EXPR@10..89 - BLOCK@10..89 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - LET_STMT@16..27 - LET_KW@16..19 "let" - WHITESPACE@19..20 " " - BIND_PAT@20..27 - REF_KW@20..23 "ref" - WHITESPACE@23..24 " " - ERROR@24..27 - BOX_KW@24..27 "box" - WHITESPACE@27..28 " " - EXPR_STMT@28..35 - BIN_EXPR@28..34 - PATH_EXPR@28..29 - PATH@28..29 - PATH_SEGMENT@28..29 - NAME_REF@28..29 - IDENT@28..29 "i" - WHITESPACE@29..30 " " - EQ@30..31 "=" - WHITESPACE@31..32 " " - TUPLE_EXPR@32..34 - L_PAREN@32..33 "(" - R_PAREN@33..34 ")" - SEMICOLON@34..35 ";" - WHITESPACE@35..40 "\n " - LET_STMT@40..51 - LET_KW@40..43 "let" - WHITESPACE@43..44 " " - BIND_PAT@44..51 - MUT_KW@44..47 "mut" - WHITESPACE@47..48 " " - ERROR@48..51 - BOX_KW@48..51 "box" - WHITESPACE@51..52 " " - EXPR_STMT@52..59 - BIN_EXPR@52..58 - PATH_EXPR@52..53 - PATH@52..53 - PATH_SEGMENT@52..53 - NAME_REF@52..53 - IDENT@52..53 "i" - WHITESPACE@53..54 " " - EQ@54..55 "=" - WHITESPACE@55..56 " " - TUPLE_EXPR@56..58 - L_PAREN@56..57 "(" - R_PAREN@57..58 ")" - SEMICOLON@58..59 ";" - WHITESPACE@59..64 "\n " - LET_STMT@64..79 - LET_KW@64..67 "let" - WHITESPACE@67..68 " " - BIND_PAT@68..79 - REF_KW@68..71 "ref" - WHITESPACE@71..72 " " - MUT_KW@72..75 "mut" - WHITESPACE@75..76 " " - ERROR@76..79 - BOX_KW@76..79 "box" - WHITESPACE@79..80 " " - EXPR_STMT@80..87 - BIN_EXPR@80..86 - PATH_EXPR@80..81 - PATH@80..81 - PATH_SEGMENT@80..81 - NAME_REF@80..81 - IDENT@80..81 "i" - WHITESPACE@81..82 " " - EQ@82..83 "=" - WHITESPACE@83..84 " " - TUPLE_EXPR@84..86 - L_PAREN@84..85 "(" - R_PAREN@85..86 ")" - SEMICOLON@86..87 ";" - WHITESPACE@87..88 "\n" - R_CURLY@88..89 "}" + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + LET_STMT@16..27 + LET_KW@16..19 "let" + WHITESPACE@19..20 " " + BIND_PAT@20..27 + REF_KW@20..23 "ref" + WHITESPACE@23..24 " " + ERROR@24..27 + BOX_KW@24..27 "box" + WHITESPACE@27..28 " " + EXPR_STMT@28..35 + BIN_EXPR@28..34 + PATH_EXPR@28..29 + PATH@28..29 + PATH_SEGMENT@28..29 + NAME_REF@28..29 + IDENT@28..29 "i" + WHITESPACE@29..30 " " + EQ@30..31 "=" + WHITESPACE@31..32 " " + TUPLE_EXPR@32..34 + L_PAREN@32..33 "(" + R_PAREN@33..34 ")" + SEMICOLON@34..35 ";" + WHITESPACE@35..40 "\n " + LET_STMT@40..51 + LET_KW@40..43 "let" + WHITESPACE@43..44 " " + BIND_PAT@44..51 + MUT_KW@44..47 "mut" + WHITESPACE@47..48 " " + ERROR@48..51 + BOX_KW@48..51 "box" + WHITESPACE@51..52 " " + EXPR_STMT@52..59 + BIN_EXPR@52..58 + PATH_EXPR@52..53 + PATH@52..53 + PATH_SEGMENT@52..53 + NAME_REF@52..53 + IDENT@52..53 "i" + WHITESPACE@53..54 " " + EQ@54..55 "=" + WHITESPACE@55..56 " " + TUPLE_EXPR@56..58 + L_PAREN@56..57 "(" + R_PAREN@57..58 ")" + SEMICOLON@58..59 ";" + WHITESPACE@59..64 "\n " + LET_STMT@64..79 + LET_KW@64..67 "let" + WHITESPACE@67..68 " " + BIND_PAT@68..79 + REF_KW@68..71 "ref" + WHITESPACE@71..72 " " + MUT_KW@72..75 "mut" + WHITESPACE@75..76 " " + ERROR@76..79 + BOX_KW@76..79 "box" + WHITESPACE@79..80 " " + EXPR_STMT@80..87 + BIN_EXPR@80..86 + PATH_EXPR@80..81 + PATH@80..81 + PATH_SEGMENT@80..81 + NAME_REF@80..81 + IDENT@80..81 "i" + WHITESPACE@81..82 " " + EQ@82..83 "=" + WHITESPACE@83..84 " " + TUPLE_EXPR@84..86 + L_PAREN@84..85 "(" + R_PAREN@85..86 ")" + SEMICOLON@86..87 ";" + WHITESPACE@87..88 "\n" + R_CURLY@88..89 "}" WHITESPACE@89..91 "\n\n" error 24..24: expected a name error 27..27: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast index 83851f5d2..9588cf3b3 100644 --- a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast @@ -44,9 +44,8 @@ SOURCE_FILE@0..48 R_PAREN@43..44 ")" WHITESPACE@44..45 " " BLOCK_EXPR@45..47 - BLOCK@45..47 - L_CURLY@45..46 "{" - R_CURLY@46..47 "}" + L_CURLY@45..46 "{" + R_CURLY@46..47 "}" WHITESPACE@47..48 "\n" error 17..17: expected one of `*`, `::`, `{`, `self`, `super` or an identifier error 17..17: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast index a328222aa..e3cda7c43 100644 --- a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast +++ b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast @@ -27,9 +27,8 @@ SOURCE_FILE@0..118 R_PAREN@27..28 ")" WHITESPACE@28..29 " " BLOCK_EXPR@29..31 - BLOCK@29..31 - L_CURLY@29..30 "{" - R_CURLY@30..31 "}" + L_CURLY@29..30 "{" + R_CURLY@30..31 "}" WHITESPACE@31..36 "\n " FN_DEF@36..51 VISIBILITY@36..39 @@ -44,9 +43,8 @@ SOURCE_FILE@0..118 R_PAREN@47..48 ")" WHITESPACE@48..49 " " BLOCK_EXPR@49..51 - BLOCK@49..51 - L_CURLY@49..50 "{" - R_CURLY@50..51 "}" + L_CURLY@49..50 "{" + R_CURLY@50..51 "}" WHITESPACE@51..56 "\n " TYPE_ALIAS_DEF@56..81 VISIBILITY@56..66 diff --git a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast index bcd1fad69..21db9ee85 100644 --- a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast +++ b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast @@ -9,22 +9,21 @@ SOURCE_FILE@0..33 R_PAREN@8..9 ")" WHITESPACE@9..10 " " BLOCK_EXPR@10..32 - BLOCK@10..32 - L_CURLY@10..11 "{" - WHITESPACE@11..16 "\n " - EXPR_STMT@16..21 - RANGE_EXPR@16..20 - LITERAL@16..17 - INT_NUMBER@16..17 "0" - DOT2EQ@17..20 "..=" - SEMICOLON@20..21 ";" - WHITESPACE@21..26 "\n " - EXPR_STMT@26..30 - RANGE_EXPR@26..29 - DOT2EQ@26..29 "..=" - SEMICOLON@29..30 ";" - WHITESPACE@30..31 "\n" - R_CURLY@31..32 "}" + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + EXPR_STMT@16..21 + RANGE_EXPR@16..20 + LITERAL@16..17 + INT_NUMBER@16..17 "0" + DOT2EQ@17..20 "..=" + SEMICOLON@20..21 ";" + WHITESPACE@21..26 "\n " + EXPR_STMT@26..30 + RANGE_EXPR@26..29 + DOT2EQ@26..29 "..=" + SEMICOLON@29..30 ";" + WHITESPACE@30..31 "\n" + R_CURLY@31..32 "}" WHITESPACE@32..33 "\n" error 16..20: An inclusive range must have an end expression error 26..29: An inclusive range must have an end expression diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast index 433ea7bad..ec950381b 100644 --- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast @@ -18,66 +18,65 @@ SOURCE_FILE@0..83 IDENT@12..15 "i32" WHITESPACE@15..16 " " BLOCK_EXPR@16..82 - BLOCK@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 "(" - LAMBDA_EXPR@52..56 - PARAM_LIST@52..56 - PIPE@52..53 "|" - PARAM@53..55 - BIND_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" - TYPE_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 "}" + 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 "(" + LAMBDA_EXPR@52..56 + PARAM_LIST@52..56 + PIPE@52..53 "|" + PARAM@53..55 + BIND_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" + TYPE_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 -- cgit v1.2.3 From 359d3be308cab2415218200f5799c5031213c250 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 May 2020 14:34:39 +0200 Subject: Fix parsing of blocks without `{` --- .../parser/err/0010_unsafe_lambda_block.rast | 2 +- .../test_data/parser/err/0163_weird_blocks.rast | 71 ++++++++++++++++++++++ .../test_data/parser/err/0163_weird_blocks.rs | 6 ++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast create mode 100644 crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rs (limited to 'crates/ra_syntax/test_data/parser/err') diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast index 06a326d26..3bf57eacc 100644 --- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast +++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast @@ -40,5 +40,5 @@ SOURCE_FILE@0..42 WHITESPACE@39..40 "\n" R_CURLY@40..41 "}" WHITESPACE@41..42 "\n" -error 24..24: expected `{` +error 24..24: expected a block error 24..24: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast b/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast new file mode 100644 index 000000000..e46456384 --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast @@ -0,0 +1,71 @@ +SOURCE_FILE@0..83 + FN_DEF@0..82 + FN_KW@0..2 "fn" + WHITESPACE@2..3 " " + NAME@3..7 + IDENT@3..7 "main" + PARAM_LIST@7..9 + L_PAREN@7..8 "(" + R_PAREN@8..9 ")" + WHITESPACE@9..10 " " + BLOCK_EXPR@10..82 + L_CURLY@10..11 "{" + WHITESPACE@11..16 "\n " + EXPR_STMT@16..29 + BLOCK_EXPR@16..29 + L_CURLY@16..17 "{" + WHITESPACE@17..18 " " + ERROR@18..24 + UNSAFE_KW@18..24 "unsafe" + WHITESPACE@24..25 " " + LITERAL@25..27 + INT_NUMBER@25..27 "92" + WHITESPACE@27..28 " " + R_CURLY@28..29 "}" + WHITESPACE@29..34 "\n " + EXPR_STMT@34..46 + BLOCK_EXPR@34..46 + L_CURLY@34..35 "{" + WHITESPACE@35..36 " " + ERROR@36..41 + ASYNC_KW@36..41 "async" + WHITESPACE@41..42 " " + LITERAL@42..44 + INT_NUMBER@42..44 "92" + WHITESPACE@44..45 " " + R_CURLY@45..46 "}" + WHITESPACE@46..51 "\n " + EXPR_STMT@51..61 + BLOCK_EXPR@51..61 + L_CURLY@51..52 "{" + WHITESPACE@52..53 " " + EXPR_STMT@53..56 + EFFECT_EXPR@53..56 + TRY_KW@53..56 "try" + WHITESPACE@56..57 " " + LITERAL@57..59 + INT_NUMBER@57..59 "92" + WHITESPACE@59..60 " " + R_CURLY@60..61 "}" + WHITESPACE@61..66 "\n " + BLOCK_EXPR@66..80 + L_CURLY@66..67 "{" + WHITESPACE@67..68 " " + EXPR_STMT@68..75 + ERROR@68..75 + LABEL@68..75 + LIFETIME@68..74 "\'label" + COLON@74..75 ":" + WHITESPACE@75..76 " " + LITERAL@76..78 + INT_NUMBER@76..78 "92" + WHITESPACE@78..79 " " + R_CURLY@79..80 "}" + WHITESPACE@80..81 "\n" + R_CURLY@81..82 "}" + WHITESPACE@82..83 "\n" +error 24..24: expected existential, fn, trait or impl +error 41..41: expected existential, fn, trait or impl +error 56..56: expected a block +error 75..75: expected a loop +error 75..75: expected SEMICOLON diff --git a/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rs b/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rs new file mode 100644 index 000000000..8fa324c1a --- /dev/null +++ b/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rs @@ -0,0 +1,6 @@ +fn main() { + { unsafe 92 } + { async 92 } + { try 92 } + { 'label: 92 } +} -- cgit v1.2.3