Finds the first occurrence of any string in strings in lines.
(lines, token_table, cursor)
| 184 | |
| 185 | |
| 186 | def FindFirst(lines, token_table, cursor): |
| 187 | """Finds the first occurrence of any string in strings in lines.""" |
| 188 | |
| 189 | start = cursor.Clone() |
| 190 | cur_line_number = cursor.line |
| 191 | for line in lines[start.line:]: |
| 192 | if cur_line_number == start.line: |
| 193 | line = line[start.column:] |
| 194 | m = FindFirstInLine(line, token_table) |
| 195 | if m: |
| 196 | # We found a regex in line. |
| 197 | (start_column, length, token_type) = m |
| 198 | if cur_line_number == start.line: |
| 199 | start_column += start.column |
| 200 | found_start = Cursor(cur_line_number, start_column) |
| 201 | found_end = found_start + length |
| 202 | return MakeToken(lines, found_start, found_end, token_type) |
| 203 | cur_line_number += 1 |
| 204 | # We failed to find str in lines |
| 205 | return None |
| 206 | |
| 207 | |
| 208 | def SubString(lines, start, end): |
no test coverage detected