aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/libsyntax2/src/grammar/expressions/mod.rs6
-rw-r--r--crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.rs1
-rw-r--r--crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.txt28
3 files changed, 34 insertions, 1 deletions
diff --git a/crates/libsyntax2/src/grammar/expressions/mod.rs b/crates/libsyntax2/src/grammar/expressions/mod.rs
index e56f3d30e..feef5f1d6 100644
--- a/crates/libsyntax2/src/grammar/expressions/mod.rs
+++ b/crates/libsyntax2/src/grammar/expressions/mod.rs
@@ -174,10 +174,14 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<CompletedMarker> {
174 p.bump(); 174 p.bump();
175 PREFIX_EXPR 175 PREFIX_EXPR
176 } 176 }
177 // test full_range_expr
178 // fn foo() { xs[..]; }
177 DOTDOT => { 179 DOTDOT => {
178 m = p.start(); 180 m = p.start();
179 p.bump(); 181 p.bump();
180 expr_bp(p, r, 2); 182 if EXPR_FIRST.contains(p.current()) {
183 expr_bp(p, r, 2);
184 }
181 return Some(m.complete(p, RANGE_EXPR)); 185 return Some(m.complete(p, RANGE_EXPR));
182 } 186 }
183 _ => { 187 _ => {
diff --git a/crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.rs b/crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.rs
new file mode 100644
index 000000000..ae21ad94c
--- /dev/null
+++ b/crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.rs
@@ -0,0 +1 @@
fn foo() { xs[..]; }
diff --git a/crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.txt b/crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.txt
new file mode 100644
index 000000000..8e7b403c5
--- /dev/null
+++ b/crates/libsyntax2/tests/data/parser/inline/0102_full_range_expr.txt
@@ -0,0 +1,28 @@
1FILE@[0; 21)
2 FN_DEF@[0; 20)
3 FN_KW@[0; 2)
4 WHITESPACE@[2; 3)
5 NAME@[3; 6)
6 IDENT@[3; 6) "foo"
7 PARAM_LIST@[6; 8)
8 L_PAREN@[6; 7)
9 R_PAREN@[7; 8)
10 WHITESPACE@[8; 9)
11 BLOCK_EXPR@[9; 20)
12 L_CURLY@[9; 10)
13 WHITESPACE@[10; 11)
14 EXPR_STMT@[11; 18)
15 INDEX_EXPR@[11; 17)
16 PATH_EXPR@[11; 13)
17 PATH@[11; 13)
18 PATH_SEGMENT@[11; 13)
19 NAME_REF@[11; 13)
20 IDENT@[11; 13) "xs"
21 L_BRACK@[13; 14)
22 RANGE_EXPR@[14; 16)
23 DOTDOT@[14; 16)
24 R_BRACK@[16; 17)
25 SEMI@[17; 18)
26 WHITESPACE@[18; 19)
27 R_CURLY@[19; 20)
28 WHITESPACE@[20; 21)