MCPcopy Index your code
hub / github.com/SolaWing/xcode-build-server / parse

Method parse

xclog_parser.py:236–284  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

234 echo(f"ProcessPCH {info[2]}")
235
236 def parse(self):
237 from inspect import iscoroutine
238 import asyncio
239
240 items = []
241 futures = []
242 self.index_store_path = set()
243 self.items = items
244
245 def append(item):
246 if isinstance(item, dict):
247 items.append(item)
248 else:
249 items.extend(item)
250
251 # @return Future or Item, None to skip it
252 matcher = [
253 self.parse_swift_driver_module,
254 self.parse_swift_error,
255 self.parse_compile_swift_module,
256 self.parse_c,
257 self.parse_pch,
258 ]
259 try:
260 while True:
261 line = next(self._input) # type: str
262
263 if line.startswith("==="):
264 echo(line)
265 continue
266 for m in matcher:
267 item = m(line)
268 if item:
269 if iscoroutine(item):
270 futures.append(item)
271 else:
272 append(item)
273 break
274 except StopIteration:
275 pass
276
277 if len(futures) > 0:
278 echo("waiting... ")
279 for item in asyncio.get_event_loop().run_until_complete(
280 asyncio.gather(*futures)
281 ):
282 append(item)
283
284 return items
285
286
287def dump_database(items, output):

Callers 1

_parseFunction · 0.95

Calls 2

echoFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected