def parse_text_assumption(block, root=None, wkdir=None): """Parse an assumption in a text trace.""" lines = block.splitlines() srcloc = srcloct.text_srcloc(lines[1], wkdir, root) return { 'kind': 'assumption', 'location': srcloc, 'hidden': False, 'detail': { 'predicate': lines[2].strip() } }
def parse_text_failure(block, root=None, wkdir=None): """Parse a failure in a text trace.""" lines = block.splitlines() srcloc = srcloct.text_srcloc(lines[1], wkdir, root) return { 'kind': 'failure', 'location': srcloc, 'hidden': False, 'detail': { 'property': None, 'reason': lines[2].strip() } }
def parse_text_state(block, root=None, wkdir=None): """Parse the state block in a text trace.""" lines = block.splitlines() srcloc = srcloct.text_srcloc(lines[0], wkdir, root) # assignment may be split over remaining lines in block lhs, rhs_value, rhs_binary = parse_text_assignment(' '.join(lines[2:])) return { 'kind': 'variable-assignment', 'location': srcloc, 'hidden': False, 'detail': { 'lhs': lhs, 'rhs-value': rhs_value, 'rhs-binary': rhs_binary } }