Returns char index in `self.rawdata` for the start of the current line.
(self)
| 167 | |
| 168 | @property |
| 169 | def line_offset(self) -> int: |
| 170 | """Returns char index in `self.rawdata` for the start of the current line. """ |
| 171 | for ii in range(len(self.lineno_start_cache)-1, self.lineno-1): |
| 172 | last_line_start_pos = self.lineno_start_cache[ii] |
| 173 | lf_pos = self.rawdata.find('\n', last_line_start_pos) |
| 174 | if lf_pos == -1: |
| 175 | # No more newlines found. Use end of raw data as start of line beyond end. |
| 176 | lf_pos = len(self.rawdata) |
| 177 | self.lineno_start_cache.append(lf_pos+1) |
| 178 | |
| 179 | return self.lineno_start_cache[self.lineno-1] |
| 180 | |
| 181 | def at_line_start(self) -> bool: |
| 182 | """ |
nothing calls this directly
no outgoing calls
no test coverage detected