Skip to content

Commit 6e62741

Browse files
authored
Merge pull request #2 from HTMLParseErrorWG/comments-parse-errors
Comments parse errors
2 parents f06aecd + a74e16a commit 6e62741

File tree

10 files changed

+688
-177
lines changed

10 files changed

+688
-177
lines changed

tokenizer/domjs.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,10 @@
154154
"description":"--!NUL in comment ",
155155
"doubleEscaped":true,
156156
"input":"<!----!\\u0000-->",
157-
"output":["ParseError", "ParseError", ["Comment", "--!\\uFFFD"]]
157+
"output":["ParseError", "ParseError", ["Comment", "--!\\uFFFD"]],
158+
"errors":[
159+
{ "code": "unexpected-null-character", "line": 1, "col": 8 }
160+
]
158161
},
159162
{
160163
"description":"space EOF after doctype ",

tokenizer/escapeFlag.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"initialStates":["RCDATA state", "RAWTEXT state"],
1717
"lastStartTag":"xmp",
1818
"input":"foo<!--></xmp><!-->baz</xmp>",
19-
"output":[["Character", "foo<!-->"], ["EndTag", "xmp"], "ParseError", ["Comment", ""], ["Character", "baz"], ["EndTag", "xmp"]]},
19+
"output":[["Character", "foo<!-->"], ["EndTag", "xmp"], "ParseError", ["Comment", ""], ["Character", "baz"], ["EndTag", "xmp"]],
20+
"errors":[
21+
{ "code": "abrupt-comment", "line": 1, "col": 19 }
22+
]},
2023

2124
{"description":"Commented entities in RCDATA",
2225
"initialStates":["RCDATA state"],

tokenizer/pendingSpecChanges.test

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
{"description":"<!---- >",
44
"input":"<!---- >",
5-
"output":["ParseError", "ParseError", ["Comment","-- >"]]}
6-
5+
"output":["ParseError", "ParseError", ["Comment","-- >"]],
6+
"errors":[
7+
{ "code": "eof-in-comment", "line": 1, "col": 9 }
8+
]}
79
]}

tokenizer/test1.test

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,10 @@
9494

9595
{"description":"Unfinished comment",
9696
"input":"<!--comment",
97-
"output":["ParseError", ["Comment", "comment"]]},
97+
"output":["ParseError", ["Comment", "comment"]],
98+
"errors":[
99+
{ "code": "eof-in-comment", "line": 1, "col": 12 }
100+
]},
98101

99102
{"description":"Start of a comment",
100103
"input":"<!-",
@@ -104,17 +107,30 @@
104107
]},
105108

106109
{"description":"Short comment",
107-
"input":"<!-->",
108-
"output":["ParseError", ["Comment", ""]]},
110+
"input":"<!-->",
111+
"output":["ParseError", ["Comment", ""]],
112+
"errors":[
113+
{ "code": "abrupt-comment", "line": 1, "col": 5 }
114+
]},
115+
109116

110117
{"description":"Short comment two",
111-
"input":"<!--->",
112-
"output":["ParseError", ["Comment", ""]]},
118+
"input":"<!--->",
119+
"output":["ParseError", ["Comment", ""]],
120+
"errors":[
121+
{ "code": "abrupt-comment", "line": 1, "col": 6 }
122+
]},
113123

114124
{"description":"Short comment three",
115125
"input":"<!---->",
116126
"output":[["Comment", ""]]},
117127

128+
{"description":"Nested comment",
129+
"input":"<!-- <!--test-->",
130+
"output":[["Comment", " <!--test"]],
131+
"errors":[
132+
{ "code": "nested-comment", "line": 1, "col": 10 }
133+
]},
118134

119135
{"description":"Ampersand EOF",
120136
"input":"&",

tokenizer/test2.test

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,10 @@
153153

154154
{"description":"Comment with dash",
155155
"input":"<!---x",
156-
"output":["ParseError", ["Comment", "-x"]]},
156+
"output":["ParseError", ["Comment", "-x"]],
157+
"errors":[
158+
{ "code": "eof-in-comment", "line": 1, "col": 7 }
159+
]},
157160

158161
{"description":"Entity + newline",
159162
"input":"\nx\n&gt;\n",

0 commit comments

Comments
 (0)