(&self)
| 951 | } |
| 952 | |
| 953 | fn current_token(&self) -> Option<(usize, usize, String)> { |
| 954 | if self.input.is_empty() || self.cursor_position > self.input.len() { |
| 955 | return None; |
| 956 | } |
| 957 | |
| 958 | let bytes = self.input.as_bytes(); |
| 959 | let mut start = self.cursor_position; |
| 960 | while start > 0 && !bytes[start - 1].is_ascii_whitespace() { |
| 961 | start -= 1; |
| 962 | } |
| 963 | |
| 964 | let mut end = self.cursor_position; |
| 965 | while end < bytes.len() && !bytes[end].is_ascii_whitespace() { |
| 966 | end += 1; |
| 967 | } |
| 968 | |
| 969 | let token = self.input[start..self.cursor_position].to_string(); |
| 970 | Some((start, end, token)) |
| 971 | } |
| 972 | |
| 973 | fn input_display_lines(&self, width: u16) -> u16 { |
| 974 | let reserved = 1u16 |
no test coverage detected