Skip to content

Commit 5d49266

Browse files
committed
Fix incorrect error position for unfinished <![CDATA[, <!-- and <!DOCTYPE sequences
All tests fixed
1 parent 490db3c commit 5d49266

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/reader/state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,10 @@ impl ReaderState {
129129
}
130130
}
131131
_ => {
132-
// <!....
133-
// ^^^^^ - `buf` does not contains `<`, but we want to report error at `<`,
134-
// so we move offset to it (+1 for `<`)
135-
self.offset -= 1;
132+
// <!....>
133+
// ^^^^^ - `buf` does not contain `<` and `>`, but `self.offset` is after `>`.
134+
// ^------- We report error at that position, so we need to subtract 2 and buf len
135+
self.offset -= len + 2;
136136
Err(bang_type.to_err())
137137
}
138138
}

0 commit comments

Comments
 (0)