diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-09 10:21:50 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-09 10:21:50 +0100 |
commit | 5f82012779c374d9f6b518634aefb14ce28e17e6 (patch) | |
tree | 40db0d5e514bf1d260aa21a3a305b37986136481 /crates/ra_syntax/test_data/lexer/0016_raw_ident.rs | |
parent | 2fbec23d9990147e09a3b819c37dc1467a5e95d4 (diff) | |
parent | fa24e20867893178ed7265ecadb2bcb09cf76dac (diff) |
Merge #1669
1669: Parse tuple struct field initialization r=matklad a=eupn
Closes #1218.
This PR modifies the parser to accept the following code:
```rust
fn main() {
struct TupleStruct(usize);
let s = TupleStruct {
0: 1usize,
};
dbg!(s.0);
}
```
<details><summary>with following AST:</summary>
```
SOURCE_FILE@[0; 118)
FN_DEF@[0; 116)
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@[10; 116)
L_CURLY@[10; 11) "{"
WHITESPACE@[11; 16) "\n "
STRUCT_DEF@[16; 42)
STRUCT_KW@[16; 22) "struct"
WHITESPACE@[22; 23) " "
NAME@[23; 34)
IDENT@[23; 34) "TupleStruct"
POS_FIELD_DEF_LIST@[34; 41)
L_PAREN@[34; 35) "("
POS_FIELD_DEF@[35; 40)
PATH_TYPE@[35; 40)
PATH@[35; 40)
PATH_SEGMENT@[35; 40)
NAME_REF@[35; 40)
IDENT@[35; 40) "usize"
R_PAREN@[40; 41) ")"
SEMI@[41; 42) ";"
WHITESPACE@[42; 47) "\n "
LET_STMT@[47; 94)
LET_KW@[47; 50) "let"
WHITESPACE@[50; 51) " "
BIND_PAT@[51; 52)
NAME@[51; 52)
IDENT@[51; 52) "s"
WHITESPACE@[52; 53) " "
EQ@[53; 54) "="
WHITESPACE@[54; 55) " "
STRUCT_LIT@[55; 93)
PATH@[55; 66)
PATH_SEGMENT@[55; 66)
NAME_REF@[55; 66)
IDENT@[55; 66) "TupleStruct"
WHITESPACE@[66; 67) " "
NAMED_FIELD_LIST@[67; 93)
L_CURLY@[67; 68) "{"
WHITESPACE@[68; 77) "\n "
NAMED_FIELD@[77; 86)
NAME_REF@[77; 78)
INT_NUMBER@[77; 78) "0"
COLON@[78; 79) ":"
WHITESPACE@[79; 80) " "
LITERAL@[80; 86)
INT_NUMBER@[80; 86) "1usize"
COMMA@[86; 87) ","
WHITESPACE@[87; 92) "\n "
R_CURLY@[92; 93) "}"
SEMI@[93; 94) ";"
WHITESPACE@[94; 104) "\n \n "
EXPR_STMT@[104; 114)
MACRO_CALL@[104; 113)
PATH@[104; 107)
PATH_SEGMENT@[104; 107)
NAME_REF@[104; 107)
IDENT@[104; 107) "dbg"
EXCL@[107; 108) "!"
TOKEN_TREE@[108; 113)
L_PAREN@[108; 109) "("
IDENT@[109; 110) "s"
DOT@[110; 111) "."
INT_NUMBER@[111; 112) "0"
R_PAREN@[112; 113) ")"
SEMI@[113; 114) ";"
WHITESPACE@[114; 115) "\n"
R_CURLY@[115; 116) "}"
WHITESPACE@[116; 118) "\n\n"
```
</summary>
Co-authored-by: Evgenii P <[email protected]>
Diffstat (limited to 'crates/ra_syntax/test_data/lexer/0016_raw_ident.rs')
0 files changed, 0 insertions, 0 deletions