diff options
Diffstat (limited to 'crates/ra_syntax/test_data/parser')
8 files changed, 216 insertions, 43 deletions
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rs index 293046a04..2f8188160 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rs | |||
@@ -1,4 +1,5 @@ | |||
1 | fn foo() { | 1 | fn foo() { |
2 | while true {}; | 2 | while true {}; |
3 | while let Some(x) = it.next() {}; | 3 | while let Some(x) = it.next() {}; |
4 | while { true } {}; | ||
4 | } | 5 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.txt b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.txt index 9b43d624c..a6e14a114 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 70) | 1 | SOURCE_FILE@[0; 93) |
2 | FN_DEF@[0; 69) | 2 | FN_DEF@[0; 92) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,8 +8,8 @@ SOURCE_FILE@[0; 70) | |||
8 | L_PAREN@[6; 7) "(" | 8 | L_PAREN@[6; 7) "(" |
9 | R_PAREN@[7; 8) ")" | 9 | R_PAREN@[7; 8) ")" |
10 | WHITESPACE@[8; 9) " " | 10 | WHITESPACE@[8; 9) " " |
11 | BLOCK_EXPR@[9; 69) | 11 | BLOCK_EXPR@[9; 92) |
12 | BLOCK@[9; 69) | 12 | BLOCK@[9; 92) |
13 | L_CURLY@[9; 10) "{" | 13 | L_CURLY@[9; 10) "{" |
14 | WHITESPACE@[10; 15) "\n " | 14 | WHITESPACE@[10; 15) "\n " |
15 | EXPR_STMT@[15; 29) | 15 | EXPR_STMT@[15; 29) |
@@ -64,6 +64,26 @@ SOURCE_FILE@[0; 70) | |||
64 | L_CURLY@[64; 65) "{" | 64 | L_CURLY@[64; 65) "{" |
65 | R_CURLY@[65; 66) "}" | 65 | R_CURLY@[65; 66) "}" |
66 | SEMI@[66; 67) ";" | 66 | SEMI@[66; 67) ";" |
67 | WHITESPACE@[67; 68) "\n" | 67 | WHITESPACE@[67; 72) "\n " |
68 | R_CURLY@[68; 69) "}" | 68 | EXPR_STMT@[72; 90) |
69 | WHITESPACE@[69; 70) "\n" | 69 | WHILE_EXPR@[72; 89) |
70 | WHILE_KW@[72; 77) "while" | ||
71 | WHITESPACE@[77; 78) " " | ||
72 | CONDITION@[78; 86) | ||
73 | BLOCK_EXPR@[78; 86) | ||
74 | BLOCK@[78; 86) | ||
75 | L_CURLY@[78; 79) "{" | ||
76 | WHITESPACE@[79; 80) " " | ||
77 | LITERAL@[80; 84) | ||
78 | TRUE_KW@[80; 84) "true" | ||
79 | WHITESPACE@[84; 85) " " | ||
80 | R_CURLY@[85; 86) "}" | ||
81 | WHITESPACE@[86; 87) " " | ||
82 | BLOCK_EXPR@[87; 89) | ||
83 | BLOCK@[87; 89) | ||
84 | L_CURLY@[87; 88) "{" | ||
85 | R_CURLY@[88; 89) "}" | ||
86 | SEMI@[89; 90) ";" | ||
87 | WHITESPACE@[90; 91) "\n" | ||
88 | R_CURLY@[91; 92) "}" | ||
89 | WHITESPACE@[92; 93) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rs index 4b0d9af89..40f227ba3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rs | |||
@@ -3,4 +3,5 @@ fn foo() { | |||
3 | if true {} else {}; | 3 | if true {} else {}; |
4 | if true {} else if false {} else {}; | 4 | if true {} else if false {} else {}; |
5 | if S {}; | 5 | if S {}; |
6 | if { true } { } else { }; | ||
6 | } | 7 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.txt b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.txt index 14ea91fd2..2ace3c8ee 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 107) | 1 | SOURCE_FILE@[0; 137) |
2 | FN_DEF@[0; 106) | 2 | FN_DEF@[0; 136) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,8 +8,8 @@ SOURCE_FILE@[0; 107) | |||
8 | L_PAREN@[6; 7) "(" | 8 | L_PAREN@[6; 7) "(" |
9 | R_PAREN@[7; 8) ")" | 9 | R_PAREN@[7; 8) ")" |
10 | WHITESPACE@[8; 9) " " | 10 | WHITESPACE@[8; 9) " " |
11 | BLOCK_EXPR@[9; 106) | 11 | BLOCK_EXPR@[9; 136) |
12 | BLOCK@[9; 106) | 12 | BLOCK@[9; 136) |
13 | L_CURLY@[9; 10) "{" | 13 | L_CURLY@[9; 10) "{" |
14 | WHITESPACE@[10; 15) "\n " | 14 | WHITESPACE@[10; 15) "\n " |
15 | EXPR_STMT@[15; 26) | 15 | EXPR_STMT@[15; 26) |
@@ -98,6 +98,35 @@ SOURCE_FILE@[0; 107) | |||
98 | L_CURLY@[101; 102) "{" | 98 | L_CURLY@[101; 102) "{" |
99 | R_CURLY@[102; 103) "}" | 99 | R_CURLY@[102; 103) "}" |
100 | SEMI@[103; 104) ";" | 100 | SEMI@[103; 104) ";" |
101 | WHITESPACE@[104; 105) "\n" | 101 | WHITESPACE@[104; 109) "\n " |
102 | R_CURLY@[105; 106) "}" | 102 | EXPR_STMT@[109; 134) |
103 | WHITESPACE@[106; 107) "\n" | 103 | IF_EXPR@[109; 133) |
104 | IF_KW@[109; 111) "if" | ||
105 | WHITESPACE@[111; 112) " " | ||
106 | CONDITION@[112; 120) | ||
107 | BLOCK_EXPR@[112; 120) | ||
108 | BLOCK@[112; 120) | ||
109 | L_CURLY@[112; 113) "{" | ||
110 | WHITESPACE@[113; 114) " " | ||
111 | LITERAL@[114; 118) | ||
112 | TRUE_KW@[114; 118) "true" | ||
113 | WHITESPACE@[118; 119) " " | ||
114 | R_CURLY@[119; 120) "}" | ||
115 | WHITESPACE@[120; 121) " " | ||
116 | BLOCK_EXPR@[121; 124) | ||
117 | BLOCK@[121; 124) | ||
118 | L_CURLY@[121; 122) "{" | ||
119 | WHITESPACE@[122; 123) " " | ||
120 | R_CURLY@[123; 124) "}" | ||
121 | WHITESPACE@[124; 125) " " | ||
122 | ELSE_KW@[125; 129) "else" | ||
123 | WHITESPACE@[129; 130) " " | ||
124 | BLOCK_EXPR@[130; 133) | ||
125 | BLOCK@[130; 133) | ||
126 | L_CURLY@[130; 131) "{" | ||
127 | WHITESPACE@[131; 132) " " | ||
128 | R_CURLY@[132; 133) "}" | ||
129 | SEMI@[133; 134) ";" | ||
130 | WHITESPACE@[134; 135) "\n" | ||
131 | R_CURLY@[135; 136) "}" | ||
132 | WHITESPACE@[136; 137) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rs b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rs index c9205dfa3..c4021dc10 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rs | |||
@@ -1,4 +1,6 @@ | |||
1 | fn foo() { | 1 | fn foo() { |
2 | match () { }; | 2 | match () { }; |
3 | match S {}; | 3 | match S {}; |
4 | match { } { _ => () }; | ||
5 | match { S {} } {}; | ||
4 | } | 6 | } |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.txt b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.txt index f62b6c6d5..0af668056 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 47) | 1 | SOURCE_FILE@[0; 97) |
2 | FN_DEF@[0; 46) | 2 | FN_DEF@[0; 96) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,8 +8,8 @@ SOURCE_FILE@[0; 47) | |||
8 | L_PAREN@[6; 7) "(" | 8 | L_PAREN@[6; 7) "(" |
9 | R_PAREN@[7; 8) ")" | 9 | R_PAREN@[7; 8) ")" |
10 | WHITESPACE@[8; 9) " " | 10 | WHITESPACE@[8; 9) " " |
11 | BLOCK_EXPR@[9; 46) | 11 | BLOCK_EXPR@[9; 96) |
12 | BLOCK@[9; 46) | 12 | BLOCK@[9; 96) |
13 | L_CURLY@[9; 10) "{" | 13 | L_CURLY@[9; 10) "{" |
14 | WHITESPACE@[10; 15) "\n " | 14 | WHITESPACE@[10; 15) "\n " |
15 | EXPR_STMT@[15; 28) | 15 | EXPR_STMT@[15; 28) |
@@ -40,6 +40,57 @@ SOURCE_FILE@[0; 47) | |||
40 | L_CURLY@[41; 42) "{" | 40 | L_CURLY@[41; 42) "{" |
41 | R_CURLY@[42; 43) "}" | 41 | R_CURLY@[42; 43) "}" |
42 | SEMI@[43; 44) ";" | 42 | SEMI@[43; 44) ";" |
43 | WHITESPACE@[44; 45) "\n" | 43 | WHITESPACE@[44; 49) "\n " |
44 | R_CURLY@[45; 46) "}" | 44 | EXPR_STMT@[49; 71) |
45 | WHITESPACE@[46; 47) "\n" | 45 | MATCH_EXPR@[49; 70) |
46 | MATCH_KW@[49; 54) "match" | ||
47 | WHITESPACE@[54; 55) " " | ||
48 | BLOCK_EXPR@[55; 58) | ||
49 | BLOCK@[55; 58) | ||
50 | L_CURLY@[55; 56) "{" | ||
51 | WHITESPACE@[56; 57) " " | ||
52 | R_CURLY@[57; 58) "}" | ||
53 | WHITESPACE@[58; 59) " " | ||
54 | MATCH_ARM_LIST@[59; 70) | ||
55 | L_CURLY@[59; 60) "{" | ||
56 | WHITESPACE@[60; 61) " " | ||
57 | MATCH_ARM@[61; 68) | ||
58 | PLACEHOLDER_PAT@[61; 62) | ||
59 | UNDERSCORE@[61; 62) "_" | ||
60 | WHITESPACE@[62; 63) " " | ||
61 | FAT_ARROW@[63; 65) "=>" | ||
62 | WHITESPACE@[65; 66) " " | ||
63 | TUPLE_EXPR@[66; 68) | ||
64 | L_PAREN@[66; 67) "(" | ||
65 | R_PAREN@[67; 68) ")" | ||
66 | WHITESPACE@[68; 69) " " | ||
67 | R_CURLY@[69; 70) "}" | ||
68 | SEMI@[70; 71) ";" | ||
69 | WHITESPACE@[71; 76) "\n " | ||
70 | EXPR_STMT@[76; 94) | ||
71 | MATCH_EXPR@[76; 93) | ||
72 | MATCH_KW@[76; 81) "match" | ||
73 | WHITESPACE@[81; 82) " " | ||
74 | BLOCK_EXPR@[82; 90) | ||
75 | BLOCK@[82; 90) | ||
76 | L_CURLY@[82; 83) "{" | ||
77 | WHITESPACE@[83; 84) " " | ||
78 | RECORD_LIT@[84; 88) | ||
79 | PATH@[84; 85) | ||
80 | PATH_SEGMENT@[84; 85) | ||
81 | NAME_REF@[84; 85) | ||
82 | IDENT@[84; 85) "S" | ||
83 | WHITESPACE@[85; 86) " " | ||
84 | RECORD_FIELD_LIST@[86; 88) | ||
85 | L_CURLY@[86; 87) "{" | ||
86 | R_CURLY@[87; 88) "}" | ||
87 | WHITESPACE@[88; 89) " " | ||
88 | R_CURLY@[89; 90) "}" | ||
89 | WHITESPACE@[90; 91) " " | ||
90 | MATCH_ARM_LIST@[91; 93) | ||
91 | L_CURLY@[91; 92) "{" | ||
92 | R_CURLY@[92; 93) "}" | ||
93 | SEMI@[93; 94) ";" | ||
94 | WHITESPACE@[94; 95) "\n" | ||
95 | R_CURLY@[95; 96) "}" | ||
96 | WHITESPACE@[96; 97) "\n" | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rs b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rs index c39fe8e68..e7b7cfc6b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rs +++ b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rs | |||
@@ -1 +1,5 @@ | |||
1 | fn foo() { let x = 1..; } | 1 | fn foo() { |
2 | let x = 1..; | ||
3 | match 1.. { _ => () }; | ||
4 | match a.b()..S { _ => () }; | ||
5 | } | ||
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.txt b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.txt index f3c292f5e..9f8a6b0f6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.txt +++ b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 26) | 1 | SOURCE_FILE@[0; 89) |
2 | FN_DEF@[0; 25) | 2 | FN_DEF@[0; 88) |
3 | FN_KW@[0; 2) "fn" | 3 | FN_KW@[0; 2) "fn" |
4 | WHITESPACE@[2; 3) " " | 4 | WHITESPACE@[2; 3) " " |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,24 +8,89 @@ SOURCE_FILE@[0; 26) | |||
8 | L_PAREN@[6; 7) "(" | 8 | L_PAREN@[6; 7) "(" |
9 | R_PAREN@[7; 8) ")" | 9 | R_PAREN@[7; 8) ")" |
10 | WHITESPACE@[8; 9) " " | 10 | WHITESPACE@[8; 9) " " |
11 | BLOCK_EXPR@[9; 25) | 11 | BLOCK_EXPR@[9; 88) |
12 | BLOCK@[9; 25) | 12 | BLOCK@[9; 88) |
13 | L_CURLY@[9; 10) "{" | 13 | L_CURLY@[9; 10) "{" |
14 | WHITESPACE@[10; 11) " " | 14 | WHITESPACE@[10; 15) "\n " |
15 | LET_STMT@[11; 23) | 15 | LET_STMT@[15; 27) |
16 | LET_KW@[11; 14) "let" | 16 | LET_KW@[15; 18) "let" |
17 | WHITESPACE@[14; 15) " " | ||
18 | BIND_PAT@[15; 16) | ||
19 | NAME@[15; 16) | ||
20 | IDENT@[15; 16) "x" | ||
21 | WHITESPACE@[16; 17) " " | ||
22 | EQ@[17; 18) "=" | ||
23 | WHITESPACE@[18; 19) " " | 17 | WHITESPACE@[18; 19) " " |
24 | RANGE_EXPR@[19; 22) | 18 | BIND_PAT@[19; 20) |
25 | LITERAL@[19; 20) | 19 | NAME@[19; 20) |
26 | INT_NUMBER@[19; 20) "1" | 20 | IDENT@[19; 20) "x" |
27 | DOTDOT@[20; 22) ".." | 21 | WHITESPACE@[20; 21) " " |
28 | SEMI@[22; 23) ";" | 22 | EQ@[21; 22) "=" |
29 | WHITESPACE@[23; 24) " " | 23 | WHITESPACE@[22; 23) " " |
30 | R_CURLY@[24; 25) "}" | 24 | RANGE_EXPR@[23; 26) |
31 | WHITESPACE@[25; 26) "\n" | 25 | LITERAL@[23; 24) |
26 | INT_NUMBER@[23; 24) "1" | ||
27 | DOTDOT@[24; 26) ".." | ||
28 | SEMI@[26; 27) ";" | ||
29 | WHITESPACE@[27; 32) "\n " | ||
30 | EXPR_STMT@[32; 54) | ||
31 | MATCH_EXPR@[32; 53) | ||
32 | MATCH_KW@[32; 37) "match" | ||
33 | WHITESPACE@[37; 38) " " | ||
34 | RANGE_EXPR@[38; 41) | ||
35 | LITERAL@[38; 39) | ||
36 | INT_NUMBER@[38; 39) "1" | ||
37 | DOTDOT@[39; 41) ".." | ||
38 | WHITESPACE@[41; 42) " " | ||
39 | MATCH_ARM_LIST@[42; 53) | ||
40 | L_CURLY@[42; 43) "{" | ||
41 | WHITESPACE@[43; 44) " " | ||
42 | MATCH_ARM@[44; 51) | ||
43 | PLACEHOLDER_PAT@[44; 45) | ||
44 | UNDERSCORE@[44; 45) "_" | ||
45 | WHITESPACE@[45; 46) " " | ||
46 | FAT_ARROW@[46; 48) "=>" | ||
47 | WHITESPACE@[48; 49) " " | ||
48 | TUPLE_EXPR@[49; 51) | ||
49 | L_PAREN@[49; 50) "(" | ||
50 | R_PAREN@[50; 51) ")" | ||
51 | WHITESPACE@[51; 52) " " | ||
52 | R_CURLY@[52; 53) "}" | ||
53 | SEMI@[53; 54) ";" | ||
54 | WHITESPACE@[54; 59) "\n " | ||
55 | EXPR_STMT@[59; 86) | ||
56 | MATCH_EXPR@[59; 85) | ||
57 | MATCH_KW@[59; 64) "match" | ||
58 | WHITESPACE@[64; 65) " " | ||
59 | RANGE_EXPR@[65; 73) | ||
60 | METHOD_CALL_EXPR@[65; 70) | ||
61 | PATH_EXPR@[65; 66) | ||
62 | PATH@[65; 66) | ||
63 | PATH_SEGMENT@[65; 66) | ||
64 | NAME_REF@[65; 66) | ||
65 | IDENT@[65; 66) "a" | ||
66 | DOT@[66; 67) "." | ||
67 | NAME_REF@[67; 68) | ||
68 | IDENT@[67; 68) "b" | ||
69 | ARG_LIST@[68; 70) | ||
70 | L_PAREN@[68; 69) "(" | ||
71 | R_PAREN@[69; 70) ")" | ||
72 | DOTDOT@[70; 72) ".." | ||
73 | PATH_EXPR@[72; 73) | ||
74 | PATH@[72; 73) | ||
75 | PATH_SEGMENT@[72; 73) | ||
76 | NAME_REF@[72; 73) | ||
77 | IDENT@[72; 73) "S" | ||
78 | WHITESPACE@[73; 74) " " | ||
79 | MATCH_ARM_LIST@[74; 85) | ||
80 | L_CURLY@[74; 75) "{" | ||
81 | WHITESPACE@[75; 76) " " | ||
82 | MATCH_ARM@[76; 83) | ||
83 | PLACEHOLDER_PAT@[76; 77) | ||
84 | UNDERSCORE@[76; 77) "_" | ||
85 | WHITESPACE@[77; 78) " " | ||
86 | FAT_ARROW@[78; 80) "=>" | ||
87 | WHITESPACE@[80; 81) " " | ||
88 | TUPLE_EXPR@[81; 83) | ||
89 | L_PAREN@[81; 82) "(" | ||
90 | R_PAREN@[82; 83) ")" | ||
91 | WHITESPACE@[83; 84) " " | ||
92 | R_CURLY@[84; 85) "}" | ||
93 | SEMI@[85; 86) ";" | ||
94 | WHITESPACE@[86; 87) "\n" | ||
95 | R_CURLY@[87; 88) "}" | ||
96 | WHITESPACE@[88; 89) "\n" | ||