From 281c9eeaff8eac4e666089f80f67cf684e1d001b Mon Sep 17 00:00:00 2001 From: Andrey Tkachenko Date: Thu, 6 Jun 2019 15:36:16 +0400 Subject: [#1083] Try block syntax --- .../tests/data/parser/ok/0051_try_block.rs | 5 ++++ .../tests/data/parser/ok/0051_try_block.txt | 32 ++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs create mode 100644 crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt (limited to 'crates/ra_syntax/tests/data/parser') diff --git a/crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs b/crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs new file mode 100644 index 000000000..8cc11ddcc --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs @@ -0,0 +1,5 @@ +fn main() { + let res = try { + + }; +} diff --git a/crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt b/crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt new file mode 100644 index 000000000..f94eb3bcd --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt @@ -0,0 +1,32 @@ +SOURCE_FILE@[0; 41) + FN_DEF@[0; 41) + 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@[10; 41) + L_CURLY@[10; 11) "{" + WHITESPACE@[11; 16) "\n " + LET_STMT@[16; 39) + LET_KW@[16; 19) "let" + WHITESPACE@[19; 20) " " + BIND_PAT@[20; 23) + NAME@[20; 23) + IDENT@[20; 23) "res" + WHITESPACE@[23; 24) " " + EQ@[24; 25) "=" + WHITESPACE@[25; 26) " " + TRY_EXPR@[26; 38) + TRY_KW@[26; 29) "try" + WHITESPACE@[29; 30) " " + BLOCK@[30; 38) + L_CURLY@[30; 31) "{" + WHITESPACE@[31; 37) "\n\n " + R_CURLY@[37; 38) "}" + SEMI@[38; 39) ";" + WHITESPACE@[39; 40) "\n" + R_CURLY@[40; 41) "}" \ No newline at end of file -- cgit v1.2.3 From 505b8d873ffe422358bb4ff47dc82d6c76d0772e Mon Sep 17 00:00:00 2001 From: Andrey Tkachenko Date: Thu, 6 Jun 2019 16:26:54 +0400 Subject: [#1083] Try block syntax: fix tests --- .../data/parser/inline/ok/0130_try_block_expr.rs | 3 ++ .../data/parser/inline/ok/0130_try_block_expr.txt | 31 +++++++++++++++++++++ .../tests/data/parser/ok/0051_try_block.rs | 5 ---- .../tests/data/parser/ok/0051_try_block.txt | 32 ---------------------- 4 files changed, 34 insertions(+), 37 deletions(-) create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.rs create mode 100644 crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.txt delete mode 100644 crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs delete mode 100644 crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt (limited to 'crates/ra_syntax/tests/data/parser') diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.rs new file mode 100644 index 000000000..0f1b41eb6 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.rs @@ -0,0 +1,3 @@ +fn foo() { + let _ = try {}; +} diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.txt new file mode 100644 index 000000000..53f49b9b5 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0130_try_block_expr.txt @@ -0,0 +1,31 @@ +SOURCE_FILE@[0; 33) + FN_DEF@[0; 32) + 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) " " + BLOCK@[9; 32) + L_CURLY@[9; 10) "{" + WHITESPACE@[10; 15) "\n " + LET_STMT@[15; 30) + LET_KW@[15; 18) "let" + WHITESPACE@[18; 19) " " + PLACEHOLDER_PAT@[19; 20) + UNDERSCORE@[19; 20) "_" + WHITESPACE@[20; 21) " " + EQ@[21; 22) "=" + WHITESPACE@[22; 23) " " + TRY_EXPR@[23; 29) + TRY_KW@[23; 26) "try" + WHITESPACE@[26; 27) " " + BLOCK@[27; 29) + L_CURLY@[27; 28) "{" + R_CURLY@[28; 29) "}" + SEMI@[29; 30) ";" + WHITESPACE@[30; 31) "\n" + R_CURLY@[31; 32) "}" + WHITESPACE@[32; 33) "\n" diff --git a/crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs b/crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs deleted file mode 100644 index 8cc11ddcc..000000000 --- a/crates/ra_syntax/tests/data/parser/ok/0051_try_block.rs +++ /dev/null @@ -1,5 +0,0 @@ -fn main() { - let res = try { - - }; -} diff --git a/crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt b/crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt deleted file mode 100644 index f94eb3bcd..000000000 --- a/crates/ra_syntax/tests/data/parser/ok/0051_try_block.txt +++ /dev/null @@ -1,32 +0,0 @@ -SOURCE_FILE@[0; 41) - FN_DEF@[0; 41) - 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@[10; 41) - L_CURLY@[10; 11) "{" - WHITESPACE@[11; 16) "\n " - LET_STMT@[16; 39) - LET_KW@[16; 19) "let" - WHITESPACE@[19; 20) " " - BIND_PAT@[20; 23) - NAME@[20; 23) - IDENT@[20; 23) "res" - WHITESPACE@[23; 24) " " - EQ@[24; 25) "=" - WHITESPACE@[25; 26) " " - TRY_EXPR@[26; 38) - TRY_KW@[26; 29) "try" - WHITESPACE@[29; 30) " " - BLOCK@[30; 38) - L_CURLY@[30; 31) "{" - WHITESPACE@[31; 37) "\n\n " - R_CURLY@[37; 38) "}" - SEMI@[38; 39) ";" - WHITESPACE@[39; 40) "\n" - R_CURLY@[40; 41) "}" \ No newline at end of file -- cgit v1.2.3