code: def derive_coordinates(self):
          if self._coordinates_resolved:
              return
          if self.seg_map is not None:
              self.start, self.filename, include_ref = self.seg_map.derive_source_offset(self.start)
              self.end, end_filename, _ = self.seg_map.derive_source_offset(self.end, is_end=True)
          else:
              end_filename = self.filename
          line_start = 0
          lineno = 1
          file_pos = 0
          if self.filename != end_filename:
              get_end = False
          elif self.end is None:
              get_end = False
          else:
              get_end = True
          if (self.filename is not None) and (self.start is not None):
              with open(self.filename, 'r', newline='', encoding='utf_8') as fp:
                  while True:
                      line_text = fp.readline()
                      file_pos += len(line_text)
                      if line_text == "":
                          break
                      if (self.start_line is None) and (self.start < file_pos):
                          self.start_line = lineno
                          self.start_col = self.start - line_start
                          self.start_line_text = line_text.rstrip("\n").rstrip("\r")
                          if not get_end:
                              break
                      if get_end and (self.end_line is None) and (self.end < file_pos):
                          self.end_line = lineno
                          self.end_col = self.end - line_start
                          break
                      lineno += 1
                      line_start = file_pos
              if not get_end:
                  self.end_line = self.start_line
                  self.end_col = self.start_col
                  self.end = self.start
          self._coordinates_resolved = True