diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-31 07:06:31 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-31 07:06:31 +0000 |
commit | 97ade899937dafcafa852177c85edb22ce0b80dc (patch) | |
tree | cf5f8bdc5647222c8300c3386c5c8d47283d5116 /crates/ra_syntax/tests/data/parser/inline | |
parent | 777c79ce6bff0e70c8367f429f058f6d87ff3864 (diff) | |
parent | 00e6b5d26c82d5faff066c24418a0eb5741efcd1 (diff) |
Merge #692
692: [WIP] Correctly parse attributes r=matklad a=DJMcNab
Reference - https://doc.rust-lang.org/reference/attributes.html
This fixes/investigates inner attributes for:
- [x] `impl` blocks
- [x] `extern` blocks
- [x] `fn`s (fixes #689)
- [x] `mod`s (already supported)
- [x] 'block expressions' (the long text just describes all 'blocks' used as statements)
This also investigates/fixes outer attributes for:
- [ ] 'most statements' (see also: #685, https://doc.rust-lang.org/reference/expressions.html#expression-attributes)
- [x] Enum variants, Struct and Union fields (Fixed in #507)
- [ ] 'Match expression arms' (@matklad can you provide a test case which explains what this means?)
- [ ] 'Generic lifetime or type parameters'
- [ ] 'Elements of array expressions, tuple expressions, call expressions, tuple-style struct and enum variant expressions'
- [ ] 'The tail expression of block expressions'
Co-authored-by: DJMcNab <[email protected]>
Diffstat (limited to 'crates/ra_syntax/tests/data/parser/inline')
-rw-r--r-- | crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.rs | 5 | ||||
-rw-r--r-- | crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.txt | 38 |
2 files changed, 43 insertions, 0 deletions
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.rs new file mode 100644 index 000000000..4d68cceb7 --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.rs | |||
@@ -0,0 +1,5 @@ | |||
1 | enum F{} | ||
2 | impl F { | ||
3 | //! This is a doc comment | ||
4 | #![doc("This is also a doc comment")] | ||
5 | } | ||
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.txt new file mode 100644 index 000000000..3b761b7bb --- /dev/null +++ b/crates/ra_syntax/tests/data/parser/inline/ok/0118_impl_inner_attributes.txt | |||
@@ -0,0 +1,38 @@ | |||
1 | SOURCE_FILE@[0; 94) | ||
2 | ENUM_DEF@[0; 8) | ||
3 | ENUM_KW@[0; 4) | ||
4 | WHITESPACE@[4; 5) | ||
5 | NAME@[5; 6) | ||
6 | IDENT@[5; 6) "F" | ||
7 | ENUM_VARIANT_LIST@[6; 8) | ||
8 | L_CURLY@[6; 7) | ||
9 | R_CURLY@[7; 8) | ||
10 | WHITESPACE@[8; 9) | ||
11 | IMPL_BLOCK@[9; 93) | ||
12 | IMPL_KW@[9; 13) | ||
13 | WHITESPACE@[13; 14) | ||
14 | PATH_TYPE@[14; 15) | ||
15 | PATH@[14; 15) | ||
16 | PATH_SEGMENT@[14; 15) | ||
17 | NAME_REF@[14; 15) | ||
18 | IDENT@[14; 15) "F" | ||
19 | WHITESPACE@[15; 16) | ||
20 | ITEM_LIST@[16; 93) | ||
21 | L_CURLY@[16; 17) | ||
22 | WHITESPACE@[17; 23) | ||
23 | COMMENT@[23; 48) | ||
24 | WHITESPACE@[48; 54) | ||
25 | ATTR@[54; 91) | ||
26 | POUND@[54; 55) | ||
27 | EXCL@[55; 56) | ||
28 | TOKEN_TREE@[56; 91) | ||
29 | L_BRACK@[56; 57) | ||
30 | IDENT@[57; 60) "doc" | ||
31 | TOKEN_TREE@[60; 90) | ||
32 | L_PAREN@[60; 61) | ||
33 | STRING@[61; 89) | ||
34 | R_PAREN@[89; 90) | ||
35 | R_BRACK@[90; 91) | ||
36 | WHITESPACE@[91; 92) | ||
37 | R_CURLY@[92; 93) | ||
38 | WHITESPACE@[93; 94) | ||