fix(html/parser): Fix span of lexer errors (#4846)

This commit is contained in:
Alexander Akait 2022-05-31 06:50:19 +03:00 committed by GitHub
parent 7bfba69728
commit f830726027
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
65 changed files with 2493 additions and 305 deletions

View File

@ -159,9 +159,8 @@ where
input: I,
cur: Option<char>,
cur_pos: BytePos,
start_pos: BytePos,
/// Used to override last_pos
last_pos: Option<BytePos>,
last_token_pos: BytePos,
last_emitted_error_pos: Option<BytePos>,
finished: bool,
state: State,
return_state: State,
@ -176,7 +175,6 @@ where
temporary_buffer: String,
is_adjusted_current_node_is_element_in_html_namespace: Option<bool>,
doctype_keyword: Option<String>,
last_emitted_error_pos: Option<BytePos>,
}
impl<I> Lexer<I>
@ -190,8 +188,8 @@ where
input,
cur: None,
cur_pos: start_pos,
start_pos,
last_pos: None,
last_token_pos: start_pos,
last_emitted_error_pos: None,
finished: false,
state: State::Data,
return_state: State::Data,
@ -207,7 +205,6 @@ where
temporary_buffer: String::with_capacity(8),
is_adjusted_current_node_is_element_in_html_namespace: None,
doctype_keyword: None,
last_emitted_error_pos: None,
};
// A leading Byte Order Mark (BOM) causes the character encoding argument to be
@ -271,34 +268,43 @@ where
self.input.cur()
}
// Any occurrences of surrogates are surrogate-in-input-stream parse errors. Any
// occurrences of noncharacters are noncharacter-in-input-stream parse errors
// and any occurrences of controls other than ASCII whitespace and U+0000 NULL
// characters are control-character-in-input-stream parse errors.
fn validate_input_stream_character(&mut self, c: char) {
let code = c as u32;
if (0xd800..=0xdfff).contains(&code)
&& (self.last_emitted_error_pos.is_none()
|| self.last_emitted_error_pos < Some(self.cur_pos))
{
self.emit_error(ErrorKind::SurrogateInInputStream);
self.last_emitted_error_pos = Some(self.input.cur_pos());
} else if code != 0x00
&& is_control(code)
&& (self.last_emitted_error_pos.is_none()
|| self.last_emitted_error_pos < Some(self.cur_pos))
{
self.emit_error(ErrorKind::ControlCharacterInInputStream);
self.last_emitted_error_pos = Some(self.input.cur_pos());
} else if is_noncharacter(code)
&& (self.last_emitted_error_pos.is_none()
|| self.last_emitted_error_pos < Some(self.cur_pos))
{
self.emit_error(ErrorKind::NoncharacterInInputStream);
self.last_emitted_error_pos = Some(self.input.cur_pos());
}
}
#[inline(always)]
fn consume(&mut self) {
self.cur = self.input.cur();
self.cur_pos = self.input.cur_pos();
// Any occurrences of surrogates are surrogate-in-input-stream parse errors. Any
// occurrences of noncharacters are noncharacter-in-input-stream parse errors
// and any occurrences of controls other than ASCII whitespace and U+0000 NULL
// characters are control-character-in-input-stream parse errors.
if let Some(c) = self.cur {
self.input.bump();
if self.last_emitted_error_pos.is_none()
|| self.last_emitted_error_pos < Some(self.cur_pos)
{
let code = c as u32;
if (0xd800..=0xdfff).contains(&code) {
self.emit_error(ErrorKind::SurrogateInInputStream);
self.last_emitted_error_pos = Some(self.input.cur_pos());
} else if code != 0x00 && is_control(code) {
self.emit_error(ErrorKind::ControlCharacterInInputStream);
self.last_emitted_error_pos = Some(self.input.cur_pos());
} else if is_noncharacter(code) {
self.emit_error(ErrorKind::NoncharacterInInputStream);
self.last_emitted_error_pos = Some(self.input.cur_pos());
}
}
self.validate_input_stream_character(c);
}
}
@ -327,24 +333,27 @@ where
c
}
#[inline(always)]
fn emit_error(&mut self, kind: ErrorKind) {
let end = self.last_pos.take().unwrap_or_else(|| self.input.cur_pos());
let span = Span::new(self.start_pos, end, Default::default());
self.errors.push(Error::new(span, kind));
self.errors.push(Error::new(
Span::new(self.cur_pos, self.input.cur_pos(), Default::default()),
kind,
));
}
#[inline(always)]
fn emit_token(&mut self, token: Token) {
let end = self.last_pos.take().unwrap_or_else(|| self.input.cur_pos());
let span = Span::new(self.start_pos, end, Default::default());
let span = Span::new(
self.last_token_pos,
self.input.cur_pos(),
Default::default(),
);
self.start_pos = end;
let token_and_span = TokenAndSpan { span, token };
self.pending_tokens.push(token_and_span);
self.last_token_pos = self.input.cur_pos();
self.pending_tokens.push(TokenAndSpan { span, token });
}
#[inline(always)]
fn is_consumed_as_part_of_an_attribute(&mut self) -> bool {
matches!(
self.return_state,
@ -358,6 +367,7 @@ where
// tag name of the last start tag to have been emitted from this tokenizer, if
// any. If no start tag has been emitted from this tokenizer, then no end tag
// token is appropriate.
#[inline(always)]
fn current_end_tag_token_is_an_appropriate_end_tag_token(&mut self) -> bool {
if let Some(last_start_tag_name) = &self.last_start_tag_name {
if let Some(Tag {
@ -373,6 +383,7 @@ where
false
}
#[inline(always)]
fn emit_temporary_buffer_as_character_tokens(&mut self) {
for c in self.temporary_buffer.clone().chars() {
self.emit_token(Token::Character {

View File

@ -211,11 +211,6 @@ macro_rules! mtd {
fn $name(&mut self, n: &$T) {
let span = n.span();
// We should not have dummy span in original parsing
if span.lo == BytePos(0) && span.hi == BytePos(0) {
panic!("Broken span");
}
self.handler.struct_span_err(span, stringify!($T)).emit();
n.visit_children_with(self);
@ -961,7 +956,6 @@ fn html5lib_test_tokenizer(input: PathBuf) {
}
};
// TODO validate error positions
assert!(actual_errors
.iter()
.any(|error| *error.kind() == expected_code));

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,5 @@
| <html>
| <head>
| <body>
| <h>
| a="&not="

View File

@ -0,0 +1 @@
<h a=&not=>

View File

@ -0,0 +1,78 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 12,
"ctxt": 0
},
"mode": "quirks",
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 12,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 12,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null
},
{
"type": "Element",
"span": {
"start": 0,
"end": 12,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 12,
"ctxt": 0
},
"tagName": "h",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 4,
"end": 11,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "a",
"value": "&not="
}
],
"children": [],
"content": null
}
],
"content": null
}
],
"content": null
}
]
}

View File

@ -0,0 +1,14 @@
x Unexpected character in unquoted attribute value
,-[$DIR/tests/recovery/attribute/bogus-2/input.html:1:1]
1 | <h a=&not=>
: ^
`----
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
,-[$DIR/tests/recovery/attribute/bogus-2/input.html:1:1]
1 | <h a=&not=>
: ^^^^^^^^^^^
`----
x End of file seen and there were open elements

View File

@ -0,0 +1,28 @@
x Document
,-[$DIR/tests/recovery/attribute/bogus-2/input.html:1:1]
1 | <h a=&not=>
: ^^^^^^^^^^^
`----
x Child
x Element
x Child
,-[$DIR/tests/recovery/attribute/bogus-2/input.html:1:1]
1 | <h a=&not=>
: ^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/attribute/bogus-2/input.html:1:1]
1 | <h a=&not=>
: ^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/attribute/bogus-2/input.html:1:1]
1 | <h a=&not=>
: ^^^^^^^
`----

View File

@ -2,7 +2,7 @@
x Eof in tag
,-[$DIR/tests/recovery/attribute/bogus/input.html:1:1]
1 | <div test="test'></div>
: ^^^^^^^^^^^^^^^^^^^^^^^
: ^
`----
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"

View File

@ -14,7 +14,7 @@
x End tag with attributes
,-[$DIR/tests/recovery/attribute/duplicate/input.html:8:1]
8 | <div></div class="test" class="test-1" class="test-2">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^
`----
x Duplicate attribute
@ -32,7 +32,7 @@
x End tag with trailing solidus
,-[$DIR/tests/recovery/attribute/duplicate/input.html:9:1]
9 | </div/>
: ^^^^^^^
: ^
`----
x Stray end tag "div"

View File

@ -0,0 +1,17 @@
| <html>
| <head>
| <body>
| <div>
| "test"
| "
"
| <a>
| a=""
| "
"
| <div>
| "test"
| "
"
| <z>
| =="=="

View File

@ -0,0 +1,4 @@
<div>test</div>
<a a=>
<div>test</div>
<z ====>

View File

@ -0,0 +1,178 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 48,
"ctxt": 0
},
"mode": "quirks",
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 48,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 6,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null
},
{
"type": "Element",
"span": {
"start": 0,
"end": 48,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 10,
"ctxt": 0
},
"tagName": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 6,
"end": 10,
"ctxt": 0
},
"value": "test"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 16,
"end": 17,
"ctxt": 0
},
"value": "\n"
},
{
"type": "Element",
"span": {
"start": 17,
"end": 48,
"ctxt": 0
},
"tagName": "a",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "a",
"value": null
}
],
"children": [
{
"type": "Text",
"span": {
"start": 23,
"end": 24,
"ctxt": 0
},
"value": "\n"
},
{
"type": "Element",
"span": {
"start": 24,
"end": 33,
"ctxt": 0
},
"tagName": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 29,
"end": 33,
"ctxt": 0
},
"value": "test"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 39,
"end": 40,
"ctxt": 0
},
"value": "\n"
},
{
"type": "Element",
"span": {
"start": 40,
"end": 48,
"ctxt": 0
},
"tagName": "z",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 43,
"end": 47,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "=",
"value": "=="
}
],
"children": [],
"content": null
}
],
"content": null
}
],
"content": null
}
],
"content": null
}
]
}

View File

@ -0,0 +1,32 @@
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | <div>test</div>
: ^^^^^
`----
x Missing attribute value
,-[$DIR/tests/recovery/attribute/missing-value/input.html:2:1]
2 | <a a=>
: ^
`----
x Unexpected equals sign before attribute name
,-[$DIR/tests/recovery/attribute/missing-value/input.html:4:1]
4 | <z ====>
: ^
`----
x Unexpected character in unquoted attribute value
,-[$DIR/tests/recovery/attribute/missing-value/input.html:4:1]
4 | <z ====>
: ^
`----
x Unexpected character in unquoted attribute value
,-[$DIR/tests/recovery/attribute/missing-value/input.html:4:1]
4 | <z ====>
: ^
`----
x End of file seen and there were open elements

View File

@ -0,0 +1,140 @@
x Document
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | ,-> <div>test</div>
2 | | <a a=>
3 | | <div>test</div>
4 | `-> <z ====>
`----
x Child
x Element
x Child
x Element
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | <div>test</div>
: ^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | <div>test</div>
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | <div>test</div>
: ^^^^
`----
x Text
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | <div>test</div>
: ^^^^
`----
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | <div>test</div>
: ^
2 | <a a=>
`----
x Text
,-[$DIR/tests/recovery/attribute/missing-value/input.html:1:1]
1 | <div>test</div>
: ^
2 | <a a=>
`----
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:2:1]
2 | ,-> <a a=>
3 | | <div>test</div>
4 | `-> <z ====>
`----
x Element
,-[$DIR/tests/recovery/attribute/missing-value/input.html:2:1]
2 | ,-> <a a=>
3 | | <div>test</div>
4 | `-> <z ====>
`----
x Attribute
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:2:1]
2 | <a a=>
: ^
3 | <div>test</div>
`----
x Text
,-[$DIR/tests/recovery/attribute/missing-value/input.html:2:1]
2 | <a a=>
: ^
3 | <div>test</div>
`----
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:3:1]
3 | <div>test</div>
: ^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/attribute/missing-value/input.html:3:1]
3 | <div>test</div>
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:3:1]
3 | <div>test</div>
: ^^^^
`----
x Text
,-[$DIR/tests/recovery/attribute/missing-value/input.html:3:1]
3 | <div>test</div>
: ^^^^
`----
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:3:1]
3 | <div>test</div>
: ^
4 | <z ====>
`----
x Text
,-[$DIR/tests/recovery/attribute/missing-value/input.html:3:1]
3 | <div>test</div>
: ^
4 | <z ====>
`----
x Child
,-[$DIR/tests/recovery/attribute/missing-value/input.html:4:1]
4 | <z ====>
: ^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/attribute/missing-value/input.html:4:1]
4 | <z ====>
: ^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/attribute/missing-value/input.html:4:1]
4 | <z ====>
: ^^^^
`----

View File

@ -2,7 +2,7 @@
x Eof in comment
,-[$DIR/tests/recovery/comment/bogus-1/input.html:1:1]
1 | <!-- test
: ^^^^^^^^^
: ^
`----
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"

View File

@ -2,7 +2,7 @@
x Eof in comment
,-[$DIR/tests/recovery/comment/bogus-2/input.html:1:1]
1 | <!-- test>
: ^^^^^^^^^^
: ^
`----
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"

View File

@ -8,5 +8,5 @@
x Abrupt closing of empty comment
,-[$DIR/tests/recovery/comment/bogus-3/input.html:1:1]
1 | FOO<!-->BAZ
: ^^^^^
: ^
`----

View File

@ -8,5 +8,5 @@
x Abrupt closing of empty comment
,-[$DIR/tests/recovery/comment/bogus-4/input.html:1:1]
1 | FOO<!-->BAZ
: ^^^^^
: ^
`----

View File

@ -2,7 +2,7 @@
x Incorrectly opened comment
,-[$DIR/tests/recovery/comment/bogus/input.html:1:1]
1 | <! Failing New York Times Comment -->
: ^^^^^
: ^^^
`----
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"

View File

@ -2,7 +2,7 @@
x Cdata in html content
,-[$DIR/tests/recovery/comment/cdata-1/input.html:1:1]
1 | <![CDATA[
: ^^^^^^^^^
: ^
`----
x Start tag seen without seeing a doctype firs, expected "<!DOCTYPE html>"
@ -14,5 +14,5 @@
x Cdata in html content
,-[$DIR/tests/recovery/comment/cdata-1/input.html:10:1]
10 | <![cdata[
: ^^^^^^^^^
: ^
`----

View File

@ -8,7 +8,7 @@
x Cdata in html content
,-[$DIR/tests/recovery/comment/cdata-2/input.html:1:1]
1 | <div><![CDATA[foo]]>
: ^^^^^^^^^
: ^
`----
x End of file seen and there were open elements

View File

@ -2,7 +2,7 @@
x Unexpected question mark instead of tag name
,-[$DIR/tests/recovery/comment/cdata/input.html:1:1]
1 | <?xml version="1.0" encoding="UTF-8"?>
: ^^
: ^
`----
x Non conforming doctype

View File

@ -0,0 +1,37 @@
| <!DOCTYPE html>
| <html>
| lang="en"
| <head>
| "
"
| <meta>
| charset="UTF-8"
| "
"
| <meta>
| content="width=device-width, initial-scale=1.0"
| name="viewport"
| "
"
| <title>
| "Document"
| "
"
| "
"
| <body>
| "
"
| <div>
| "
"
| <!-- ?test -->
| "
"
| <div>
| ="test"=""
| "
"
| "
"

View File

@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>
<?test>
<div ="test"></div>
</div>
</body>
</html>

View File

@ -0,0 +1,303 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 250,
"ctxt": 0
},
"mode": "no-quirks",
"children": [
{
"type": "DocumentType",
"span": {
"start": 1,
"end": 16,
"ctxt": 0
},
"name": "html",
"publicId": null,
"systemId": null
},
{
"type": "Element",
"span": {
"start": 17,
"end": 243,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 23,
"end": 32,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "lang",
"value": "en"
}
],
"children": [
{
"type": "Element",
"span": {
"start": 34,
"end": 171,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 40,
"end": 45,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 45,
"end": 67,
"ctxt": 0
},
"tagName": "meta",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 51,
"end": 66,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "charset",
"value": "UTF-8"
}
],
"children": [],
"content": null
},
{
"type": "Text",
"span": {
"start": 67,
"end": 72,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 72,
"end": 142,
"ctxt": 0
},
"tagName": "meta",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 78,
"end": 93,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "name",
"value": "viewport"
},
{
"type": "Attribute",
"span": {
"start": 94,
"end": 141,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "content",
"value": "width=device-width, initial-scale=1.0"
}
],
"children": [],
"content": null
},
{
"type": "Text",
"span": {
"start": 142,
"end": 147,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 147,
"end": 162,
"ctxt": 0
},
"tagName": "title",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 154,
"end": 162,
"ctxt": 0
},
"value": "Document"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 170,
"end": 171,
"ctxt": 0
},
"value": "\n"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 178,
"end": 179,
"ctxt": 0
},
"value": "\n"
},
{
"type": "Element",
"span": {
"start": 179,
"end": 243,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 185,
"end": 186,
"ctxt": 0
},
"value": "\n"
},
{
"type": "Element",
"span": {
"start": 186,
"end": 228,
"ctxt": 0
},
"tagName": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 191,
"end": 196,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Comment",
"span": {
"start": 196,
"end": 203,
"ctxt": 0
},
"data": "?test"
},
{
"type": "Text",
"span": {
"start": 203,
"end": 208,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 208,
"end": 221,
"ctxt": 0
},
"tagName": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 213,
"end": 220,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "=\"test\"",
"value": null
}
],
"children": [],
"content": null
},
{
"type": "Text",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": "\n"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 234,
"end": 243,
"ctxt": 0
},
"value": "\n\n"
}
],
"content": null
}
],
"content": null
}
]
}

View File

@ -0,0 +1,24 @@
x Unexpected question mark instead of tag name
,-[$DIR/tests/recovery/comment/question-mark/input.html:10:5]
10 | <?test>
: ^
`----
x Unexpected equals sign before attribute name
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^
`----
x Unexpected character in attribute name
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^
`----
x Unexpected character in attribute name
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^
`----

View File

@ -0,0 +1,352 @@
x Document
,-[$DIR/tests/recovery/comment/question-mark/input.html:1:1]
1 | ,-> <!doctype html>
2 | | <html lang="en">
3 | | <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | | <title>Document</title>
7 | | </head>
8 | | <body>
9 | | <div>
10 | | <?test>
11 | | <div ="test"></div>
12 | | </div>
13 | | </body>
14 | `-> </html>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:1:1]
1 | <!doctype html>
: ^^^^^^^^^^^^^^^
`----
x DocumentType
,-[$DIR/tests/recovery/comment/question-mark/input.html:1:1]
1 | <!doctype html>
: ^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:2:1]
2 | ,-> <html lang="en">
3 | | <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | | <title>Document</title>
7 | | </head>
8 | | <body>
9 | | <div>
10 | | <?test>
11 | | <div ="test"></div>
12 | | </div>
13 | `-> </body>
14 | </html>
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:2:1]
2 | ,-> <html lang="en">
3 | | <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | | <title>Document</title>
7 | | </head>
8 | | <body>
9 | | <div>
10 | | <?test>
11 | | <div ="test"></div>
12 | | </div>
13 | `-> </body>
14 | </html>
`----
x Attribute
,-[$DIR/tests/recovery/comment/question-mark/input.html:2:1]
2 | <html lang="en">
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:3:1]
3 | ,-> <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | `-> <title>Document</title>
7 | </head>
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:3:1]
3 | ,-> <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | `-> <title>Document</title>
7 | </head>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:3:1]
3 | ,-> <head>
4 | `-> <meta charset="UTF-8">
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:3:1]
3 | ,-> <head>
4 | `-> <meta charset="UTF-8">
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:4:5]
4 | <meta charset="UTF-8">
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:4:5]
4 | <meta charset="UTF-8">
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/comment/question-mark/input.html:4:5]
4 | <meta charset="UTF-8">
: ^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:4:5]
4 | ,-> <meta charset="UTF-8">
5 | `-> <meta name="viewport" content="width=device-width, initial-scale=1.0">
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:4:5]
4 | ,-> <meta charset="UTF-8">
5 | `-> <meta name="viewport" content="width=device-width, initial-scale=1.0">
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:5:5]
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:5:5]
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/comment/question-mark/input.html:5:5]
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
: ^^^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/comment/question-mark/input.html:5:5]
5 | <meta name="viewport" content="width=device-width, initial-scale=1.0">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:5:5]
5 | ,-> <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | `-> <title>Document</title>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:5:5]
5 | ,-> <meta name="viewport" content="width=device-width, initial-scale=1.0">
6 | `-> <title>Document</title>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:6:5]
6 | <title>Document</title>
: ^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:6:5]
6 | <title>Document</title>
: ^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:6:5]
6 | <title>Document</title>
: ^^^^^^^^
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:6:5]
6 | <title>Document</title>
: ^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:6:5]
6 | <title>Document</title>
: ^
7 | </head>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:6:5]
6 | <title>Document</title>
: ^
7 | </head>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:7:1]
7 | </head>
: ^
8 | <body>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:7:1]
7 | </head>
: ^
8 | <body>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:8:1]
8 | ,-> <body>
9 | | <div>
10 | | <?test>
11 | | <div ="test"></div>
12 | | </div>
13 | `-> </body>
14 | </html>
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:8:1]
8 | ,-> <body>
9 | | <div>
10 | | <?test>
11 | | <div ="test"></div>
12 | | </div>
13 | `-> </body>
14 | </html>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:8:1]
8 | <body>
: ^
9 | <div>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:8:1]
8 | <body>
: ^
9 | <div>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:9:1]
9 | ,-> <div>
10 | | <?test>
11 | `-> <div ="test"></div>
12 | </div>
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:9:1]
9 | ,-> <div>
10 | | <?test>
11 | `-> <div ="test"></div>
12 | </div>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:9:1]
9 | ,-> <div>
10 | `-> <?test>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:9:1]
9 | ,-> <div>
10 | `-> <?test>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:10:5]
10 | <?test>
: ^^^^^^^
`----
x Comment
,-[$DIR/tests/recovery/comment/question-mark/input.html:10:5]
10 | <?test>
: ^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:10:5]
10 | ,-> <?test>
11 | `-> <div ="test"></div>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:10:5]
10 | ,-> <?test>
11 | `-> <div ="test"></div>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^
12 | </div>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:11:5]
11 | <div ="test"></div>
: ^
12 | </div>
`----
x Child
,-[$DIR/tests/recovery/comment/question-mark/input.html:12:1]
12 | ,-> </div>
13 | `-> </body>
14 | </html>
`----
x Text
,-[$DIR/tests/recovery/comment/question-mark/input.html:12:1]
12 | ,-> </div>
13 | `-> </body>
14 | </html>
`----

View File

@ -2,7 +2,7 @@
x Eof in doctype
,-[$DIR/tests/recovery/doctype/eof/input.html:1:1]
1 | <!DOCTYPE
: ^^^^^^^^^
: ^
`----
x Non conforming doctype

View File

@ -1,8 +1,8 @@
x Missing doctype name
,-[$DIR/tests/recovery/doctype/no-doctype-name-line/input.html:1:1]
1 | ,-> <!DOCTYPE
2 | `-> >
,-[$DIR/tests/recovery/doctype/no-doctype-name-line/input.html:2:1]
2 | >
: ^
`----
x Non conforming doctype

View File

@ -2,7 +2,7 @@
x Missing doctype name
,-[$DIR/tests/recovery/doctype/no-doctype-name-space/input.html:1:1]
1 | <!DOCTYPE >
: ^^^^^^^^^^^
: ^
`----
x Non conforming doctype

View File

@ -2,7 +2,7 @@
x Missing quote before doctype system identifier
,-[$DIR/tests/recovery/document_type/bogus/input.html:1:1]
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" SYSTEM "http://www.w3.org/TR/html4/strict.dtd">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
: ^
`----
x Non conforming doctype

View File

@ -2,7 +2,7 @@
x Missing doctype name
,-[$DIR/tests/recovery/document_type/missing-name/input.html:1:1]
1 | <!DOCTYPE>
: ^^^^^^^^^^
: ^
`----
x Non conforming doctype

View File

@ -2,5 +2,5 @@
x Missing whitespace before doctype name
,-[$DIR/tests/recovery/document_type/no-space-before-name/input.html:1:1]
1 | <!doctypehtml> <body> <p>This is a paragraph.</p> <p>This is another paragraph.</p> <div>test</div>
: ^^^^^^^^^^
: ^
`----

View File

@ -2,7 +2,7 @@
x Missing doctype name
,-[$DIR/tests/recovery/document_type/unknown/input.html:1:1]
1 | <!DOCTYPE >Hello
: ^^^^^^^^^^^
: ^
`----
x Non conforming doctype

View File

@ -2,5 +2,5 @@
x Invalid character sequence after doctype name
,-[$DIR/tests/recovery/document_type/wrong-name/input.html:1:1]
1 | <!DOCTYPE html broken>
: ^^^^^^^^^^^^^^^
: ^
`----

View File

@ -8,7 +8,7 @@
x End tag with trailing solidus
,-[$DIR/tests/recovery/element/br/self-closing/input.html:12:5]
12 | test</br/>test
: ^^^^^^
: ^
`----
x End tag "br"

View File

@ -8,29 +8,29 @@
x End tag with attributes
,-[$DIR/tests/recovery/element/broken-end-tags/input.html:17:1]
17 | <div></div test="a">
: ^^^^^^^^^^^^^^^
: ^
`----
x End tag with attributes
,-[$DIR/tests/recovery/element/broken-end-tags/input.html:18:1]
18 | <div data-test="a"></div data-test="a">
: ^^^^^^^^^^^^^^^^^^^^
: ^
`----
x End tag with attributes
,-[$DIR/tests/recovery/element/broken-end-tags/input.html:28:1]
28 | <div>test</div foo="bar" />
: ^^^^^^^^^^^^^^^^^^
: ^
`----
x End tag with trailing solidus
,-[$DIR/tests/recovery/element/broken-end-tags/input.html:28:1]
28 | <div>test</div foo="bar" />
: ^^^^^^^^^^^^^^^^^^
: ^
`----
x End tag with trailing solidus
,-[$DIR/tests/recovery/element/broken-end-tags/input.html:29:1]
29 | <div>test</div/>
: ^^^^^^^
: ^
`----

View File

@ -8,23 +8,23 @@
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/ambiguous-ampersand/input.html:1:1]
1 | <div><a href='?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &'>Link</a><p>Text: ?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &</p></div>
: ^^^^^
: ^
`----
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/ambiguous-ampersand/input.html:1:1]
1 | <div><a href='?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &'>Link</a><p>Text: ?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &</p></div>
: ^^^^
: ^
`----
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/ambiguous-ampersand/input.html:1:1]
1 | <div><a href='?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &'>Link</a><p>Text: ?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &</p></div>
: ^^^^
: ^
`----
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/ambiguous-ampersand/input.html:1:1]
1 | <div><a href='?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &'>Link</a><p>Text: ?a=b&c=d&a0b=c&copy=1&noti=n&not=in&notin=&notin;&not;&;& &</p></div>
: ^^^^
: ^
`----

View File

@ -0,0 +1,4 @@
| <html>
| <head>
| <body>
| "<22>"

View File

@ -0,0 +1,61 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 11,
"ctxt": 0
},
"mode": "quirks",
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 11,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 11,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null
},
{
"type": "Element",
"span": {
"start": 0,
"end": 11,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 1,
"end": 11,
"ctxt": 0
},
"value": "<22>"
}
],
"content": null
}
],
"content": null
}
]
}

View File

@ -0,0 +1,12 @@
x Character reference outside unicode range
,-[$DIR/tests/recovery/text/character-refenrece-outside/input.html:1:1]
1 | &#x110000;
: ^
`----
x Non-space characters found without seeing a doctype first, expected "<!DOCTYPE html>"
,-[$DIR/tests/recovery/text/character-refenrece-outside/input.html:1:1]
1 | &#x110000;
: ^^^^^^^^^^
`----

View File

@ -0,0 +1,22 @@
x Document
,-[$DIR/tests/recovery/text/character-refenrece-outside/input.html:1:1]
1 | &#x110000;
: ^^^^^^^^^^
`----
x Child
x Element
x Child
,-[$DIR/tests/recovery/text/character-refenrece-outside/input.html:1:1]
1 | &#x110000;
: ^^^^^^^^^^
`----
x Text
,-[$DIR/tests/recovery/text/character-refenrece-outside/input.html:1:1]
1 | &#x110000;
: ^^^^^^^^^^
`----

View File

@ -0,0 +1,3 @@
| <html>
| <head>
| <body>

View File

@ -0,0 +1,51 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"mode": "quirks",
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 7,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 7,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null
},
{
"type": "Element",
"span": {
"start": 0,
"end": 7,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null
}
],
"content": null
}
]
}

View File

@ -0,0 +1,8 @@
x Control character reference
,-[$DIR/tests/recovery/text/cr-as-numeric-entity/input.html:1:1]
1 | &#013;
: ^
`----
x End of file seen without seeing a doctype first, expected "<!DOCTYPE html>"

View File

@ -0,0 +1,10 @@
x Document
,-[$DIR/tests/recovery/text/cr-as-numeric-entity/input.html:1:1]
1 | &#013;
: ^^^^^^
`----
x Child
x Element

View File

@ -2,5 +2,5 @@
x Control character reference
,-[$DIR/tests/recovery/text/cr-charref-novalid/input.html:1:1]
1 | <!doctype html><meta charset=utf-8><title>&amp;#x0d;</title><p>There should be an error.&#x0d;
: ^^^^^^
: ^
`----

View File

@ -0,0 +1,4 @@
| <html>
| <head>
| <body>
| "&# &#;"

View File

@ -0,0 +1 @@
&# &#;

View File

@ -0,0 +1,61 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"mode": "quirks",
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 7,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Element",
"span": {
"start": 0,
"end": 4,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [],
"content": null
},
{
"type": "Element",
"span": {
"start": 0,
"end": 7,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"value": "&# &#;"
}
],
"content": null
}
],
"content": null
}
]
}

View File

@ -0,0 +1,18 @@
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/empty-entities/input.html:1:1]
1 | &# &#;
: ^
`----
x Non-space characters found without seeing a doctype first, expected "<!DOCTYPE html>"
,-[$DIR/tests/recovery/text/empty-entities/input.html:1:1]
1 | &# &#;
: ^^^
`----
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/empty-entities/input.html:1:1]
1 | &# &#;
: ^
`----

View File

@ -0,0 +1,26 @@
x Document
,-[$DIR/tests/recovery/text/empty-entities/input.html:1:1]
1 | &# &#;
: ^^^^^^
`----
x Child
x Element
x Child
x Element
x Child
,-[$DIR/tests/recovery/text/empty-entities/input.html:1:1]
1 | &# &#;
: ^^^^^^
`----
x Text
,-[$DIR/tests/recovery/text/empty-entities/input.html:1:1]
1 | &# &#;
: ^^^^^^
`----

View File

@ -2,221 +2,221 @@
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/entity/input.html:7:1]
7 | <div>&reg</div>
: ^^^^
: ^
`----
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/entity/input.html:10:1]
10 | <div>&#q;</div>
: ^^^
: ^
`----
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/entity/input.html:11:1]
11 | <div>&#qq;</div>
: ^^^
: ^
`----
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/entity/input.html:12:1]
12 | <div>&#qqq;</div>
: ^^^
: ^
`----
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/entity/input.html:14:1]
14 | <div>&#xq;</div>
: ^^^^
: ^
`----
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/entity/input.html:15:1]
15 | <div>&#xqq;</div>
: ^^^^
: ^
`----
x Absence of digits in numeric character reference
,-[$DIR/tests/recovery/text/entity/input.html:16:1]
16 | <div>&#xqqq;</div>
: ^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:19:5]
19 | &#x80; 0x20AC EURO SIGN (€)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:20:5]
20 | &#x82; 0x201A SINGLE LOW-9 QUOTATION MARK ()
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:21:5]
21 | &#x83; 0x0192 LATIN SMALL LETTER F WITH HOOK (ƒ)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:22:5]
22 | &#x84; 0x201E DOUBLE LOW-9 QUOTATION MARK („)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:23:5]
23 | &#x85; 0x2026 HORIZONTAL ELLIPSIS (…)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:24:5]
24 | &#x86; 0x2020 DAGGER (†)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:25:5]
25 | &#x87; 0x2021 DOUBLE DAGGER (‡)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:26:5]
26 | &#x88; 0x02C6 MODIFIER LETTER CIRCUMFLEX ACCENT (ˆ)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:27:5]
27 | &#x89; 0x2030 PER MILLE SIGN (‰)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:28:5]
28 | &#x8A; 0x0160 LATIN CAPITAL LETTER S WITH CARON (Š)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:29:5]
29 | &#x8B; 0x2039 SINGLE LEFT-POINTING ANGLE QUOTATION MARK ()
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:30:5]
30 | &#x8C; 0x0152 LATIN CAPITAL LIGATURE OE (Œ)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:31:5]
31 | &#x8E; 0x017D LATIN CAPITAL LETTER Z WITH CARON (Ž)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:32:5]
32 | &#x91; 0x2018 LEFT SINGLE QUOTATION MARK ()
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:33:5]
33 | &#x92; 0x2019 RIGHT SINGLE QUOTATION MARK ()
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:34:5]
34 | &#x93; 0x201C LEFT DOUBLE QUOTATION MARK (“)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:35:5]
35 | &#x94; 0x201D RIGHT DOUBLE QUOTATION MARK (”)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:36:5]
36 | &#x95; 0x2022 BULLET (•)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:37:5]
37 | &#x96; 0x2013 EN DASH ()
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:38:5]
38 | &#x97; 0x2014 EM DASH (—)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:39:5]
39 | &#x98; 0x02DC SMALL TILDE (˜)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:40:5]
40 | &#x99; 0x2122 TRADE MARK SIGN (™)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:41:5]
41 | &#x9A; 0x0161 LATIN SMALL LETTER S WITH CARON (š)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:42:5]
42 | &#x9B; 0x203A SINGLE RIGHT-POINTING ANGLE QUOTATION MARK ()
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:43:5]
43 | &#x9C; 0x0153 LATIN SMALL LIGATURE OE (œ)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:44:5]
44 | &#x9E; 0x017E LATIN SMALL LETTER Z WITH CARON (ž)
: ^^^^^^
: ^
`----
x Control character reference
,-[$DIR/tests/recovery/text/entity/input.html:45:5]
45 | &#x9F; 0x0178 LATIN CAPITAL LETTER Y WITH DIAERESIS (Ÿ)
: ^^^^^^
: ^
`----
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/entity/input.html:48:1]
48 | FOO&#xBAR
: ^^^^^^
: ^
`----
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/entity/input.html:49:1]
49 | FOO&#x41BAR
: ^^^^^^^^
: ^
`----
x Missing semicolon after character reference
,-[$DIR/tests/recovery/text/entity/input.html:50:1]
50 | FOO&#x41ZOO
: ^^^^^^
: ^
`----

View File

@ -0,0 +1,34 @@
| <!DOCTYPE html>
| <html>
| lang="en"
| <head>
| "
"
| <meta>
| charset="UTF-8"
| "
"
| <meta>
| content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
| name="viewport"
| "
"
| <meta>
| content="ie=edge"
| http-equiv="X-UA-Compatible"
| "
"
| <title>
| "Document"
| "
"
| "
"
| <body>
| "
"
| <div>
| "﷐"
| "
"

View File

@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<div></div>
</body>
</html>

View File

@ -0,0 +1,297 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 340,
"ctxt": 0
},
"mode": "no-quirks",
"children": [
{
"type": "DocumentType",
"span": {
"start": 1,
"end": 16,
"ctxt": 0
},
"name": "html",
"publicId": null,
"systemId": null
},
{
"type": "Element",
"span": {
"start": 17,
"end": 333,
"ctxt": 0
},
"tagName": "html",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 23,
"end": 32,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "lang",
"value": "en"
}
],
"children": [
{
"type": "Element",
"span": {
"start": 34,
"end": 295,
"ctxt": 0
},
"tagName": "head",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 40,
"end": 45,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 45,
"end": 67,
"ctxt": 0
},
"tagName": "meta",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 51,
"end": 66,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "charset",
"value": "UTF-8"
}
],
"children": [],
"content": null
},
{
"type": "Text",
"span": {
"start": 67,
"end": 72,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 72,
"end": 208,
"ctxt": 0
},
"tagName": "meta",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 78,
"end": 93,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "name",
"value": "viewport"
},
{
"type": "Attribute",
"span": {
"start": 104,
"end": 207,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "content",
"value": "width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
}
],
"children": [],
"content": null
},
{
"type": "Text",
"span": {
"start": 208,
"end": 213,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 213,
"end": 266,
"ctxt": 0
},
"tagName": "meta",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [
{
"type": "Attribute",
"span": {
"start": 219,
"end": 247,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "http-equiv",
"value": "X-UA-Compatible"
},
{
"type": "Attribute",
"span": {
"start": 248,
"end": 265,
"ctxt": 0
},
"namespace": null,
"prefix": null,
"name": "content",
"value": "ie=edge"
}
],
"children": [],
"content": null
},
{
"type": "Text",
"span": {
"start": 266,
"end": 271,
"ctxt": 0
},
"value": "\n "
},
{
"type": "Element",
"span": {
"start": 271,
"end": 286,
"ctxt": 0
},
"tagName": "title",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 278,
"end": 286,
"ctxt": 0
},
"value": "Document"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 294,
"end": 295,
"ctxt": 0
},
"value": "\n"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 302,
"end": 303,
"ctxt": 0
},
"value": "\n"
},
{
"type": "Element",
"span": {
"start": 303,
"end": 333,
"ctxt": 0
},
"tagName": "body",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 309,
"end": 310,
"ctxt": 0
},
"value": "\n"
},
{
"type": "Element",
"span": {
"start": 310,
"end": 318,
"ctxt": 0
},
"tagName": "div",
"namespace": "http://www.w3.org/1999/xhtml",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 315,
"end": 318,
"ctxt": 0
},
"value": "﷐"
}
],
"content": null
},
{
"type": "Text",
"span": {
"start": 324,
"end": 333,
"ctxt": 0
},
"value": "\n\n"
}
],
"content": null
}
],
"content": null
}
]
}

View File

@ -0,0 +1,6 @@
x Noncharacter in input stream
,-[$DIR/tests/recovery/text/noncharacter/input.html:11:1]
11 | <div>﷐</div>
: ^^^
`----

View File

@ -0,0 +1,323 @@
x Document
,-[$DIR/tests/recovery/text/noncharacter/input.html:1:1]
1 | ,-> <!doctype html>
2 | | <html lang="en">
3 | | <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport"
6 | | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7 | | <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 | | <title>Document</title>
9 | | </head>
10 | | <body>
11 | | <div>﷐</div>
12 | | </body>
13 | `-> </html>
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:1:1]
1 | <!doctype html>
: ^^^^^^^^^^^^^^^
`----
x DocumentType
,-[$DIR/tests/recovery/text/noncharacter/input.html:1:1]
1 | <!doctype html>
: ^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:2:1]
2 | ,-> <html lang="en">
3 | | <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport"
6 | | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7 | | <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 | | <title>Document</title>
9 | | </head>
10 | | <body>
11 | | <div>﷐</div>
12 | `-> </body>
13 | </html>
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:2:1]
2 | ,-> <html lang="en">
3 | | <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport"
6 | | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7 | | <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 | | <title>Document</title>
9 | | </head>
10 | | <body>
11 | | <div>﷐</div>
12 | `-> </body>
13 | </html>
`----
x Attribute
,-[$DIR/tests/recovery/text/noncharacter/input.html:2:1]
2 | <html lang="en">
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:3:1]
3 | ,-> <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport"
6 | | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7 | | <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 | `-> <title>Document</title>
9 | </head>
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:3:1]
3 | ,-> <head>
4 | | <meta charset="UTF-8">
5 | | <meta name="viewport"
6 | | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7 | | <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 | `-> <title>Document</title>
9 | </head>
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:3:1]
3 | ,-> <head>
4 | `-> <meta charset="UTF-8">
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:3:1]
3 | ,-> <head>
4 | `-> <meta charset="UTF-8">
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:4:5]
4 | <meta charset="UTF-8">
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:4:5]
4 | <meta charset="UTF-8">
: ^^^^^^^^^^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/text/noncharacter/input.html:4:5]
4 | <meta charset="UTF-8">
: ^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:4:5]
4 | ,-> <meta charset="UTF-8">
5 | `-> <meta name="viewport"
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:4:5]
4 | ,-> <meta charset="UTF-8">
5 | `-> <meta name="viewport"
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:5:5]
5 | ,-> <meta name="viewport"
6 | `-> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:5:5]
5 | ,-> <meta name="viewport"
6 | `-> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
`----
x Attribute
,-[$DIR/tests/recovery/text/noncharacter/input.html:5:5]
5 | <meta name="viewport"
: ^^^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/text/noncharacter/input.html:6:11]
6 | content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:6:11]
6 | ,-> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7 | `-> <meta http-equiv="X-UA-Compatible" content="ie=edge">
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:6:11]
6 | ,-> content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
7 | `-> <meta http-equiv="X-UA-Compatible" content="ie=edge">
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:7:5]
7 | <meta http-equiv="X-UA-Compatible" content="ie=edge">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:7:5]
7 | <meta http-equiv="X-UA-Compatible" content="ie=edge">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/text/noncharacter/input.html:7:5]
7 | <meta http-equiv="X-UA-Compatible" content="ie=edge">
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Attribute
,-[$DIR/tests/recovery/text/noncharacter/input.html:7:5]
7 | <meta http-equiv="X-UA-Compatible" content="ie=edge">
: ^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:7:5]
7 | ,-> <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 | `-> <title>Document</title>
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:7:5]
7 | ,-> <meta http-equiv="X-UA-Compatible" content="ie=edge">
8 | `-> <title>Document</title>
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:8:5]
8 | <title>Document</title>
: ^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:8:5]
8 | <title>Document</title>
: ^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:8:5]
8 | <title>Document</title>
: ^^^^^^^^
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:8:5]
8 | <title>Document</title>
: ^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:8:5]
8 | <title>Document</title>
: ^
9 | </head>
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:8:5]
8 | <title>Document</title>
: ^
9 | </head>
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:9:1]
9 | </head>
: ^
10 | <body>
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:9:1]
9 | </head>
: ^
10 | <body>
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:10:1]
10 | ,-> <body>
11 | | <div>﷐</div>
12 | `-> </body>
13 | </html>
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:10:1]
10 | ,-> <body>
11 | | <div>﷐</div>
12 | `-> </body>
13 | </html>
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:10:1]
10 | <body>
: ^
11 | <div>﷐</div>
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:10:1]
10 | <body>
: ^
11 | <div>﷐</div>
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:11:1]
11 | <div>﷐</div>
: ^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/text/noncharacter/input.html:11:1]
11 | <div>﷐</div>
: ^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:11:1]
11 | <div>﷐</div>
: ^^^
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:11:1]
11 | <div>﷐</div>
: ^^^
`----
x Child
,-[$DIR/tests/recovery/text/noncharacter/input.html:11:1]
11 | ,-> <div>﷐</div>
12 | `-> </body>
13 | </html>
`----
x Text
,-[$DIR/tests/recovery/text/noncharacter/input.html:11:1]
11 | ,-> <div>﷐</div>
12 | `-> </body>
13 | </html>
`----

View File

@ -2,5 +2,5 @@
x Character reference outside unicode range
,-[$DIR/tests/recovery/text/range-charref-novalid/input.html:1:1]
1 | <!doctype html><meta charset=utf-8><title>&amp;#x110000;</title><p>There should be an error.&#x110000;
: ^^^^^^^^^^
: ^
`----

View File

@ -2,5 +2,5 @@
x Control character reference
,-[$DIR/tests/recovery/text/u000b-charref-novalid/input.html:1:1]
1 | <!doctype html><meta charset=utf-8><title>&amp;#x000B;</title><p>There should be an error.&#x000B;
: ^^^^^^^^
: ^
`----

View File

@ -2,5 +2,5 @@
x Noncharacter character reference
,-[$DIR/tests/recovery/text/unassigned-charref-novalid/input.html:1:1]
1 | <!doctype html><meta charset=utf-8><title>&amp;#xfdd0;</title><p>There should be an error.&#xfdd0;
: ^^^^^^^^
: ^
`----