aboutsummaryrefslogtreecommitdiff
path: root/src/parser
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-07 13:01:30 +0000
committerAleksey Kladov <[email protected]>2018-01-07 13:01:30 +0000
commitb5034410c8e5aabf809d2665e38017ef79d05601 (patch)
treee38af66118447b1834acf6d25630c294ea622176 /src/parser
parent7c6f0f9128665c1a605caaa552347b936578f952 (diff)
G: function item
Diffstat (limited to 'src/parser')
-rw-r--r--src/parser/event_parser/grammar.rs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/parser/event_parser/grammar.rs b/src/parser/event_parser/grammar.rs
index f26cbc4f6..09b2f02b2 100644
--- a/src/parser/event_parser/grammar.rs
+++ b/src/parser/event_parser/grammar.rs
@@ -22,8 +22,12 @@ fn inner_attributes(_: &mut Parser) {
22} 22}
23 23
24fn item_first(p: &Parser) -> bool { 24fn item_first(p: &Parser) -> bool {
25 match p.current() { 25 let current = match p.current() {
26 Some(STRUCT_KW) => true, 26 Some(c) => c,
27 None => return false,
28 };
29 match current {
30 STRUCT_KW | FN_KW => true,
27 _ => false, 31 _ => false,
28 } 32 }
29} 33}
@@ -31,7 +35,8 @@ fn item_first(p: &Parser) -> bool {
31fn item(p: &mut Parser) { 35fn item(p: &mut Parser) {
32 outer_attributes(p); 36 outer_attributes(p);
33 visibility(p); 37 visibility(p);
34 node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item); 38 node_if(p, STRUCT_KW, STRUCT_ITEM, struct_item)
39 || node_if(p, FN_KW, FN_ITEM, fn_item);
35} 40}
36 41
37fn struct_item(p: &mut Parser) { 42fn struct_item(p: &mut Parser) {
@@ -45,6 +50,12 @@ fn struct_field(p: &mut Parser) -> bool {
45 }) 50 })
46} 51}
47 52
53fn fn_item(p: &mut Parser) {
54 p.expect(IDENT) && p.expect(L_PAREN) && p.expect(R_PAREN)
55 && p.curly_block(|p| ());
56}
57
58
48// Paths, types, attributes, and stuff // 59// Paths, types, attributes, and stuff //
49 60
50fn outer_attributes(_: &mut Parser) { 61fn outer_attributes(_: &mut Parser) {