MCPcopy Index your code
hub / github.com/python/cpython / _parse_marker_line

Function _parse_marker_line

Tools/c-analyzer/c_parser/preprocessor/gcc.py:219–244  ·  view source on GitHub ↗
(line, reqfile=None)

Source from the content-addressed store, hash-verified

217
218
219def _parse_marker_line(line, reqfile=None):
220 m = LINE_MARKER_RE.match(line)
221 if not m:
222 return None, None, None
223 lno, origfile, flags = m.groups()
224 lno = int(lno)
225 assert origfile not in META_FILES, (line,)
226 assert lno > 0, (line, lno)
227 flags = set(int(f) for f in flags.split()) if flags else ()
228
229 if 1 in flags:
230 # We're entering a file.
231 assert lno == 1, (line, lno)
232 assert 2 not in flags, (line,)
233 elif 2 in flags:
234 # We're returning to a file.
235 #assert lno > 1, (line, lno)
236 pass
237 elif reqfile and origfile == reqfile:
238 # We're starting the requested file.
239 assert lno == 1, (line, lno)
240 assert not flags, (line, flags)
241 else:
242 # It's the next line from the file.
243 assert lno > 1, (line, lno)
244 return lno, origfile, flags
245
246
247def _strip_directives(line, partial=0):

Callers 2

_iter_linesFunction · 0.85
_iter_top_include_linesFunction · 0.85

Calls 4

setFunction · 0.85
matchMethod · 0.45
groupsMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…