Correctly parse inner attributes of impl blocks

This commit is contained in:
DJMcNab 2019-01-27 14:55:03 +00:00
parent 964086e0d4
commit 73b075c556
3 changed files with 50 additions and 0 deletions

View File

@ -78,6 +78,13 @@ pub(crate) fn impl_item_list(p: &mut Parser) {
assert!(p.at(L_CURLY));
let m = p.start();
p.bump();
// test impl_inner_attributes
// enum F{}
// impl F {
// //! This is a doc comment
// #![doc("This is also a doc comment")]
// }
attributes::inner_attributes(p);
while !p.at(EOF) && !p.at(R_CURLY) {
if p.at(L_CURLY) {

View File

@ -0,0 +1,5 @@
enum F{}
impl F {
//! This is a doc comment
#![doc("This is also a doc comment")]
}

View File

@ -0,0 +1,38 @@
SOURCE_FILE@[0; 94)
ENUM_DEF@[0; 8)
ENUM_KW@[0; 4)
WHITESPACE@[4; 5)
NAME@[5; 6)
IDENT@[5; 6) "F"
ENUM_VARIANT_LIST@[6; 8)
L_CURLY@[6; 7)
R_CURLY@[7; 8)
WHITESPACE@[8; 9)
IMPL_BLOCK@[9; 93)
IMPL_KW@[9; 13)
WHITESPACE@[13; 14)
PATH_TYPE@[14; 15)
PATH@[14; 15)
PATH_SEGMENT@[14; 15)
NAME_REF@[14; 15)
IDENT@[14; 15) "F"
WHITESPACE@[15; 16)
ITEM_LIST@[16; 93)
L_CURLY@[16; 17)
WHITESPACE@[17; 23)
COMMENT@[23; 48)
WHITESPACE@[48; 54)
ATTR@[54; 91)
POUND@[54; 55)
EXCL@[55; 56)
TOKEN_TREE@[56; 91)
L_BRACK@[56; 57)
IDENT@[57; 60) "doc"
TOKEN_TREE@[60; 90)
L_PAREN@[60; 61)
STRING@[61; 89)
R_PAREN@[89; 90)
R_BRACK@[90; 91)
WHITESPACE@[91; 92)
R_CURLY@[92; 93)
WHITESPACE@[93; 94)