mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
parent
16943e533c
commit
e8d50578ab
4 changed files with 80 additions and 39 deletions
|
@ -88,7 +88,9 @@ fn atom_pat(p: &mut Parser, recovery_set: TokenSet) -> Option<CompletedMarker> {
|
||||||
_ => bind_pat(p, true),
|
_ => bind_pat(p, true),
|
||||||
},
|
},
|
||||||
|
|
||||||
_ if paths::is_use_path_start(p) => path_or_macro_pat(p),
|
// test type_path_in_pattern
|
||||||
|
// fn main() { let <_>::Foo = (); }
|
||||||
|
_ if paths::is_path_start(p) => path_or_macro_pat(p),
|
||||||
_ if is_literal_pat_start(p) => literal_pat(p),
|
_ if is_literal_pat_start(p) => literal_pat(p),
|
||||||
|
|
||||||
T![.] if p.at(T![..]) => dot_dot_pat(p),
|
T![.] if p.at(T![..]) => dot_dot_pat(p),
|
||||||
|
@ -138,7 +140,7 @@ fn literal_pat(p: &mut Parser) -> CompletedMarker {
|
||||||
// let Bar(..) = ();
|
// let Bar(..) = ();
|
||||||
// }
|
// }
|
||||||
fn path_or_macro_pat(p: &mut Parser) -> CompletedMarker {
|
fn path_or_macro_pat(p: &mut Parser) -> CompletedMarker {
|
||||||
assert!(paths::is_use_path_start(p));
|
assert!(paths::is_path_start(p));
|
||||||
let m = p.start();
|
let m = p.start();
|
||||||
paths::expr_path(p);
|
paths::expr_path(p);
|
||||||
let kind = match p.current() {
|
let kind = match p.current() {
|
||||||
|
|
|
@ -180,44 +180,45 @@ SOURCE_FILE@0..240
|
||||||
EXPR_STMT@150..180
|
EXPR_STMT@150..180
|
||||||
TUPLE_EXPR@150..180
|
TUPLE_EXPR@150..180
|
||||||
L_PAREN@150..151 "("
|
L_PAREN@150..151 "("
|
||||||
BIN_EXPR@151..180
|
FOR_EXPR@151..180
|
||||||
BIN_EXPR@151..178
|
FOR_KW@151..154 "for"
|
||||||
BIN_EXPR@151..169
|
PATH_PAT@154..158
|
||||||
BIN_EXPR@151..167
|
PATH@154..158
|
||||||
BIN_EXPR@151..164
|
PATH_SEGMENT@154..158
|
||||||
FOR_EXPR@151..157
|
L_ANGLE@154..155 "<"
|
||||||
FOR_KW@151..154 "for"
|
ERROR@155..157
|
||||||
ERROR@154..155
|
LIFETIME@155..157 "\'a"
|
||||||
L_ANGLE@154..155 "<"
|
R_ANGLE@157..158 ">"
|
||||||
ERROR@155..157
|
WHITESPACE@158..159 " "
|
||||||
LIFETIME@155..157 "\'a"
|
BIN_EXPR@159..180
|
||||||
R_ANGLE@157..158 ">"
|
BIN_EXPR@159..178
|
||||||
WHITESPACE@158..159 " "
|
BIN_EXPR@159..169
|
||||||
|
BIN_EXPR@159..167
|
||||||
PATH_EXPR@159..164
|
PATH_EXPR@159..164
|
||||||
PATH@159..164
|
PATH@159..164
|
||||||
PATH_SEGMENT@159..164
|
PATH_SEGMENT@159..164
|
||||||
NAME_REF@159..164
|
NAME_REF@159..164
|
||||||
IDENT@159..164 "Trait"
|
IDENT@159..164 "Trait"
|
||||||
L_ANGLE@164..165 "<"
|
L_ANGLE@164..165 "<"
|
||||||
ERROR@165..167
|
ERROR@165..167
|
||||||
LIFETIME@165..167 "\'a"
|
LIFETIME@165..167 "\'a"
|
||||||
R_ANGLE@167..168 ">"
|
R_ANGLE@167..168 ">"
|
||||||
ERROR@168..169
|
ERROR@168..169
|
||||||
R_PAREN@168..169 ")"
|
R_PAREN@168..169 ")"
|
||||||
WHITESPACE@169..170 " "
|
WHITESPACE@169..170 " "
|
||||||
PLUS@170..171 "+"
|
PLUS@170..171 "+"
|
||||||
WHITESPACE@171..172 " "
|
WHITESPACE@171..172 " "
|
||||||
PAREN_EXPR@172..178
|
PAREN_EXPR@172..178
|
||||||
L_PAREN@172..173 "("
|
L_PAREN@172..173 "("
|
||||||
PATH_EXPR@173..177
|
PATH_EXPR@173..177
|
||||||
PATH@173..177
|
PATH@173..177
|
||||||
PATH_SEGMENT@173..177
|
PATH_SEGMENT@173..177
|
||||||
NAME_REF@173..177
|
NAME_REF@173..177
|
||||||
IDENT@173..177 "Copy"
|
IDENT@173..177 "Copy"
|
||||||
R_PAREN@177..178 ")"
|
R_PAREN@177..178 ")"
|
||||||
R_ANGLE@178..179 ">"
|
R_ANGLE@178..179 ">"
|
||||||
ERROR@179..180
|
ERROR@179..180
|
||||||
SEMICOLON@179..180 ";"
|
SEMICOLON@179..180 ";"
|
||||||
WHITESPACE@180..185 "\n "
|
WHITESPACE@180..185 "\n "
|
||||||
LET_STMT@185..235
|
LET_STMT@185..235
|
||||||
LET_KW@185..188 "let"
|
LET_KW@185..188 "let"
|
||||||
|
@ -302,13 +303,12 @@ error 146..146: expected expression
|
||||||
error 147..147: expected SEMICOLON
|
error 147..147: expected SEMICOLON
|
||||||
error 148..148: expected expression
|
error 148..148: expected expression
|
||||||
error 149..149: expected SEMICOLON
|
error 149..149: expected SEMICOLON
|
||||||
error 154..154: expected pattern
|
error 155..155: expected type
|
||||||
error 155..155: expected IN_KW
|
error 158..158: expected IN_KW
|
||||||
error 155..155: expected expression
|
|
||||||
error 157..157: expected a block
|
|
||||||
error 165..165: expected expression
|
error 165..165: expected expression
|
||||||
error 168..168: expected expression
|
error 168..168: expected expression
|
||||||
error 179..179: expected expression
|
error 179..179: expected expression
|
||||||
|
error 180..180: expected a block
|
||||||
error 180..180: expected COMMA
|
error 180..180: expected COMMA
|
||||||
error 180..180: expected expression
|
error 180..180: expected expression
|
||||||
error 180..180: expected R_PAREN
|
error 180..180: expected R_PAREN
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
SOURCE_FILE@0..33
|
||||||
|
FN_DEF@0..32
|
||||||
|
FN_KW@0..2 "fn"
|
||||||
|
WHITESPACE@2..3 " "
|
||||||
|
NAME@3..7
|
||||||
|
IDENT@3..7 "main"
|
||||||
|
PARAM_LIST@7..9
|
||||||
|
L_PAREN@7..8 "("
|
||||||
|
R_PAREN@8..9 ")"
|
||||||
|
WHITESPACE@9..10 " "
|
||||||
|
BLOCK_EXPR@10..32
|
||||||
|
L_CURLY@10..11 "{"
|
||||||
|
WHITESPACE@11..12 " "
|
||||||
|
LET_STMT@12..30
|
||||||
|
LET_KW@12..15 "let"
|
||||||
|
WHITESPACE@15..16 " "
|
||||||
|
PATH_PAT@16..24
|
||||||
|
PATH@16..24
|
||||||
|
PATH@16..19
|
||||||
|
PATH_SEGMENT@16..19
|
||||||
|
L_ANGLE@16..17 "<"
|
||||||
|
PLACEHOLDER_TYPE@17..18
|
||||||
|
UNDERSCORE@17..18 "_"
|
||||||
|
R_ANGLE@18..19 ">"
|
||||||
|
COLON2@19..21 "::"
|
||||||
|
PATH_SEGMENT@21..24
|
||||||
|
NAME_REF@21..24
|
||||||
|
IDENT@21..24 "Foo"
|
||||||
|
WHITESPACE@24..25 " "
|
||||||
|
EQ@25..26 "="
|
||||||
|
WHITESPACE@26..27 " "
|
||||||
|
TUPLE_EXPR@27..29
|
||||||
|
L_PAREN@27..28 "("
|
||||||
|
R_PAREN@28..29 ")"
|
||||||
|
SEMICOLON@29..30 ";"
|
||||||
|
WHITESPACE@30..31 " "
|
||||||
|
R_CURLY@31..32 "}"
|
||||||
|
WHITESPACE@32..33 "\n"
|
|
@ -0,0 +1 @@
|
||||||
|
fn main() { let <_>::Foo = (); }
|
Loading…
Reference in a new issue