From 719710a13256a32b9fcbf06c1ff43f8961b9b2e6 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 24 Aug 2018 11:21:13 +0300 Subject: break&continue --- .../tests/data/parser/err/0012_broken_lambda.rs | 12 ----- .../tests/data/parser/inline/0105_continue_expr.rs | 6 +++ .../data/parser/inline/0105_continue_expr.txt | 35 ++++++++++++++ .../tests/data/parser/inline/0106_break_expr.rs | 8 ++++ .../tests/data/parser/inline/0106_break_expr.txt | 53 ++++++++++++++++++++++ 5 files changed, 102 insertions(+), 12 deletions(-) delete mode 100644 crates/libsyntax2/tests/data/parser/err/0012_broken_lambda.rs create mode 100644 crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.rs create mode 100644 crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.txt create mode 100644 crates/libsyntax2/tests/data/parser/inline/0106_break_expr.rs create mode 100644 crates/libsyntax2/tests/data/parser/inline/0106_break_expr.txt (limited to 'crates/libsyntax2/tests/data') diff --git a/crates/libsyntax2/tests/data/parser/err/0012_broken_lambda.rs b/crates/libsyntax2/tests/data/parser/err/0012_broken_lambda.rs deleted file mode 100644 index ad0d8eb4c..000000000 --- a/crates/libsyntax2/tests/data/parser/err/0012_broken_lambda.rs +++ /dev/null @@ -1,12 +0,0 @@ -pub(super) fn process<'a, S: Sink<'a>>(builder: &mut S, tokens: &[Token], events: Vec) { - let mut next_tok_idx = 0; - let eat_ws = |idx: &mut usize, &mut | { - while let Some(token) = tokens.get(*idx) { - if !token.kind.is_trivia() { - break; - } - builder.leaf(token.kind, token.len); - *idx += 1 - } - }; -} diff --git a/crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.rs b/crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.rs new file mode 100644 index 000000000..474cc3f0e --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.rs @@ -0,0 +1,6 @@ +fn foo() { + loop { + continue; + continue 'l; + } +} diff --git a/crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.txt b/crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.txt new file mode 100644 index 000000000..05526fda6 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/inline/0105_continue_expr.txt @@ -0,0 +1,35 @@ +FILE@[0; 69) + FN_DEF@[0; 68) + FN_KW@[0; 2) + 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_EXPR@[9; 68) + L_CURLY@[9; 10) + WHITESPACE@[10; 15) + LOOP_EXPR@[15; 66) + LOOP_KW@[15; 19) + WHITESPACE@[19; 20) + BLOCK_EXPR@[20; 66) + L_CURLY@[20; 21) + WHITESPACE@[21; 30) + EXPR_STMT@[30; 39) + CONTINUE_EXPR@[30; 38) + CONTINUE_KW@[30; 38) + SEMI@[38; 39) + WHITESPACE@[39; 48) + EXPR_STMT@[48; 60) + CONTINUE_EXPR@[48; 59) + CONTINUE_KW@[48; 56) + WHITESPACE@[56; 57) + LIFETIME@[57; 59) "'l" + SEMI@[59; 60) + WHITESPACE@[60; 65) + R_CURLY@[65; 66) + WHITESPACE@[66; 67) + R_CURLY@[67; 68) + WHITESPACE@[68; 69) diff --git a/crates/libsyntax2/tests/data/parser/inline/0106_break_expr.rs b/crates/libsyntax2/tests/data/parser/inline/0106_break_expr.rs new file mode 100644 index 000000000..1b4094636 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/inline/0106_break_expr.rs @@ -0,0 +1,8 @@ +fn foo() { + loop { + break; + break 'l; + break 92; + break 'l 92; + } +} diff --git a/crates/libsyntax2/tests/data/parser/inline/0106_break_expr.txt b/crates/libsyntax2/tests/data/parser/inline/0106_break_expr.txt new file mode 100644 index 000000000..bb490e441 --- /dev/null +++ b/crates/libsyntax2/tests/data/parser/inline/0106_break_expr.txt @@ -0,0 +1,53 @@ +FILE@[0; 102) + FN_DEF@[0; 101) + FN_KW@[0; 2) + 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_EXPR@[9; 101) + L_CURLY@[9; 10) + WHITESPACE@[10; 15) + LOOP_EXPR@[15; 99) + LOOP_KW@[15; 19) + WHITESPACE@[19; 20) + BLOCK_EXPR@[20; 99) + L_CURLY@[20; 21) + WHITESPACE@[21; 30) + EXPR_STMT@[30; 36) + BREAK_EXPR@[30; 35) + BREAK_KW@[30; 35) + SEMI@[35; 36) + WHITESPACE@[36; 45) + EXPR_STMT@[45; 54) + BREAK_EXPR@[45; 53) + BREAK_KW@[45; 50) + WHITESPACE@[50; 51) + LIFETIME@[51; 53) "'l" + SEMI@[53; 54) + WHITESPACE@[54; 63) + EXPR_STMT@[63; 72) + BREAK_EXPR@[63; 71) + BREAK_KW@[63; 68) + WHITESPACE@[68; 69) + LITERAL@[69; 71) + INT_NUMBER@[69; 71) "92" + SEMI@[71; 72) + WHITESPACE@[72; 81) + EXPR_STMT@[81; 93) + BREAK_EXPR@[81; 92) + BREAK_KW@[81; 86) + WHITESPACE@[86; 87) + LIFETIME@[87; 89) "'l" + WHITESPACE@[89; 90) + LITERAL@[90; 92) + INT_NUMBER@[90; 92) "92" + SEMI@[92; 93) + WHITESPACE@[93; 98) + R_CURLY@[98; 99) + WHITESPACE@[99; 100) + R_CURLY@[100; 101) + WHITESPACE@[101; 102) -- cgit v1.2.3