aboutsummaryrefslogtreecommitdiff
path: root/src/parser/event_parser/grammar
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/event_parser/grammar')
-rw-r--r--src/parser/event_parser/grammar/items.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs
index 522986ed0..725f04d1e 100644
--- a/src/parser/event_parser/grammar/items.rs
+++ b/src/parser/event_parser/grammar/items.rs
@@ -32,6 +32,7 @@ fn mod_contents_item(p: &mut Parser) {
32} 32}
33 33
34fn item(p: &mut Parser) -> bool { 34fn item(p: &mut Parser) -> bool {
35 let attrs_start = p.mark();
35 attributes::outer_attributes(p); 36 attributes::outer_attributes(p);
36 visibility(p); 37 visibility(p);
37 // node_if(p, USE_KW, USE_ITEM, use_item) 38 // node_if(p, USE_KW, USE_ITEM, use_item)
@@ -41,11 +42,17 @@ fn item(p: &mut Parser) -> bool {
41 // || unsafe trait, impl 42 // || unsafe trait, impl
42 // || node_if(p, FN_KW, FN_ITEM, fn_item) 43 // || node_if(p, FN_KW, FN_ITEM, fn_item)
43 // || node_if(p, TYPE_KW, TYPE_ITEM, type_item) 44 // || node_if(p, TYPE_KW, TYPE_ITEM, type_item)
44 node_if(p, [EXTERN_KW, CRATE_KW], EXTERN_CRATE_ITEM, extern_crate_item) 45 let item_start = p.mark();
46 let item_parsed = node_if(p, [EXTERN_KW, CRATE_KW], EXTERN_CRATE_ITEM, extern_crate_item)
45 || node_if(p, MOD_KW, MOD_ITEM, mod_item) 47 || node_if(p, MOD_KW, MOD_ITEM, mod_item)
46 || node_if(p, USE_KW, USE_ITEM, use_item) 48 || node_if(p, USE_KW, USE_ITEM, use_item)
47 || node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item) 49 || node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item)
48 || node_if(p, FN_KW, FN_ITEM, fn_item) 50 || node_if(p, FN_KW, FN_ITEM, fn_item);
51
52 if item_parsed && attrs_start != item_start {
53 p.forward_parent(attrs_start, item_start);
54 }
55 item_parsed
49} 56}
50 57
51fn struct_item(p: &mut Parser) { 58fn struct_item(p: &mut Parser) {