diff options
Diffstat (limited to 'src/parser/event_parser/grammar/items.rs')
-rw-r--r-- | src/parser/event_parser/grammar/items.rs | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs index 0638e3093..7fed5e83b 100644 --- a/src/parser/event_parser/grammar/items.rs +++ b/src/parser/event_parser/grammar/items.rs | |||
@@ -14,7 +14,7 @@ fn item(p: &mut Parser) { | |||
14 | let item = p.start(); | 14 | let item = p.start(); |
15 | attributes::outer_attributes(p); | 15 | attributes::outer_attributes(p); |
16 | visibility(p); | 16 | visibility(p); |
17 | let la = p.raw_lookahead(1); | 17 | let la = p.nth(1); |
18 | let item_kind = match p.current() { | 18 | let item_kind = match p.current() { |
19 | EXTERN_KW if la == CRATE_KW => { | 19 | EXTERN_KW if la == CRATE_KW => { |
20 | extern_crate_item(p); | 20 | extern_crate_item(p); |
@@ -171,7 +171,7 @@ fn use_item(p: &mut Parser) { | |||
171 | p.expect(SEMI); | 171 | p.expect(SEMI); |
172 | 172 | ||
173 | fn use_tree(p: &mut Parser) { | 173 | fn use_tree(p: &mut Parser) { |
174 | let la = p.raw_lookahead(1); | 174 | let la = p.nth(1); |
175 | let m = p.start(); | 175 | let m = p.start(); |
176 | match (p.current(), la) { | 176 | match (p.current(), la) { |
177 | (STAR, _) => { | 177 | (STAR, _) => { |
@@ -235,5 +235,21 @@ fn fn_item(p: &mut Parser) { | |||
235 | assert!(p.at(FN_KW)); | 235 | assert!(p.at(FN_KW)); |
236 | p.bump(); | 236 | p.bump(); |
237 | 237 | ||
238 | p.expect(IDENT) && p.expect(L_PAREN) && p.expect(R_PAREN) && p.curly_block(|_| ()); | 238 | p.expect(IDENT); |
239 | if p.at(L_PAREN) { | ||
240 | fn_value_parameters(p); | ||
241 | } else { | ||
242 | p.error().message("expected function arguments").emit(); | ||
243 | } | ||
244 | |||
245 | if p.at(L_CURLY) { | ||
246 | p.expect(L_CURLY); | ||
247 | p.expect(R_CURLY); | ||
248 | } | ||
249 | |||
250 | fn fn_value_parameters(p: &mut Parser) { | ||
251 | assert!(p.at(L_PAREN)); | ||
252 | p.bump(); | ||
253 | p.expect(R_PAREN); | ||
254 | } | ||
239 | } | 255 | } |