aboutsummaryrefslogtreecommitdiff
path: root/src/parser/event_parser/grammar/items/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/event_parser/grammar/items/mod.rs')
-rw-r--r--src/parser/event_parser/grammar/items/mod.rs33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/parser/event_parser/grammar/items/mod.rs b/src/parser/event_parser/grammar/items/mod.rs
index 9930de347..8ccf8f90f 100644
--- a/src/parser/event_parser/grammar/items/mod.rs
+++ b/src/parser/event_parser/grammar/items/mod.rs
@@ -2,6 +2,7 @@ use super::*;
2 2
3mod structs; 3mod structs;
4mod use_item; 4mod use_item;
5mod consts;
5 6
6pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) { 7pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) {
7 attributes::inner_attributes(p); 8 attributes::inner_attributes(p);
@@ -47,9 +48,26 @@ fn item(p: &mut Parser) {
47 } 48 }
48 } 49 }
49 STATIC_KW => { 50 STATIC_KW => {
50 static_item(p); 51 consts::static_item(p);
51 STATIC_ITEM 52 STATIC_ITEM
52 } 53 }
54 CONST_KW => match p.nth(1) {
55 FN_KW => {
56 p.bump();
57 fn_item(p);
58 FN_ITEM
59 }
60 UNSAFE_KW if p.nth(2) == FN_KW => {
61 p.bump();
62 p.bump();
63 fn_item(p);
64 FN_ITEM
65 }
66 _ => {
67 consts::const_item(p);
68 CONST_ITEM
69 }
70 },
53 MOD_KW => { 71 MOD_KW => {
54 mod_item(p); 72 mod_item(p);
55 MOD_ITEM 73 MOD_ITEM
@@ -101,19 +119,6 @@ fn extern_block(p: &mut Parser) {
101 p.bump(); 119 p.bump();
102 p.expect(R_CURLY); 120 p.expect(R_CURLY);
103} 121}
104
105fn static_item(p: &mut Parser) {
106 assert!(p.at(STATIC_KW));
107 p.bump();
108 p.eat(MUT_KW);
109 p.expect(IDENT);
110 p.expect(COLON);
111 types::type_ref(p);
112 p.expect(EQ);
113 expressions::expr(p);
114 p.expect(SEMI);
115}
116
117fn mod_item(p: &mut Parser) { 122fn mod_item(p: &mut Parser) {
118 assert!(p.at(MOD_KW)); 123 assert!(p.at(MOD_KW));
119 p.bump(); 124 p.bump();