diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/parser/event_parser/grammar/items.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/parser/event_parser/grammar/items.rs b/src/parser/event_parser/grammar/items.rs index 38a4657aa..7706690cc 100644 --- a/src/parser/event_parser/grammar/items.rs +++ b/src/parser/event_parser/grammar/items.rs | |||
@@ -103,18 +103,27 @@ fn struct_item(p: &mut Parser) { | |||
103 | } | 103 | } |
104 | 104 | ||
105 | fn named_fields(p: &mut Parser) { | 105 | fn named_fields(p: &mut Parser) { |
106 | p.curly_block(|p| comma_list(p, EOF, |p| { | 106 | assert!(p.at(L_CURLY)); |
107 | p.bump(); | ||
108 | while !p.at(R_CURLY) && !p.at(EOF) { | ||
107 | named_field(p); | 109 | named_field(p); |
108 | true | 110 | if !p.at(R_CURLY) { |
109 | })); | 111 | p.expect(COMMA); |
112 | } | ||
113 | } | ||
114 | p.expect(R_CURLY); | ||
110 | 115 | ||
111 | fn named_field(p: &mut Parser) { | 116 | fn named_field(p: &mut Parser) { |
112 | let field = p.start(); | 117 | let field = p.start(); |
113 | visibility(p); | 118 | visibility(p); |
114 | if p.expect(IDENT) && p.expect(COLON) { | 119 | if p.expect(IDENT) { |
120 | p.expect(COLON); | ||
115 | types::type_ref(p); | 121 | types::type_ref(p); |
116 | }; | 122 | field.complete(p, NAMED_FIELD); |
117 | field.complete(p, NAMED_FIELD); | 123 | } else { |
124 | field.abandon(p); | ||
125 | p.err_and_bump("expected field declaration"); | ||
126 | } | ||
118 | } | 127 | } |
119 | } | 128 | } |
120 | 129 | ||