diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-02-23 23:58:05 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-23 23:58:05 +0100 |
| commit | 90132b0d658f1b2a5df75eb458150e6782b2c30c (patch) | |
| tree | b4c237b22b31a6f965849fd7b540c7aec364ef96 /src/parse/scanner.rs | |
| parent | f2f473a81fde9c09e0f361f1b85fb5c14337f360 (diff) | |
| parent | 9fda623b02b2a0a9e9cdf806d9945d0759c8bf01 (diff) | |
Merge pull request #64 from typst/new-incr-parse
New Incremental Parser
Diffstat (limited to 'src/parse/scanner.rs')
| -rw-r--r-- | src/parse/scanner.rs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/src/parse/scanner.rs b/src/parse/scanner.rs index 685503c3..e4cf56e9 100644 --- a/src/parse/scanner.rs +++ b/src/parse/scanner.rs @@ -169,31 +169,6 @@ impl<'s> Scanner<'s> { // optimized away in some cases. self.src.get(start .. self.index).unwrap_or_default() } - - /// The column index of a given index in the source string. - #[inline] - pub fn column(&self, index: usize) -> usize { - self.column_offset(index, 0) - } - - /// The column index of a given index in the source string when an offset is - /// applied to the first line of the string. - #[inline] - pub fn column_offset(&self, index: usize, offset: usize) -> usize { - let mut apply_offset = false; - let res = self.src[.. index] - .char_indices() - .rev() - .take_while(|&(_, c)| !is_newline(c)) - .inspect(|&(i, _)| { - if i == 0 { - apply_offset = true - } - }) - .count(); - - if apply_offset { res + offset } else { res } - } } /// Whether this character denotes a newline. |
