aboutsummaryrefslogtreecommitdiff
path: root/src/parser/event_parser/grammar.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-01-07 16:50:54 +0000
committerAleksey Kladov <[email protected]>2018-01-07 16:50:54 +0000
commitf194750a2a4d5f034e89b937e1271637b884a503 (patch)
tree1f6ebe89813801a07e2be445acd6b112627adf9c /src/parser/event_parser/grammar.rs
parentb5034410c8e5aabf809d2665e38017ef79d05601 (diff)
G: start attributes
Diffstat (limited to 'src/parser/event_parser/grammar.rs')
-rw-r--r--src/parser/event_parser/grammar.rs26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/parser/event_parser/grammar.rs b/src/parser/event_parser/grammar.rs
index 09b2f02b2..d657ee1cd 100644
--- a/src/parser/event_parser/grammar.rs
+++ b/src/parser/event_parser/grammar.rs
@@ -17,10 +17,6 @@ pub fn file(p: &mut Parser) {
17 }) 17 })
18} 18}
19 19
20fn inner_attributes(_: &mut Parser) {
21 //TODO
22}
23
24fn item_first(p: &Parser) -> bool { 20fn item_first(p: &Parser) -> bool {
25 let current = match p.current() { 21 let current = match p.current() {
26 Some(c) => c, 22 Some(c) => c,
@@ -58,6 +54,20 @@ fn fn_item(p: &mut Parser) {
58 54
59// Paths, types, attributes, and stuff // 55// Paths, types, attributes, and stuff //
60 56
57fn inner_attributes(p: &mut Parser) {
58 many(p, inner_attribute)
59}
60
61fn inner_attribute(p: &mut Parser) -> bool {
62 if !(p.lookahead(&[EXCL, POUND])) {
63 return false;
64 }
65 node(p, ATTR, |p| {
66 p.bump_n(2);
67 });
68 true
69}
70
61fn outer_attributes(_: &mut Parser) { 71fn outer_attributes(_: &mut Parser) {
62} 72}
63 73
@@ -143,9 +153,15 @@ impl<'p> Parser<'p> {
143 } 153 }
144 } 154 }
145 155
146 pub(crate) fn optional(&mut self, kind: SyntaxKind) { 156 fn optional(&mut self, kind: SyntaxKind) {
147 if self.current_is(kind) { 157 if self.current_is(kind) {
148 self.bump(); 158 self.bump();
149 } 159 }
150 } 160 }
161
162 fn bump_n(&mut self, n: u8) {
163 for _ in 0..n {
164 self.bump();
165 }
166 }
151} \ No newline at end of file 167} \ No newline at end of file