INNER CODE UNIT · Python
extract_osgi
toyota-connected/ivi-homescreen · scripts/gen_config_reference.py:263
def extract_osgi():
# [osgi] / [[osgi.bundles]]. Two read styles, and the at_path().is_*()
# scraper above sees neither reliably: 'priority' is read as
# `const auto node = tbl.at_path("priority"); node.is_string()`, so the
# predicate is not adjacent to the call, and the bounded ints go through
# ReadBoundedInt() with no is_*() at all. Matching only the adjacent form
# would document half the table and quietly miss the rest, which is worse
# than not scraping it: the whole point is that a new key cannot ship
# undocumented.
#
# Keys are namespaced because the flat key space already has 'bundle' as a
# [[view]] key, and [[osgi.bundles]] has its own with a different meaning.
text = OSGI.read_text()
keys = {}
bundle_body = function_body(text, "ParseBundle", OSGI)
for key in re.findall(r'at_path\("([^"]+)"\)[^\n]*?\bis_string\(\)',
bundle_body):