Split the test

This commit is contained in:
Jade 2021-08-04 03:01:27 -07:00
parent b90ed92a5c
commit 775670e32c
3 changed files with 42 additions and 2 deletions

View File

@ -69,12 +69,20 @@ fn pattern_single_r(p: &mut Parser, recovery_set: TokenSet) {
// 302 .. => (),
// }
// }
// FIXME: support half_open_range_patterns (`..=2`),
// exclusive_range_pattern (`..5`) with missing lhs
for &range_op in [T![...], T![..=], T![..]].iter() {
if p.at(range_op) {
let m = lhs.precede(p);
p.bump(range_op);
if !p.at(T![=>]) {
// not a range pat like `302 .. => ()`
// `0 .. =>` or `let 0 .. =`
// ^ ^
if p.at(T![=]) {
// test half_open_range_pat
// fn f() { let 0 .. = 1u32; }
} else {
atom_pat(p, recovery_set);
}
m.complete(p, RANGE_PAT);

View File

@ -0,0 +1,31 @@
SOURCE_FILE@0..28
FN@0..27
FN_KW@0..2 "fn"
WHITESPACE@2..3 " "
NAME@3..4
IDENT@3..4 "f"
PARAM_LIST@4..6
L_PAREN@4..5 "("
R_PAREN@5..6 ")"
WHITESPACE@6..7 " "
BLOCK_EXPR@7..27
L_CURLY@7..8 "{"
WHITESPACE@8..9 " "
LET_STMT@9..25
LET_KW@9..12 "let"
WHITESPACE@12..13 " "
RANGE_PAT@13..17
LITERAL_PAT@13..14
LITERAL@13..14
INT_NUMBER@13..14 "0"
WHITESPACE@14..15 " "
DOT2@15..17 ".."
WHITESPACE@17..18 " "
EQ@18..19 "="
WHITESPACE@19..20 " "
LITERAL@20..24
INT_NUMBER@20..24 "1u32"
SEMICOLON@24..25 ";"
WHITESPACE@25..26 " "
R_CURLY@26..27 "}"
WHITESPACE@27..28 "\n"

View File

@ -0,0 +1 @@
fn f() { let 0 .. = 1u32; }