From 367487fe88dca78cffad5138673d5259f7f7ba6b Mon Sep 17 00:00:00 2001 From: robojumper Date: Thu, 28 May 2020 21:42:22 +0200 Subject: Support raw_ref_op's raw reference operator --- .../test_data/parser/inline/ok/0082_ref_expr.rast | 172 +++++++++++++++------ .../test_data/parser/inline/ok/0082_ref_expr.rs | 6 + 2 files changed, 134 insertions(+), 44 deletions(-) (limited to 'crates/ra_syntax/test_data/parser/inline') diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast index 7fe96e17d..58bdf7e34 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast @@ -1,5 +1,5 @@ -SOURCE_FILE@0..52 - FN_DEF@0..51 +SOURCE_FILE@0..200 + FN_DEF@0..199 FN_KW@0..2 "fn" WHITESPACE@2..3 " " NAME@3..6 @@ -8,47 +8,131 @@ SOURCE_FILE@0..52 L_PAREN@6..7 "(" R_PAREN@7..8 ")" WHITESPACE@8..9 " " - BLOCK_EXPR@9..51 + BLOCK_EXPR@9..199 L_CURLY@9..10 "{" WHITESPACE@10..15 "\n " - LET_STMT@15..26 - LET_KW@15..18 "let" - WHITESPACE@18..19 " " - PLACEHOLDER_PAT@19..20 - UNDERSCORE@19..20 "_" - WHITESPACE@20..21 " " - EQ@21..22 "=" - WHITESPACE@22..23 " " - REF_EXPR@23..25 - AMP@23..24 "&" - LITERAL@24..25 - INT_NUMBER@24..25 "1" - SEMICOLON@25..26 ";" - WHITESPACE@26..31 "\n " - LET_STMT@31..49 - LET_KW@31..34 "let" - WHITESPACE@34..35 " " - PLACEHOLDER_PAT@35..36 - UNDERSCORE@35..36 "_" - WHITESPACE@36..37 " " - EQ@37..38 "=" - WHITESPACE@38..39 " " - REF_EXPR@39..48 - AMP@39..40 "&" - MUT_KW@40..43 "mut" - WHITESPACE@43..44 " " - REF_EXPR@44..48 - AMP@44..45 "&" - CALL_EXPR@45..48 - PATH_EXPR@45..46 - PATH@45..46 - PATH_SEGMENT@45..46 - NAME_REF@45..46 - IDENT@45..46 "f" - ARG_LIST@46..48 - L_PAREN@46..47 "(" - R_PAREN@47..48 ")" - SEMICOLON@48..49 ";" - WHITESPACE@49..50 "\n" - R_CURLY@50..51 "}" - WHITESPACE@51..52 "\n" + COMMENT@15..36 "// reference operator" + WHITESPACE@36..41 "\n " + LET_STMT@41..52 + LET_KW@41..44 "let" + WHITESPACE@44..45 " " + PLACEHOLDER_PAT@45..46 + UNDERSCORE@45..46 "_" + WHITESPACE@46..47 " " + EQ@47..48 "=" + WHITESPACE@48..49 " " + REF_EXPR@49..51 + AMP@49..50 "&" + LITERAL@50..51 + INT_NUMBER@50..51 "1" + SEMICOLON@51..52 ";" + WHITESPACE@52..57 "\n " + LET_STMT@57..75 + LET_KW@57..60 "let" + WHITESPACE@60..61 " " + PLACEHOLDER_PAT@61..62 + UNDERSCORE@61..62 "_" + WHITESPACE@62..63 " " + EQ@63..64 "=" + WHITESPACE@64..65 " " + REF_EXPR@65..74 + AMP@65..66 "&" + MUT_KW@66..69 "mut" + WHITESPACE@69..70 " " + REF_EXPR@70..74 + AMP@70..71 "&" + CALL_EXPR@71..74 + PATH_EXPR@71..72 + PATH@71..72 + PATH_SEGMENT@71..72 + NAME_REF@71..72 + IDENT@71..72 "f" + ARG_LIST@72..74 + L_PAREN@72..73 "(" + R_PAREN@73..74 ")" + SEMICOLON@74..75 ";" + WHITESPACE@75..80 "\n " + LET_STMT@80..93 + LET_KW@80..83 "let" + WHITESPACE@83..84 " " + PLACEHOLDER_PAT@84..85 + UNDERSCORE@84..85 "_" + WHITESPACE@85..86 " " + EQ@86..87 "=" + WHITESPACE@87..88 " " + REF_EXPR@88..92 + AMP@88..89 "&" + PATH_EXPR@89..92 + PATH@89..92 + PATH_SEGMENT@89..92 + NAME_REF@89..92 + IDENT@89..92 "raw" + SEMICOLON@92..93 ";" + WHITESPACE@93..98 "\n " + LET_STMT@98..113 + LET_KW@98..101 "let" + WHITESPACE@101..102 " " + PLACEHOLDER_PAT@102..103 + UNDERSCORE@102..103 "_" + WHITESPACE@103..104 " " + EQ@104..105 "=" + WHITESPACE@105..106 " " + REF_EXPR@106..112 + AMP@106..107 "&" + FIELD_EXPR@107..112 + PATH_EXPR@107..110 + PATH@107..110 + PATH_SEGMENT@107..110 + NAME_REF@107..110 + IDENT@107..110 "raw" + DOT@110..111 "." + NAME_REF@111..112 + INT_NUMBER@111..112 "0" + SEMICOLON@112..113 ";" + WHITESPACE@113..118 "\n " + COMMENT@118..143 "// raw reference oper ..." + WHITESPACE@143..148 "\n " + LET_STMT@148..169 + LET_KW@148..151 "let" + WHITESPACE@151..152 " " + PLACEHOLDER_PAT@152..153 + UNDERSCORE@152..153 "_" + WHITESPACE@153..154 " " + EQ@154..155 "=" + WHITESPACE@155..156 " " + REF_EXPR@156..168 + AMP@156..157 "&" + RAW_KW@157..160 "raw" + WHITESPACE@160..161 " " + MUT_KW@161..164 "mut" + WHITESPACE@164..165 " " + PATH_EXPR@165..168 + PATH@165..168 + PATH_SEGMENT@165..168 + NAME_REF@165..168 + IDENT@165..168 "foo" + SEMICOLON@168..169 ";" + WHITESPACE@169..174 "\n " + LET_STMT@174..197 + LET_KW@174..177 "let" + WHITESPACE@177..178 " " + PLACEHOLDER_PAT@178..179 + UNDERSCORE@178..179 "_" + WHITESPACE@179..180 " " + EQ@180..181 "=" + WHITESPACE@181..182 " " + REF_EXPR@182..196 + AMP@182..183 "&" + RAW_KW@183..186 "raw" + WHITESPACE@186..187 " " + CONST_KW@187..192 "const" + WHITESPACE@192..193 " " + PATH_EXPR@193..196 + PATH@193..196 + PATH_SEGMENT@193..196 + NAME_REF@193..196 + IDENT@193..196 "foo" + SEMICOLON@196..197 ";" + WHITESPACE@197..198 "\n" + R_CURLY@198..199 "}" + WHITESPACE@199..200 "\n" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs index 2dac6be95..c5262f446 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rs @@ -1,4 +1,10 @@ fn foo() { + // reference operator let _ = &1; let _ = &mut &f(); + let _ = &raw; + let _ = &raw.0; + // raw reference operator + let _ = &raw mut foo; + let _ = &raw const foo; } -- cgit v1.2.3