in cbmc_viewer/resultt.py [0:0]
def cbmc_text_sections(text_file):
"""Parse the text output of cbmc property checking into sections"""
sections = EMPTY_SECTIONS
with open(text_file, encoding='utf-8') as blob:
# The blob is an iterator that iterates through the lines of
# the file and throws StopIteration at the end of the file.
next_line = lambda : next(blob).rstrip()
try:
line = next_line()
# Log section is from here to results section
while not line.startswith(RESULTS_SECTION_HEADER):
sections[LOG_SECTION].append(line)
line = next_line()
# Results section is from here to traces section or summary section
# Traces section is optional: generated by `cbmc --trace`
line = next_line() # skip results header
while (not line.startswith(TRACES_SECTION_HEADER) and
not line.startswith(SUMMARY_SECTION_HEADER)):
sections[RESULTS_SECTION].append(line)
line = next_line()
# Traces section is from here to summary section
# Traces section is optional: generated by `cbmc --trace`
if line.startswith(TRACES_SECTION_HEADER):
while not line.startswith(SUMMARY_SECTION_HEADER):
sections[TRACES_SECTION].append(line)
line = next_line()
# Summary section is from here to end of file
while True:
sections[SUMMARY_SECTION].append(line)
line = next_line()
except StopIteration:
return sections