INNER CODE UNIT · Python
extract_functions
apistol78/traktor · scripts/generate-node-emitter-capture.py:33
def extract_functions(lines):
"""Return { function_name: source_text } for each top-level emit function."""
funcs = {}
sig = re.compile(r"^bool\s+(emit\w+)\s*\(\s*GlslContext")
i = 0
n = len(lines)
while i < n:
m = sig.match(lines[i])
if not m:
i += 1
continue
name = m.group(1)
start = i
# Find the opening brace line (next line that is exactly '{').
j = i + 1
while j < n and lines[j].rstrip() != "{":
# Bail if another signature appears before the body opens.
if sig.match(lines[j]):