diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-02-02 20:46:04 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2018-02-02 20:46:04 +0000 |
commit | 5e7504b978c9b1365e0381691ef453e97603defa (patch) | |
tree | 44333026e9a488deef5ebc73eb6c8a277d1975dc /src/parser/event_parser/grammar/items | |
parent | f9ecc680f0317bc56e661d7b41e7edcf52b2f995 (diff) | |
parent | 0000f4f4f2f32c6ff67db6cbc27e3a49c85f4b99 (diff) |
Merge #36
36: Static items r=matklad a=matklad
Diffstat (limited to 'src/parser/event_parser/grammar/items')
-rw-r--r-- | src/parser/event_parser/grammar/items/mod.rs | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/parser/event_parser/grammar/items/mod.rs b/src/parser/event_parser/grammar/items/mod.rs index 35825e7c4..9930de347 100644 --- a/src/parser/event_parser/grammar/items/mod.rs +++ b/src/parser/event_parser/grammar/items/mod.rs | |||
@@ -46,6 +46,10 @@ fn item(p: &mut Parser) { | |||
46 | } | 46 | } |
47 | } | 47 | } |
48 | } | 48 | } |
49 | STATIC_KW => { | ||
50 | static_item(p); | ||
51 | STATIC_ITEM | ||
52 | } | ||
49 | MOD_KW => { | 53 | MOD_KW => { |
50 | mod_item(p); | 54 | mod_item(p); |
51 | MOD_ITEM | 55 | MOD_ITEM |
@@ -92,6 +96,24 @@ fn extern_crate_item(p: &mut Parser) { | |||
92 | p.expect(IDENT) && alias(p) && p.expect(SEMI); | 96 | p.expect(IDENT) && alias(p) && p.expect(SEMI); |
93 | } | 97 | } |
94 | 98 | ||
99 | fn extern_block(p: &mut Parser) { | ||
100 | assert!(p.at(L_CURLY)); | ||
101 | p.bump(); | ||
102 | p.expect(R_CURLY); | ||
103 | } | ||
104 | |||
105 | fn 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 | |||
95 | fn mod_item(p: &mut Parser) { | 117 | fn mod_item(p: &mut Parser) { |
96 | assert!(p.at(MOD_KW)); | 118 | assert!(p.at(MOD_KW)); |
97 | p.bump(); | 119 | p.bump(); |
@@ -104,12 +126,6 @@ fn mod_item(p: &mut Parser) { | |||
104 | } | 126 | } |
105 | } | 127 | } |
106 | 128 | ||
107 | fn extern_block(p: &mut Parser) { | ||
108 | assert!(p.at(L_CURLY)); | ||
109 | p.bump(); | ||
110 | p.expect(R_CURLY); | ||
111 | } | ||
112 | |||
113 | fn abi(p: &mut Parser) { | 129 | fn abi(p: &mut Parser) { |
114 | assert!(p.at(EXTERN_KW)); | 130 | assert!(p.at(EXTERN_KW)); |
115 | let abi = p.start(); | 131 | let abi = p.start(); |