full range expr

This commit is contained in:
Aleksey Kladov 2018-08-14 11:46:46 +03:00
parent 2b828c68e8
commit de02d2891e
3 changed files with 34 additions and 1 deletions

View File

@ -174,10 +174,14 @@ fn lhs(p: &mut Parser, r: Restrictions) -> Option<CompletedMarker> {
p.bump();
PREFIX_EXPR
}
// test full_range_expr
// fn foo() { xs[..]; }
DOTDOT => {
m = p.start();
p.bump();
expr_bp(p, r, 2);
if EXPR_FIRST.contains(p.current()) {
expr_bp(p, r, 2);
}
return Some(m.complete(p, RANGE_EXPR));
}
_ => {

View File

@ -0,0 +1 @@
fn foo() { xs[..]; }

View File

@ -0,0 +1,28 @@
FILE@[0; 21)
FN_DEF@[0; 20)
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; 20)
L_CURLY@[9; 10)
WHITESPACE@[10; 11)
EXPR_STMT@[11; 18)
INDEX_EXPR@[11; 17)
PATH_EXPR@[11; 13)
PATH@[11; 13)
PATH_SEGMENT@[11; 13)
NAME_REF@[11; 13)
IDENT@[11; 13) "xs"
L_BRACK@[13; 14)
RANGE_EXPR@[14; 16)
DOTDOT@[14; 16)
R_BRACK@[16; 17)
SEMI@[17; 18)
WHITESPACE@[18; 19)
R_CURLY@[19; 20)
WHITESPACE@[20; 21)