aboutsummaryrefslogtreecommitdiff
path: root/src/parser_impl/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser_impl/mod.rs')
-rw-r--r--src/parser_impl/mod.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/parser_impl/mod.rs b/src/parser_impl/mod.rs
index 2791c8da5..d640a7784 100644
--- a/src/parser_impl/mod.rs
+++ b/src/parser_impl/mod.rs
@@ -65,6 +65,11 @@ impl<'t> ParserImpl<'t> {
65 self.events 65 self.events
66 } 66 }
67 67
68 pub(super) fn at_compound2(&self, c1: SyntaxKind, c2: SyntaxKind) -> bool {
69 self.inp.kind(self.pos) == c1 && self.inp.kind(self.pos + 1) == c2
70 && self.inp.start(self.pos + 1) == self.inp.start(self.pos) + self.inp.len(self.pos)
71 }
72
68 pub(super) fn nth(&self, n: u32) -> SyntaxKind { 73 pub(super) fn nth(&self, n: u32) -> SyntaxKind {
69 self.inp.kind(self.pos + n) 74 self.inp.kind(self.pos + n)
70 } 75 }
@@ -87,7 +92,7 @@ impl<'t> ParserImpl<'t> {
87 if kind == EOF { 92 if kind == EOF {
88 return; 93 return;
89 } 94 }
90 self.do_bump(kind); 95 self.do_bump(kind, 1);
91 } 96 }
92 97
93 pub(super) fn bump_remap(&mut self, kind: SyntaxKind) { 98 pub(super) fn bump_remap(&mut self, kind: SyntaxKind) {
@@ -95,14 +100,18 @@ impl<'t> ParserImpl<'t> {
95 // TODO: panic!? 100 // TODO: panic!?
96 return; 101 return;
97 } 102 }
98 self.do_bump(kind); 103 self.do_bump(kind, 1);
104 }
105
106 pub(super) fn bump_compound(&mut self, kind: SyntaxKind, n: u8) {
107 self.do_bump(kind, n);
99 } 108 }
100 109
101 fn do_bump(&mut self, kind: SyntaxKind) { 110 fn do_bump(&mut self, kind: SyntaxKind, n_raw_tokens: u8) {
102 self.pos += 1; 111 self.pos += u32::from(n_raw_tokens);
103 self.event(Event::Token { 112 self.event(Event::Token {
104 kind, 113 kind,
105 n_raw_tokens: 1, 114 n_raw_tokens,
106 }); 115 });
107 } 116 }
108 117