aboutsummaryrefslogtreecommitdiff
path: root/src/parser/event_parser/grammar/attributes.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser/event_parser/grammar/attributes.rs')
-rw-r--r--src/parser/event_parser/grammar/attributes.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/parser/event_parser/grammar/attributes.rs b/src/parser/event_parser/grammar/attributes.rs
index 52210ccad..d774f8827 100644
--- a/src/parser/event_parser/grammar/attributes.rs
+++ b/src/parser/event_parser/grammar/attributes.rs
@@ -1,22 +1,26 @@
1use super::*; 1use super::*;
2 2
3enum AttrKind {
4 Inner, Outer
5}
6
3pub(super) fn inner_attributes(p: &mut Parser) { 7pub(super) fn inner_attributes(p: &mut Parser) {
4 many(p, |p| attribute(p, true)) 8 many(p, |p| attribute(p, AttrKind::Inner))
5} 9}
6 10
7pub(super) fn outer_attributes(_: &mut Parser) { 11pub(super) fn outer_attributes(p: &mut Parser) {
12 many(p, |p| attribute(p, AttrKind::Outer))
8} 13}
9 14
10 15
11fn attribute(p: &mut Parser, inner: bool) -> bool { 16fn attribute(p: &mut Parser, kind: AttrKind) -> bool {
12 fn attr_tail(p: &mut Parser) { 17 fn attr_tail(p: &mut Parser) {
13 meta_item(p) && p.expect(R_BRACK); 18 meta_item(p) && p.expect(R_BRACK);
14 } 19 }
15 20
16 if inner { 21 match kind {
17 node_if(p, [POUND, EXCL, L_BRACK], ATTR, attr_tail) 22 AttrKind::Inner => node_if(p, [POUND, EXCL, L_BRACK], ATTR, attr_tail),
18 } else { 23 AttrKind::Outer => node_if(p, [POUND, L_BRACK], ATTR, attr_tail),
19 node_if(p, [POUND, L_BRACK], ATTR, attr_tail)
20 } 24 }
21} 25}
22 26