Returns char index in `self.rawdata` for the start of the current line.
(self)
| 180 | |
| 181 | @property |
| 182 | def line_offset(self) -> int: |
| 183 | """Returns char index in `self.rawdata` for the start of the current line. """ |
| 184 | for ii in range(len(self.lineno_start_cache)-1, self.lineno-1): |
| 185 | last_line_start_pos = self.lineno_start_cache[ii] |
| 186 | lf_pos = self.rawdata.find('\n', last_line_start_pos) |
| 187 | if lf_pos == -1: |
| 188 | # No more newlines found. Use end of raw data as start of line beyond end. |
| 189 | lf_pos = len(self.rawdata) |
| 190 | self.lineno_start_cache.append(lf_pos+1) |
| 191 | |
| 192 | return self.lineno_start_cache[self.lineno-1] |
| 193 | |
| 194 | def at_line_start(self) -> bool: |
| 195 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected