Skip to content

Commit 2cdd613

Browse files
committed
Fix Kaitai match offsets
1 parent 6509dd3 commit 2cdd613

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

polyfile/kaitaimatcher.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def ast_to_matches(ast: RootNode, parent: Match) -> Iterator[Submatch]:
6767
new_node = Submatch(
6868
name=node.name,
6969
match_obj=node.raw_value,
70-
relative_offset=node.start,
70+
relative_offset=node.start - parent.offset,
7171
length=len(node.segment),
7272
parent=parent
7373
)

0 commit comments

Comments
 (0)