diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-11-02 12:13:45 +0100 |
|---|---|---|
| committer | Martin Haug <mhaug@live.de> | 2021-11-05 13:46:41 +0100 |
| commit | 65fac0e57c9852eb2131aa06c0bac43b70bfbfbc (patch) | |
| tree | 8ed11d7cefd4e64f523b975f077e4b10f67a7cb9 /src/parse/parser.rs | |
| parent | 42afb27cef5540535420fb6d8d9d2fcda7300a47 (diff) | |
Refactoring
Co-Authored-By: Martin <mhaug@live.de>
Diffstat (limited to 'src/parse/parser.rs')
| -rw-r--r-- | src/parse/parser.rs | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/parse/parser.rs b/src/parse/parser.rs index 8c68d630..5833c724 100644 --- a/src/parse/parser.rs +++ b/src/parse/parser.rs @@ -1,7 +1,7 @@ use std::ops::Range; use std::rc::Rc; -use super::{is_newline, TokenMode, Tokens}; +use super::{TokenMode, Tokens}; use crate::syntax::{ErrorPosition, Green, GreenData, GreenNode, NodeKind}; use crate::util::EcoString; @@ -375,11 +375,7 @@ impl<'s> Parser<'s> { /// Determine the column index for the given byte index. pub fn column(&self, index: usize) -> usize { - self.src[.. index] - .chars() - .rev() - .take_while(|&c| !is_newline(c)) - .count() + self.tokens.column(index) } /// Slice out part of the source string. |
