summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/tokenizer.rs14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs
index db4fda6..6cf930f 100644
--- a/src/tokenizer.rs
+++ b/src/tokenizer.rs
@@ -178,10 +178,16 @@ impl<R: Reader + Position<O>, O: Offset, E: Emitter<O>> Tokenizer<R, O, E> {
/// Just a helper method for the machine.
#[inline]
pub(crate) fn emit_error(&mut self, error: Error) {
- self.emitter.emit_error(
- error,
- self.reader.position() - 1..self.reader.position() - 1,
- );
+ let span = match error {
+ Error::EofBeforeTagName
+ | Error::EofInCdata
+ | Error::EofInComment
+ | Error::EofInDoctype
+ | Error::EofInScriptHtmlCommentLikeText
+ | Error::EofInTag => self.reader.position()..self.reader.position(),
+ _ => self.reader.position() - 1..self.reader.position() - 1,
+ };
+ self.emitter.emit_error(error, span);
}
/// Assuming the _current token_ is an end tag, return true if all of these hold. Return false otherwise.