INNER CODE UNIT · Python
split_args
introlab/rtabmap · doxygen/generate_parameters_page.py:84
def split_args(text):
"""Split a macro argument list on top-level commas."""
args, depth, current, i, in_string = [], 0, [], 0, False
while i < len(text):
c = text[i]
if in_string:
if c == '\\':
current.append(text[i:i + 2])
i += 2
continue
in_string = c != '"'
elif c == '"':
in_string = True
elif c in '([':
depth += 1
elif c in ')]':
depth -= 1
elif c == ',' and depth == 0: