fix(xml/parser): Fix parsing of pi (#6450)

This commit is contained in:
Alexander Akait 2022-11-16 07:10:02 +03:00 committed by GitHub
parent df7498121a
commit 638892071a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
71 changed files with 2595 additions and 29 deletions

View File

@ -285,8 +285,6 @@ where
processing_instruction.push_str("?>");
write_multiline_raw!(self, n.span, &processing_instruction);
// TODO only for top instructions
newline!(self);
}
fn create_context_for_element(&self, n: &Element) -> Ctx {

View File

@ -22,11 +22,11 @@ macro_rules! write_multiline_raw {
}};
}
macro_rules! newline {
($g:expr) => {{
$g.wr.write_newline()?;
}};
}
// macro_rules! newline {
// ($g:expr) => {{
// $g.wr.write_newline()?;
// }};
// }
macro_rules! formatting_newline {
($g:expr) => {{

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<note>
<?xml version="1.0" encoding="UTF-8"?><note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<note>
<?xml version="1.0" encoding="UTF-8"?><note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>

View File

@ -1,5 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<note>
<?xml version="1.0" encoding="UTF-8"?><note>
<to>Tove</to>
<from>Jani</from>
<heading>Reminder</heading>

View File

@ -91,6 +91,10 @@ impl Error {
"Unexpected colon before attribute name".into()
}
ErrorKind::UnexpectedSolidusInTag => "Unexpected solidus in tag".into(),
ErrorKind::NoTargetNameInProcessingInstruction => "No target name".into(),
ErrorKind::MissingWhitespaceBeforeQuestionInProcessingInstruction => {
"Missing whitespace before '?'".into()
}
// Parser errors
ErrorKind::UnexpectedTokenInStartPhase => "Unexpected token in start phase".into(),
@ -152,6 +156,8 @@ pub enum ErrorKind {
UnexpectedCharacterAfterDoctypeSystemIdentifier,
UnexpectedColonBeforeAttributeName,
UnexpectedSolidusInTag,
NoTargetNameInProcessingInstruction,
MissingWhitespaceBeforeQuestionInProcessingInstruction,
// Parser errors
UnexpectedTokenInStartPhase,

View File

@ -19,9 +19,10 @@ pub enum State {
EndTagNameAfter,
Pi,
PiTarget,
PiTargetQuestion,
PiTargetAfter,
PiData,
PiAfter,
PiEnd,
MarkupDeclaration,
CommentStart,
CommentStartDash,
@ -1166,15 +1167,26 @@ where
// U+000A LINE FEED (LF)
// U+0020 SPACE
// EOF
// Parse error. Reprocess the current input character in the bogus comment
// state.
// Parse error.
// Switch to the pi target after state.
Some(c) if is_spacy_except_ff(c) => {
self.emit_error(ErrorKind::InvalidCharacterOfProcessingInstruction);
self.reconsume_in_state(State::BogusComment);
self.create_processing_instruction_token();
self.state = State::PiTargetAfter;
}
None => {
self.emit_error(ErrorKind::EofInTag);
self.reconsume_in_state(State::BogusComment);
self.emit_error(ErrorKind::EofInProcessingInstruction);
self.create_processing_instruction_token();
self.emit_current_processing_instruction();
self.reconsume_in_state(State::Data);
}
// U+003F QUESTION MARK(?)
// Emit error
// Reprocess the current input character in the pi end state (recovery mode).
Some('?') => {
self.emit_error(ErrorKind::NoTargetNameInProcessingInstruction);
self.create_processing_instruction_token();
self.state = State::PiEnd;
}
Some(c) => {
self.validate_input_stream_character(c);
@ -1190,7 +1202,7 @@ where
// U+0009 CHARACTER TABULATION (tab)
// U+000A LINE FEED (LF)
// U+0020 SPACE
// Switch to the before attribute name state.
// Switch to the pi target state.
Some(c) if is_spacy_except_ff(c) => {
self.state = State::PiTargetAfter;
}
@ -1203,9 +1215,9 @@ where
self.reconsume_in_state(State::Data);
}
// U+003F QUESTION MARK(?)
// Switch to the pi after state.
// Switch to the pi target question.
Some('?') => {
self.state = State::PiAfter;
self.state = State::PiTargetQuestion;
}
// Anything else
// Append the current input character to the processing instruction target and
@ -1216,6 +1228,27 @@ where
}
}
}
State::PiTargetQuestion => {
// Consume the next input character:
match self.consume_next_char() {
// U+003E GREATER-THAN SIGN (>)
Some('>') => {
self.reconsume_in_state(State::PiEnd);
}
_ => {
self.errors.push(Error::new(
Span::new(
self.cur_pos - BytePos(1),
self.input.cur_pos() - BytePos(1),
Default::default(),
),
ErrorKind::MissingWhitespaceBeforeQuestionInProcessingInstruction,
));
self.set_processing_instruction_token(None, Some('?'));
self.reconsume_in_state(State::PiData);
}
}
}
State::PiTargetAfter => {
// Consume the next input character:
match self.consume_next_char() {
@ -1239,7 +1272,7 @@ where
// U+003F QUESTION MARK(?)
// Switch to the pi after state.
Some('?') => {
self.state = State::PiAfter;
self.state = State::PiEnd;
}
// EOF
// Parse error. Emit the current processing instruction token and then reprocess
@ -1258,7 +1291,7 @@ where
}
}
}
State::PiAfter => {
State::PiEnd => {
// Consume the next input character:
match self.consume_next_char() {
// U+003E GREATER-THAN SIGN (>)
@ -1267,15 +1300,18 @@ where
self.emit_current_processing_instruction();
self.state = State::Data;
}
// U+003F QUESTION MARK(?)
// Append the current input character to the PIs data and stay in the current
// state.
Some(c @ '?') => {
self.set_processing_instruction_token(None, Some(c));
// EOF
// Parse error. Emit the current processing instruction token and then reprocess
// the current input character in the data state.
None => {
self.emit_error(ErrorKind::EofInProcessingInstruction);
self.emit_current_processing_instruction();
self.reconsume_in_state(State::Data);
}
// Anything else
// Reprocess the current input character in the pi data state.
_ => {
self.set_processing_instruction_token(None, Some('?'));
self.reconsume_in_state(State::PiData);
}
}

View File

@ -0,0 +1,70 @@
| <root>
| "
"
<?xslt ma>
| "
"
<?xslt
m>
| "
"
<?xslt >
| "
"
<?xslt >
| "
"
<?xml-stylesheet >
| "
"
<?foo version="1.0">
| "
"
<?foo version='1.0'>
| "
"
<?foo version='1.0' encoding="UTF-8">
| "
"
<?foo version='1.0' encoding='UTF-8'>
| "
"
<?foo version='1.0' encoding='utf-8'>
| "
"
<?foo version='1.0' encoding='EUC-JP'>
| "
"
<?foo version='1.0' encoding='UTF-8' standalone='yes'>
| "
"
<?foo version='1.0' encoding='UTF-8' standalone='no'>
| "
"
<?foo version='1.0' standalone='no'>
| "
"
<?foo version='1.0' standalone='no' >
| "
"
<?foo >
| "
"
<?f ?oo>
| "
"
<?f ?oo?>
| "
"
<?f ?????>
| "
"
<?test aaa >
| "
"
<?test ? >
| "
"
<?test a a a >
| "
"

View File

@ -0,0 +1,25 @@
<root>
<?xslt ma?>
<?xslt
m?>
<?xslt?>
<?xslt ?>
<?xml-stylesheet?>
<?foo version="1.0"?>
<?foo version='1.0'?>
<?foo version='1.0' encoding="UTF-8"?>
<?foo version='1.0' encoding='UTF-8'?>
<?foo version='1.0' encoding='utf-8'?>
<?foo version='1.0' encoding='EUC-JP'?>
<?foo version='1.0' encoding='UTF-8' standalone='yes'?>
<?foo version='1.0' encoding='UTF-8' standalone='no'?>
<?foo version='1.0' standalone='no'?>
<?foo version='1.0' standalone='no' ?>
<?foo?>
<?f ?oo?>
<?f ?oo??>
<?f ??????>
<?test aaa ?>
<?test ? ?>
<?test a a a ?>
</root>

View File

@ -0,0 +1,472 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 648,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 648,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 23,
"ctxt": 0
},
"target": "xslt",
"data": "ma"
},
{
"type": "Text",
"span": {
"start": 23,
"end": 28,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 28,
"end": 50,
"ctxt": 0
},
"target": "xslt\n",
"data": "m"
},
{
"type": "Text",
"span": {
"start": 50,
"end": 55,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 55,
"end": 63,
"ctxt": 0
},
"target": "xslt",
"data": ""
},
{
"type": "Text",
"span": {
"start": 63,
"end": 68,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 68,
"end": 77,
"ctxt": 0
},
"target": "xslt",
"data": ""
},
{
"type": "Text",
"span": {
"start": 77,
"end": 82,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 82,
"end": 100,
"ctxt": 0
},
"target": "xml-stylesheet",
"data": ""
},
{
"type": "Text",
"span": {
"start": 100,
"end": 105,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 105,
"end": 126,
"ctxt": 0
},
"target": "foo",
"data": "version=\"1.0\""
},
{
"type": "Text",
"span": {
"start": 126,
"end": 131,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 131,
"end": 152,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0'"
},
{
"type": "Text",
"span": {
"start": 152,
"end": 157,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 157,
"end": 195,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' encoding=\"UTF-8\""
},
{
"type": "Text",
"span": {
"start": 195,
"end": 200,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 200,
"end": 238,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' encoding='UTF-8'"
},
{
"type": "Text",
"span": {
"start": 238,
"end": 243,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 243,
"end": 281,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' encoding='utf-8'"
},
{
"type": "Text",
"span": {
"start": 281,
"end": 286,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 286,
"end": 325,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' encoding='EUC-JP'"
},
{
"type": "Text",
"span": {
"start": 325,
"end": 330,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 330,
"end": 385,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' encoding='UTF-8' standalone='yes'"
},
{
"type": "Text",
"span": {
"start": 385,
"end": 390,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 390,
"end": 444,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' encoding='UTF-8' standalone='no'"
},
{
"type": "Text",
"span": {
"start": 444,
"end": 449,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 449,
"end": 486,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' standalone='no'"
},
{
"type": "Text",
"span": {
"start": 486,
"end": 491,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 491,
"end": 529,
"ctxt": 0
},
"target": "foo",
"data": "version='1.0' standalone='no' "
},
{
"type": "Text",
"span": {
"start": 529,
"end": 534,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 534,
"end": 541,
"ctxt": 0
},
"target": "foo",
"data": ""
},
{
"type": "Text",
"span": {
"start": 541,
"end": 546,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 546,
"end": 555,
"ctxt": 0
},
"target": "f",
"data": "?oo"
},
{
"type": "Text",
"span": {
"start": 555,
"end": 560,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 560,
"end": 570,
"ctxt": 0
},
"target": "f",
"data": "?oo?"
},
{
"type": "Text",
"span": {
"start": 570,
"end": 575,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 575,
"end": 586,
"ctxt": 0
},
"target": "f",
"data": "?????"
},
{
"type": "Text",
"span": {
"start": 586,
"end": 591,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 591,
"end": 604,
"ctxt": 0
},
"target": "test",
"data": "aaa "
},
{
"type": "Text",
"span": {
"start": 604,
"end": 609,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 609,
"end": 620,
"ctxt": 0
},
"target": "test",
"data": "? "
},
{
"type": "Text",
"span": {
"start": 620,
"end": 625,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 625,
"end": 640,
"ctxt": 0
},
"target": "test",
"data": "a a a "
},
{
"type": "Text",
"span": {
"start": 640,
"end": 641,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,629 @@
x Document
,-[$DIR/tests/fixture/pi/input.xml:1:1]
1 | ,-> <root>
2 | | <?xslt ma?>
3 | | <?xslt
4 | | m?>
5 | | <?xslt?>
6 | | <?xslt ?>
7 | | <?xml-stylesheet?>
8 | | <?foo version="1.0"?>
9 | | <?foo version='1.0'?>
10 | | <?foo version='1.0' encoding="UTF-8"?>
11 | | <?foo version='1.0' encoding='UTF-8'?>
12 | | <?foo version='1.0' encoding='utf-8'?>
13 | | <?foo version='1.0' encoding='EUC-JP'?>
14 | | <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
15 | | <?foo version='1.0' encoding='UTF-8' standalone='no'?>
16 | | <?foo version='1.0' standalone='no'?>
17 | | <?foo version='1.0' standalone='no' ?>
18 | | <?foo?>
19 | | <?f ?oo?>
20 | | <?f ?oo??>
21 | | <?f ??????>
22 | | <?test aaa ?>
23 | | <?test ? ?>
24 | | <?test a a a ?>
25 | `-> </root>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:1:1]
1 | ,-> <root>
2 | | <?xslt ma?>
3 | | <?xslt
4 | | m?>
5 | | <?xslt?>
6 | | <?xslt ?>
7 | | <?xml-stylesheet?>
8 | | <?foo version="1.0"?>
9 | | <?foo version='1.0'?>
10 | | <?foo version='1.0' encoding="UTF-8"?>
11 | | <?foo version='1.0' encoding='UTF-8'?>
12 | | <?foo version='1.0' encoding='utf-8'?>
13 | | <?foo version='1.0' encoding='EUC-JP'?>
14 | | <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
15 | | <?foo version='1.0' encoding='UTF-8' standalone='no'?>
16 | | <?foo version='1.0' standalone='no'?>
17 | | <?foo version='1.0' standalone='no' ?>
18 | | <?foo?>
19 | | <?f ?oo?>
20 | | <?f ?oo??>
21 | | <?f ??????>
22 | | <?test aaa ?>
23 | | <?test ? ?>
24 | | <?test a a a ?>
25 | `-> </root>
`----
x Element
,-[$DIR/tests/fixture/pi/input.xml:1:1]
1 | ,-> <root>
2 | | <?xslt ma?>
3 | | <?xslt
4 | | m?>
5 | | <?xslt?>
6 | | <?xslt ?>
7 | | <?xml-stylesheet?>
8 | | <?foo version="1.0"?>
9 | | <?foo version='1.0'?>
10 | | <?foo version='1.0' encoding="UTF-8"?>
11 | | <?foo version='1.0' encoding='UTF-8'?>
12 | | <?foo version='1.0' encoding='utf-8'?>
13 | | <?foo version='1.0' encoding='EUC-JP'?>
14 | | <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
15 | | <?foo version='1.0' encoding='UTF-8' standalone='no'?>
16 | | <?foo version='1.0' standalone='no'?>
17 | | <?foo version='1.0' standalone='no' ?>
18 | | <?foo?>
19 | | <?f ?oo?>
20 | | <?f ?oo??>
21 | | <?f ??????>
22 | | <?test aaa ?>
23 | | <?test ? ?>
24 | | <?test a a a ?>
25 | `-> </root>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?xslt ma?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?xslt ma?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:2:5]
2 | <?xslt ma?>
: ^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:2:5]
2 | <?xslt ma?>
: ^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:2:5]
2 | ,-> <?xslt ma?>
3 | `-> <?xslt
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:2:5]
2 | ,-> <?xslt ma?>
3 | `-> <?xslt
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:3:5]
3 | ,-> <?xslt
4 | `-> m?>
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:3:5]
3 | ,-> <?xslt
4 | `-> m?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:4:13]
4 | ,-> m?>
5 | `-> <?xslt?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:4:13]
4 | ,-> m?>
5 | `-> <?xslt?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:5:5]
5 | <?xslt?>
: ^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:5:5]
5 | <?xslt?>
: ^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:5:5]
5 | ,-> <?xslt?>
6 | `-> <?xslt ?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:5:5]
5 | ,-> <?xslt?>
6 | `-> <?xslt ?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:6:5]
6 | <?xslt ?>
: ^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:6:5]
6 | <?xslt ?>
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:6:5]
6 | ,-> <?xslt ?>
7 | `-> <?xml-stylesheet?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:6:5]
6 | ,-> <?xslt ?>
7 | `-> <?xml-stylesheet?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:7:5]
7 | <?xml-stylesheet?>
: ^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:7:5]
7 | <?xml-stylesheet?>
: ^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:7:5]
7 | ,-> <?xml-stylesheet?>
8 | `-> <?foo version="1.0"?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:7:5]
7 | ,-> <?xml-stylesheet?>
8 | `-> <?foo version="1.0"?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:8:5]
8 | <?foo version="1.0"?>
: ^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:8:5]
8 | <?foo version="1.0"?>
: ^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:8:5]
8 | ,-> <?foo version="1.0"?>
9 | `-> <?foo version='1.0'?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:8:5]
8 | ,-> <?foo version="1.0"?>
9 | `-> <?foo version='1.0'?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:9:5]
9 | <?foo version='1.0'?>
: ^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:9:5]
9 | <?foo version='1.0'?>
: ^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:9:5]
9 | ,-> <?foo version='1.0'?>
10 | `-> <?foo version='1.0' encoding="UTF-8"?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:9:5]
9 | ,-> <?foo version='1.0'?>
10 | `-> <?foo version='1.0' encoding="UTF-8"?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:10:5]
10 | <?foo version='1.0' encoding="UTF-8"?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:10:5]
10 | <?foo version='1.0' encoding="UTF-8"?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:10:5]
10 | ,-> <?foo version='1.0' encoding="UTF-8"?>
11 | `-> <?foo version='1.0' encoding='UTF-8'?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:10:5]
10 | ,-> <?foo version='1.0' encoding="UTF-8"?>
11 | `-> <?foo version='1.0' encoding='UTF-8'?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:11:5]
11 | <?foo version='1.0' encoding='UTF-8'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:11:5]
11 | <?foo version='1.0' encoding='UTF-8'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:11:5]
11 | ,-> <?foo version='1.0' encoding='UTF-8'?>
12 | `-> <?foo version='1.0' encoding='utf-8'?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:11:5]
11 | ,-> <?foo version='1.0' encoding='UTF-8'?>
12 | `-> <?foo version='1.0' encoding='utf-8'?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:12:5]
12 | <?foo version='1.0' encoding='utf-8'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:12:5]
12 | <?foo version='1.0' encoding='utf-8'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:12:5]
12 | ,-> <?foo version='1.0' encoding='utf-8'?>
13 | `-> <?foo version='1.0' encoding='EUC-JP'?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:12:5]
12 | ,-> <?foo version='1.0' encoding='utf-8'?>
13 | `-> <?foo version='1.0' encoding='EUC-JP'?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:13:5]
13 | <?foo version='1.0' encoding='EUC-JP'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:13:5]
13 | <?foo version='1.0' encoding='EUC-JP'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:13:5]
13 | ,-> <?foo version='1.0' encoding='EUC-JP'?>
14 | `-> <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:13:5]
13 | ,-> <?foo version='1.0' encoding='EUC-JP'?>
14 | `-> <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:14:5]
14 | <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:14:5]
14 | <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:14:5]
14 | ,-> <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
15 | `-> <?foo version='1.0' encoding='UTF-8' standalone='no'?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:14:5]
14 | ,-> <?foo version='1.0' encoding='UTF-8' standalone='yes'?>
15 | `-> <?foo version='1.0' encoding='UTF-8' standalone='no'?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:15:5]
15 | <?foo version='1.0' encoding='UTF-8' standalone='no'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:15:5]
15 | <?foo version='1.0' encoding='UTF-8' standalone='no'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:15:5]
15 | ,-> <?foo version='1.0' encoding='UTF-8' standalone='no'?>
16 | `-> <?foo version='1.0' standalone='no'?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:15:5]
15 | ,-> <?foo version='1.0' encoding='UTF-8' standalone='no'?>
16 | `-> <?foo version='1.0' standalone='no'?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:16:5]
16 | <?foo version='1.0' standalone='no'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:16:5]
16 | <?foo version='1.0' standalone='no'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:16:5]
16 | ,-> <?foo version='1.0' standalone='no'?>
17 | `-> <?foo version='1.0' standalone='no' ?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:16:5]
16 | ,-> <?foo version='1.0' standalone='no'?>
17 | `-> <?foo version='1.0' standalone='no' ?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:17:5]
17 | <?foo version='1.0' standalone='no' ?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:17:5]
17 | <?foo version='1.0' standalone='no' ?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:17:5]
17 | ,-> <?foo version='1.0' standalone='no' ?>
18 | `-> <?foo?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:17:5]
17 | ,-> <?foo version='1.0' standalone='no' ?>
18 | `-> <?foo?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:18:5]
18 | <?foo?>
: ^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:18:5]
18 | <?foo?>
: ^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:18:5]
18 | ,-> <?foo?>
19 | `-> <?f ?oo?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:18:5]
18 | ,-> <?foo?>
19 | `-> <?f ?oo?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:19:5]
19 | <?f ?oo?>
: ^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:19:5]
19 | <?f ?oo?>
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:19:5]
19 | ,-> <?f ?oo?>
20 | `-> <?f ?oo??>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:19:5]
19 | ,-> <?f ?oo?>
20 | `-> <?f ?oo??>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:20:5]
20 | <?f ?oo??>
: ^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:20:5]
20 | <?f ?oo??>
: ^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:20:5]
20 | ,-> <?f ?oo??>
21 | `-> <?f ??????>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:20:5]
20 | ,-> <?f ?oo??>
21 | `-> <?f ??????>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:21:5]
21 | <?f ??????>
: ^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:21:5]
21 | <?f ??????>
: ^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:21:5]
21 | ,-> <?f ??????>
22 | `-> <?test aaa ?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:21:5]
21 | ,-> <?f ??????>
22 | `-> <?test aaa ?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:22:5]
22 | <?test aaa ?>
: ^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:22:5]
22 | <?test aaa ?>
: ^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:22:5]
22 | ,-> <?test aaa ?>
23 | `-> <?test ? ?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:22:5]
22 | ,-> <?test aaa ?>
23 | `-> <?test ? ?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:23:5]
23 | <?test ? ?>
: ^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:23:5]
23 | <?test ? ?>
: ^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:23:5]
23 | ,-> <?test ? ?>
24 | `-> <?test a a a ?>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:23:5]
23 | ,-> <?test ? ?>
24 | `-> <?test a a a ?>
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:24:5]
24 | <?test a a a ?>
: ^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/fixture/pi/input.xml:24:5]
24 | <?test a a a ?>
: ^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/fixture/pi/input.xml:24:5]
24 | <?test a a a ?>
: ^
25 | </root>
`----
x Text
,-[$DIR/tests/fixture/pi/input.xml:24:5]
24 | <?test a a a ?>
: ^
25 | </root>
`----

View File

@ -0,0 +1,7 @@
| <root>
| "
"
<? ?xml
m>
| "
"

View File

@ -0,0 +1,4 @@
<root>
<??xml
m?>
</root>

View File

@ -0,0 +1,52 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 34,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 34,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 26,
"ctxt": 0
},
"target": "",
"data": "?xml\n m"
},
{
"type": "Text",
"span": {
"start": 26,
"end": 27,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x No target name
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:2:5]
2 | <??xml
: ^
`----

View File

@ -0,0 +1,62 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:1:1]
1 | ,-> <root>
2 | | <??xml
3 | | m?>
4 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:1:1]
1 | ,-> <root>
2 | | <??xml
3 | | m?>
4 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:1:1]
1 | ,-> <root>
2 | | <??xml
3 | | m?>
4 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:1:1]
1 | ,-> <root>
2 | `-> <??xml
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:1:1]
1 | ,-> <root>
2 | `-> <??xml
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:2:5]
2 | ,-> <??xml
3 | `-> m?>
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:2:5]
2 | ,-> <??xml
3 | `-> m?>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:3:5]
3 | m?>
: ^
4 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-1/input.xml:3:5]
3 | m?>
: ^
4 | </root>
`----

View File

@ -0,0 +1,6 @@
| <root>
| "
"
<?foo ?>
| "
"

View File

@ -0,0 +1,3 @@
<root>
<?foo??>
</root>

View File

@ -0,0 +1,52 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 28,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 28,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 20,
"ctxt": 0
},
"target": "foo",
"data": "?"
},
{
"type": "Text",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x Missing whitespace before '?'
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:2:5]
2 | <?foo??>
: ^
`----

View File

@ -0,0 +1,59 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:1:1]
1 | ,-> <root>
2 | | <?foo??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:1:1]
1 | ,-> <root>
2 | | <?foo??>
3 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:1:1]
1 | ,-> <root>
2 | | <?foo??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?foo??>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?foo??>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:2:5]
2 | <?foo??>
: ^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:2:5]
2 | <?foo??>
: ^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:2:5]
2 | <?foo??>
: ^
3 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-10/input.xml:2:5]
2 | <?foo??>
: ^
3 | </root>
`----

View File

@ -0,0 +1,6 @@
| <root>
| "
"
<? ?test?>
| "
"

View File

@ -0,0 +1,3 @@
<root>
<? ?test??>
</root>

View File

@ -0,0 +1,52 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 33,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 33,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 25,
"ctxt": 0
},
"target": "",
"data": "?test?"
},
{
"type": "Text",
"span": {
"start": 25,
"end": 26,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x Invalid character of processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:2:5]
2 | <? ?test??>
: ^
`----

View File

@ -0,0 +1,59 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:1:1]
1 | ,-> <root>
2 | | <? ?test??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:1:1]
1 | ,-> <root>
2 | | <? ?test??>
3 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:1:1]
1 | ,-> <root>
2 | | <? ?test??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:1:1]
1 | ,-> <root>
2 | `-> <? ?test??>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:1:1]
1 | ,-> <root>
2 | `-> <? ?test??>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:2:5]
2 | <? ?test??>
: ^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:2:5]
2 | <? ?test??>
: ^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:2:5]
2 | <? ?test??>
: ^
3 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-11/input.xml:2:5]
2 | <? ?test??>
: ^
3 | </root>
`----

View File

@ -0,0 +1,4 @@
| <root>
| "
"
<? >

View File

@ -0,0 +1,2 @@
<root>
<?

View File

@ -0,0 +1,42 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 14,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 7,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 14,
"ctxt": 0
},
"target": "",
"data": ""
}
]
}
]
}

View File

@ -0,0 +1,12 @@
x Eof in processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:2:5]
2 | <?
: ^
`----
x Unexpected end of file in main phase
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:2:5]
2 | <?
: ^
`----

View File

@ -0,0 +1,42 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:1:1]
1 | <root>
: ^^^^^^
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:1:1]
1 | <root>
: ^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:2:5]
2 | <?
: ^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-12/input.xml:2:5]
2 | <?
: ^^
`----

View File

@ -0,0 +1,8 @@
<?xml version='1.0'encoding='UTF-8'>
| <root>
| "
"
| <foo>
<? foo>
| "
"

View File

@ -0,0 +1,4 @@
<?xml version='1.0'encoding='UTF-8'?>
<root>
<foo><? foo?></foo>
</root>

View File

@ -0,0 +1,74 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 77,
"ctxt": 0
},
"children": [
{
"type": "ProcessingInstruction",
"span": {
"start": 1,
"end": 38,
"ctxt": 0
},
"target": "xml",
"data": "version='1.0'encoding='UTF-8'"
},
{
"type": "Element",
"span": {
"start": 39,
"end": 77,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 45,
"end": 50,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "Element",
"span": {
"start": 50,
"end": 69,
"ctxt": 0
},
"tagName": "foo",
"attributes": [],
"children": [
{
"type": "ProcessingInstruction",
"span": {
"start": 55,
"end": 63,
"ctxt": 0
},
"target": "",
"data": "foo"
}
]
},
{
"type": "Text",
"span": {
"start": 69,
"end": 70,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x Invalid character of processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:3:5]
3 | <foo><? foo?></foo>
: ^
`----

View File

@ -0,0 +1,84 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:1:1]
1 | ,-> <?xml version='1.0'encoding='UTF-8'?>
2 | | <root>
3 | | <foo><? foo?></foo>
4 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:1:1]
1 | <?xml version='1.0'encoding='UTF-8'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:1:1]
1 | <?xml version='1.0'encoding='UTF-8'?>
: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:2:1]
2 | ,-> <root>
3 | | <foo><? foo?></foo>
4 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:2:1]
2 | ,-> <root>
3 | | <foo><? foo?></foo>
4 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:2:1]
2 | ,-> <root>
3 | `-> <foo><? foo?></foo>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:2:1]
2 | ,-> <root>
3 | `-> <foo><? foo?></foo>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:3:5]
3 | <foo><? foo?></foo>
: ^^^^^^^^^^^^^^^^^^^
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:3:5]
3 | <foo><? foo?></foo>
: ^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:3:5]
3 | <foo><? foo?></foo>
: ^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:3:5]
3 | <foo><? foo?></foo>
: ^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:3:5]
3 | <foo><? foo?></foo>
: ^
4 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-2/input.xml:3:5]
3 | <foo><? foo?></foo>
: ^
4 | </root>
`----

View File

@ -0,0 +1 @@
<?xml version='1.0'>

View File

@ -0,0 +1 @@
<?xml version='1.0'

View File

@ -0,0 +1,20 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 20,
"ctxt": 0
},
"children": [
{
"type": "ProcessingInstruction",
"span": {
"start": 1,
"end": 20,
"ctxt": 0
},
"target": "xml",
"data": "version='1.0'"
}
]
}

View File

@ -0,0 +1,12 @@
x Eof in processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-3/input.xml:1:1]
1 | <?xml version='1.0'
: ^
`----
x Unexpected end of file in start phase
,-[$DIR/tests/recovery/pi/bad-pi-3/input.xml:1:1]
1 | <?xml version='1.0'
: ^
`----

View File

@ -0,0 +1,18 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-3/input.xml:1:1]
1 | <?xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-3/input.xml:1:1]
1 | <?xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-3/input.xml:1:1]
1 | <?xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^
`----

View File

@ -0,0 +1 @@
<? xml version='1.0'>

View File

@ -0,0 +1 @@
<? xml version='1.0'

View File

@ -0,0 +1,20 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 21,
"ctxt": 0
},
"children": [
{
"type": "ProcessingInstruction",
"span": {
"start": 1,
"end": 21,
"ctxt": 0
},
"target": "",
"data": "xml version='1.0'"
}
]
}

View File

@ -0,0 +1,18 @@
x Invalid character of processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-4/input.xml:1:1]
1 | <? xml version='1.0'
: ^
`----
x Eof in processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-4/input.xml:1:1]
1 | <? xml version='1.0'
: ^
`----
x Unexpected end of file in start phase
,-[$DIR/tests/recovery/pi/bad-pi-4/input.xml:1:1]
1 | <? xml version='1.0'
: ^
`----

View File

@ -0,0 +1,18 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-4/input.xml:1:1]
1 | <? xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-4/input.xml:1:1]
1 | <? xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-4/input.xml:1:1]
1 | <? xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^^
`----

View File

@ -0,0 +1,6 @@
| <root>
| "
"
<?fo ?o>
| "
"

View File

@ -0,0 +1,3 @@
<root>
<?fo?o?>
</root>

View File

@ -0,0 +1,52 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 28,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 28,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 20,
"ctxt": 0
},
"target": "fo",
"data": "?o"
},
{
"type": "Text",
"span": {
"start": 20,
"end": 21,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x Missing whitespace before '?'
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:2:5]
2 | <?fo?o?>
: ^
`----

View File

@ -0,0 +1,59 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:1:1]
1 | ,-> <root>
2 | | <?fo?o?>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:1:1]
1 | ,-> <root>
2 | | <?fo?o?>
3 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:1:1]
1 | ,-> <root>
2 | | <?fo?o?>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?fo?o?>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?fo?o?>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:2:5]
2 | <?fo?o?>
: ^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:2:5]
2 | <?fo?o?>
: ^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:2:5]
2 | <?fo?o?>
: ^
3 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-5/input.xml:2:5]
2 | <?fo?o?>
: ^
3 | </root>
`----

View File

@ -0,0 +1 @@
<? xml version='1.0'>

View File

@ -0,0 +1 @@
<? xml version='1.0'

View File

@ -0,0 +1,20 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 21,
"ctxt": 0
},
"children": [
{
"type": "ProcessingInstruction",
"span": {
"start": 1,
"end": 21,
"ctxt": 0
},
"target": "",
"data": "xml version='1.0'"
}
]
}

View File

@ -0,0 +1,18 @@
x Invalid character of processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-6/input.xml:1:1]
1 | <? xml version='1.0'
: ^
`----
x Eof in processing instruction
,-[$DIR/tests/recovery/pi/bad-pi-6/input.xml:1:1]
1 | <? xml version='1.0'
: ^
`----
x Unexpected end of file in start phase
,-[$DIR/tests/recovery/pi/bad-pi-6/input.xml:1:1]
1 | <? xml version='1.0'
: ^
`----

View File

@ -0,0 +1,18 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-6/input.xml:1:1]
1 | <? xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-6/input.xml:1:1]
1 | <? xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-6/input.xml:1:1]
1 | <? xml version='1.0'
: ^^^^^^^^^^^^^^^^^^^^
`----

View File

@ -0,0 +1,6 @@
| <root>
| "
"
<? ?foo?>
| "
"

View File

@ -0,0 +1,3 @@
<root>
<??foo??>
</root>

View File

@ -0,0 +1,52 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 29,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 29,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 21,
"ctxt": 0
},
"target": "",
"data": "?foo?"
},
{
"type": "Text",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x No target name
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:2:5]
2 | <??foo??>
: ^
`----

View File

@ -0,0 +1,59 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:1:1]
1 | ,-> <root>
2 | | <??foo??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:1:1]
1 | ,-> <root>
2 | | <??foo??>
3 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:1:1]
1 | ,-> <root>
2 | | <??foo??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:1:1]
1 | ,-> <root>
2 | `-> <??foo??>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:1:1]
1 | ,-> <root>
2 | `-> <??foo??>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:2:5]
2 | <??foo??>
: ^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:2:5]
2 | <??foo??>
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:2:5]
2 | <??foo??>
: ^
3 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-7/input.xml:2:5]
2 | <??foo??>
: ^
3 | </root>
`----

View File

@ -0,0 +1,6 @@
| <root>
| "
"
<? >
| "
"

View File

@ -0,0 +1,3 @@
<root>
<??>
</root>

View File

@ -0,0 +1,52 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 24,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 24,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 16,
"ctxt": 0
},
"target": "",
"data": ""
},
{
"type": "Text",
"span": {
"start": 16,
"end": 17,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x No target name
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:2:5]
2 | <??>
: ^
`----

View File

@ -0,0 +1,59 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:1:1]
1 | ,-> <root>
2 | | <??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:1:1]
1 | ,-> <root>
2 | | <??>
3 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:1:1]
1 | ,-> <root>
2 | | <??>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:1:1]
1 | ,-> <root>
2 | `-> <??>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:1:1]
1 | ,-> <root>
2 | `-> <??>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:2:5]
2 | <??>
: ^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:2:5]
2 | <??>
: ^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:2:5]
2 | <??>
: ^
3 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-8/input.xml:2:5]
2 | <??>
: ^
3 | </root>
`----

View File

@ -0,0 +1,6 @@
| <root>
| "
"
<?foo ? >
| "
"

View File

@ -0,0 +1,3 @@
<root>
<?foo? ?>
</root>

View File

@ -0,0 +1,52 @@
{
"type": "Document",
"span": {
"start": 1,
"end": 29,
"ctxt": 0
},
"children": [
{
"type": "Element",
"span": {
"start": 1,
"end": 29,
"ctxt": 0
},
"tagName": "root",
"attributes": [],
"children": [
{
"type": "Text",
"span": {
"start": 7,
"end": 12,
"ctxt": 0
},
"data": "\n ",
"raw": "\n "
},
{
"type": "ProcessingInstruction",
"span": {
"start": 12,
"end": 21,
"ctxt": 0
},
"target": "foo",
"data": "? "
},
{
"type": "Text",
"span": {
"start": 21,
"end": 22,
"ctxt": 0
},
"data": "\n",
"raw": "\n"
}
]
}
]
}

View File

@ -0,0 +1,6 @@
x Missing whitespace before '?'
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:2:5]
2 | <?foo? ?>
: ^
`----

View File

@ -0,0 +1,59 @@
x Document
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:1:1]
1 | ,-> <root>
2 | | <?foo? ?>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:1:1]
1 | ,-> <root>
2 | | <?foo? ?>
3 | `-> </root>
`----
x Element
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:1:1]
1 | ,-> <root>
2 | | <?foo? ?>
3 | `-> </root>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?foo? ?>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:1:1]
1 | ,-> <root>
2 | `-> <?foo? ?>
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:2:5]
2 | <?foo? ?>
: ^^^^^^^^^
`----
x ProcessingInstruction
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:2:5]
2 | <?foo? ?>
: ^^^^^^^^^
`----
x Child
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:2:5]
2 | <?foo? ?>
: ^
3 | </root>
`----
x Text
,-[$DIR/tests/recovery/pi/bad-pi-9/input.xml:2:5]
2 | <?foo? ?>
: ^
3 | </root>
`----