diff options
author | DJMcNab <[email protected]> | 2018-12-17 22:34:18 +0000 |
---|---|---|
committer | DJMcNab <[email protected]> | 2018-12-19 20:12:18 +0000 |
commit | 20bbe0127cc6bfac3ced0c7ed1de4f0526f3bbed (patch) | |
tree | 7be28cc0c1f3848a024474fb52cc5663725c2700 /crates/ra_syntax/tests/data/parser/ok | |
parent | 0bd9d87e87c6435d439de3f682b83bc74d784de3 (diff) |
Fix parsing of inclusive ranges (#214)
I'm not certain that this is correct, so extra eyes would be good
Diffstat (limited to 'crates/ra_syntax/tests/data/parser/ok')
-rw-r--r-- | crates/ra_syntax/tests/data/parser/ok/0029_range_forms.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/tests/data/parser/ok/0029_range_forms.txt | 86 |
2 files changed, 85 insertions, 6 deletions
diff --git a/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.rs b/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.rs index 03f4ae7b2..f9ff444d4 100644 --- a/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.rs +++ b/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.rs | |||
@@ -3,4 +3,9 @@ fn foo() { | |||
3 | ..z = 2; | 3 | ..z = 2; |
4 | x = false..1 == 1; | 4 | x = false..1 == 1; |
5 | let x = 1..; | 5 | let x = 1..; |
6 | |||
7 | ..=1 + 1; | ||
8 | ..=z = 2; | ||
9 | x = false..=1 == 1; | ||
10 | let x = 1..; | ||
6 | } | 11 | } |
diff --git a/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.txt b/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.txt index 2e7703c21..e3706bfbd 100644 --- a/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.txt +++ b/crates/ra_syntax/tests/data/parser/ok/0029_range_forms.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | SOURCE_FILE@[0; 79) | 1 | SOURCE_FILE@[0; 153) |
2 | FN_DEF@[0; 78) | 2 | FN_DEF@[0; 152) |
3 | FN_KW@[0; 2) | 3 | FN_KW@[0; 2) |
4 | WHITESPACE@[2; 3) | 4 | WHITESPACE@[2; 3) |
5 | NAME@[3; 6) | 5 | NAME@[3; 6) |
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 79) | |||
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@[9; 78) | 11 | BLOCK@[9; 152) |
12 | L_CURLY@[9; 10) | 12 | L_CURLY@[9; 10) |
13 | WHITESPACE@[10; 15) | 13 | WHITESPACE@[10; 15) |
14 | EXPR_STMT@[15; 23) | 14 | EXPR_STMT@[15; 23) |
@@ -78,6 +78,80 @@ SOURCE_FILE@[0; 79) | |||
78 | INT_NUMBER@[72; 73) "1" | 78 | INT_NUMBER@[72; 73) "1" |
79 | DOTDOT@[73; 75) | 79 | DOTDOT@[73; 75) |
80 | SEMI@[75; 76) | 80 | SEMI@[75; 76) |
81 | WHITESPACE@[76; 77) | 81 | WHITESPACE@[76; 86) |
82 | R_CURLY@[77; 78) | 82 | err: `expected expression` |
83 | WHITESPACE@[78; 79) | 83 | EXPR_STMT@[86; 89) |
84 | ERROR@[86; 89) | ||
85 | DOTDOTEQ@[86; 89) | ||
86 | err: `expected SEMI` | ||
87 | EXPR_STMT@[89; 95) | ||
88 | BIN_EXPR@[89; 94) | ||
89 | LITERAL@[89; 90) | ||
90 | INT_NUMBER@[89; 90) "1" | ||
91 | WHITESPACE@[90; 91) | ||
92 | PLUS@[91; 92) | ||
93 | WHITESPACE@[92; 93) | ||
94 | LITERAL@[93; 94) | ||
95 | INT_NUMBER@[93; 94) "1" | ||
96 | SEMI@[94; 95) | ||
97 | WHITESPACE@[95; 100) | ||
98 | err: `expected expression` | ||
99 | EXPR_STMT@[100; 103) | ||
100 | ERROR@[100; 103) | ||
101 | DOTDOTEQ@[100; 103) | ||
102 | err: `expected SEMI` | ||
103 | EXPR_STMT@[103; 109) | ||
104 | BIN_EXPR@[103; 108) | ||
105 | PATH_EXPR@[103; 104) | ||
106 | PATH@[103; 104) | ||
107 | PATH_SEGMENT@[103; 104) | ||
108 | NAME_REF@[103; 104) | ||
109 | IDENT@[103; 104) "z" | ||
110 | WHITESPACE@[104; 105) | ||
111 | EQ@[105; 106) | ||
112 | WHITESPACE@[106; 107) | ||
113 | LITERAL@[107; 108) | ||
114 | INT_NUMBER@[107; 108) "2" | ||
115 | SEMI@[108; 109) | ||
116 | WHITESPACE@[109; 114) | ||
117 | EXPR_STMT@[114; 133) | ||
118 | BIN_EXPR@[114; 132) | ||
119 | PATH_EXPR@[114; 115) | ||
120 | PATH@[114; 115) | ||
121 | PATH_SEGMENT@[114; 115) | ||
122 | NAME_REF@[114; 115) | ||
123 | IDENT@[114; 115) "x" | ||
124 | WHITESPACE@[115; 116) | ||
125 | EQ@[116; 117) | ||
126 | WHITESPACE@[117; 118) | ||
127 | RANGE_EXPR@[118; 132) | ||
128 | LITERAL@[118; 123) | ||
129 | FALSE_KW@[118; 123) | ||
130 | DOTDOTEQ@[123; 126) | ||
131 | BIN_EXPR@[126; 132) | ||
132 | LITERAL@[126; 127) | ||
133 | INT_NUMBER@[126; 127) "1" | ||
134 | WHITESPACE@[127; 128) | ||
135 | EQEQ@[128; 130) | ||
136 | WHITESPACE@[130; 131) | ||
137 | LITERAL@[131; 132) | ||
138 | INT_NUMBER@[131; 132) "1" | ||
139 | SEMI@[132; 133) | ||
140 | WHITESPACE@[133; 138) | ||
141 | LET_STMT@[138; 150) | ||
142 | LET_KW@[138; 141) | ||
143 | WHITESPACE@[141; 142) | ||
144 | BIND_PAT@[142; 143) | ||
145 | NAME@[142; 143) | ||
146 | IDENT@[142; 143) "x" | ||
147 | WHITESPACE@[143; 144) | ||
148 | EQ@[144; 145) | ||
149 | WHITESPACE@[145; 146) | ||
150 | RANGE_EXPR@[146; 149) | ||
151 | LITERAL@[146; 147) | ||
152 | INT_NUMBER@[146; 147) "1" | ||
153 | DOTDOT@[147; 149) | ||
154 | SEMI@[149; 150) | ||
155 | WHITESPACE@[150; 151) | ||
156 | R_CURLY@[151; 152) | ||
157 | WHITESPACE@[152; 153) | ||