MCPcopy Create free account
hub / github.com/GarageGames/Torque2D / FindFirst

Function FindFirst

engine/source/testing/googleTest/scripts/pump.py:186–205  ·  view source on GitHub ↗

Finds the first occurrence of any string in strings in lines.

(lines, token_table, cursor)

Source from the content-addressed store, hash-verified

184
185
186def 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
208def SubString(lines, start, end):

Callers 1

TokenizeLinesFunction · 0.85

Calls 4

FindFirstInLineFunction · 0.85
CursorClass · 0.85
MakeTokenFunction · 0.85
CloneMethod · 0.45

Tested by

no test coverage detected