aboutsummaryrefslogtreecommitdiff
path: root/src/parser/event_parser/grammar/items.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/event_parser/grammar/items.rs')
-rw-r--r--src/parser/event_parser/grammar/items.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs
index e775db14b..950e02a4d 100644
--- a/src/parser/event_parser/grammar/items.rs
+++ b/src/parser/event_parser/grammar/items.rs
@@ -12,7 +12,7 @@ pub(super) fn mod_contents(p: &mut Parser) {
12 12
13fn item_first(p: &Parser) -> bool { 13fn item_first(p: &Parser) -> bool {
14 match p.current() { 14 match p.current() {
15 STRUCT_KW | FN_KW | EXTERN_KW | MOD_KW => true, 15 STRUCT_KW | FN_KW | EXTERN_KW | MOD_KW | USE_KW => true,
16 _ => false, 16 _ => false,
17 } 17 }
18} 18}
@@ -43,6 +43,7 @@ fn item(p: &mut Parser) -> bool {
43 // || node_if(p, TYPE_KW, TYPE_ITEM, type_item) 43 // || node_if(p, TYPE_KW, TYPE_ITEM, type_item)
44 node_if(p, [EXTERN_KW, CRATE_KW], EXTERN_CRATE_ITEM, extern_crate_item) 44 node_if(p, [EXTERN_KW, CRATE_KW], EXTERN_CRATE_ITEM, extern_crate_item)
45 || node_if(p, MOD_KW, MOD_ITEM, mod_item) 45 || node_if(p, MOD_KW, MOD_ITEM, mod_item)
46 || node_if(p, USE_KW, USE_ITEM, use_item)
46 || node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item) 47 || node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item)
47 || node_if(p, FN_KW, FN_ITEM, fn_item) 48 || node_if(p, FN_KW, FN_ITEM, fn_item)
48} 49}
@@ -66,6 +67,11 @@ fn mod_item(p: &mut Parser) {
66 p.curly_block(mod_contents); 67 p.curly_block(mod_contents);
67} 68}
68 69
70fn use_item(p: &mut Parser) {
71 paths::use_path(p);
72 p.expect(SEMI);
73}
74
69fn struct_field(p: &mut Parser) -> bool { 75fn struct_field(p: &mut Parser) -> bool {
70 node_if(p, IDENT, STRUCT_FIELD, |p| { 76 node_if(p, IDENT, STRUCT_FIELD, |p| {
71 p.expect(COLON) && p.expect(IDENT); 77 p.expect(COLON) && p.expect(IDENT);