MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / parseMatch

Method parseMatch

tools/matchcompiler.py:305–335  ·  view source on GitHub ↗
(line, pos1)

Source from the content-addressed store, hash-verified

303
304 @staticmethod
305 def parseMatch(line, pos1):
306 parlevel = 0
307 args = []
308 argstart = 0
309 pos = pos1
310 inString = False
311 while pos < len(line):
312 if inString:
313 if line[pos] == '\\':
314 pos += 1
315 elif line[pos] == '"':
316 inString = False
317 elif line[pos] == '"':
318 inString = True
319 elif line[pos] == '(':
320 parlevel += 1
321 if parlevel == 1:
322 argstart = pos + 1
323 elif line[pos] == ')':
324 parlevel -= 1
325 if parlevel == 0:
326 ret = [line[pos1:pos + 1]]
327 ret.extend(args)
328 ret.append(line[argstart:pos])
329 return ret
330 elif line[pos] == ',' and parlevel == 1:
331 args.append(line[argstart:pos])
332 argstart = pos + 1
333 pos += 1
334
335 return None
336
337 @staticmethod
338 def _isInString(line, pos1):

Callers 3

_replaceTokenMatchMethod · 0.95
test_parseMatchMethod · 0.80

Calls

no outgoing calls

Tested by 1

test_parseMatchMethod · 0.64