INNER CODE UNIT · Python
parse
introlab/rtabmap · doxygen/generate_parameters_page.py:121
def parse(path):
"""Return the parameters of Parameters.h, in declaration order."""
with open(path, newline='') as f:
lines = f.read().replace('\r\n', '\n').split('\n')
params, order = {}, []
conditions = [] # #if nesting, innermost last; None marks an #else
statement, collecting = '', False
in_class = False
for line in lines:
stripped = line.strip()
# Everything before the class (include guard, macro definitions) would
# only add noise to the conditions.
if not in_class:
in_class = stripped.startswith('class ') and 'Parameters' in stripped
continue