Is there a way to get everything parsed so far (kind of like Probe() does) when an error is raised during parsing?
Simple example of what I am looking for:
import construct as cs
Test = cs.Struct(
"a" / cs.Byte,
"b" / cs.Byte,
)
try:
# Only one byte in input
result = Test.parse(b"1")
except Exception as e:
print(e.parsed_so_far)
This would print
I looked around the codebase, and the exceptions raised currently don't contain this information. Maybe there is some other way?
Is there a way to get everything parsed so far (kind of like Probe() does) when an error is raised during parsing?
Simple example of what I am looking for:
This would print
I looked around the codebase, and the exceptions raised currently don't contain this information. Maybe there is some other way?