diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-06 12:12:02 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-11-06 15:49:39 +0100 |
| commit | 41bdafb5785dd85d20a3e79900b18e0010f6d71d (patch) | |
| tree | b2466b87e7da2b99256d7d1e08a644185e5879f3 /src/parse/tokens.rs | |
| parent | 515fe89c5ea94e6bcdcfe387d006776d31ad3646 (diff) | |
Faster parser
Diffstat (limited to 'src/parse/tokens.rs')
| -rw-r--r-- | src/parse/tokens.rs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/parse/tokens.rs b/src/parse/tokens.rs index aa28e1f5..494a9f0b 100644 --- a/src/parse/tokens.rs +++ b/src/parse/tokens.rs @@ -57,12 +57,6 @@ impl<'s> Tokens<'s> { self.s.jump(index); } - /// The column of a given index in the source string. - #[inline] - pub fn column(&self, index: usize) -> usize { - self.s.column(index) - } - /// The underlying scanner. #[inline] pub fn scanner(&self) -> Scanner<'s> { @@ -314,7 +308,7 @@ impl<'s> Tokens<'s> { } fn raw(&mut self) -> NodeKind { - let column = self.column(self.s.index() - 1); + let column = self.s.column(self.s.index() - 1); let mut backticks = 1; while self.s.eat_if('`') && backticks < u8::MAX { @@ -342,10 +336,8 @@ impl<'s> Tokens<'s> { } } - let terminated = found == backticks; - let end = self.s.index() - if terminated { found as usize } else { 0 }; - - if terminated { + if found == backticks { + let end = self.s.index() - found as usize; NodeKind::Raw(Rc::new(resolve_raw( column, backticks, |
