From 55146bd35d3c501f6eac0ec534d26f654a9523f7 Mon Sep 17 00:00:00 2001 From: Diego Date: Sun, 30 Apr 2017 22:14:21 -0700 Subject: [PATCH] Fixing DOCTYPE parse errors --- tokenizer/test2.test | 35 +- tokenizer/test3.test | 2562 ++++++++++++++++++++++++------- tree-construction/doctype01.dat | 32 + 3 files changed, 2077 insertions(+), 552 deletions(-) diff --git a/tokenizer/test2.test b/tokenizer/test2.test index e9bb0680..a9db2b4e 100644 --- a/tokenizer/test2.test +++ b/tokenizer/test2.test @@ -27,15 +27,24 @@ {"description":"DOCTYPE with EOF after PUBLIC", "input":"", @@ -47,19 +56,31 @@ {"description":"DOCTYPE with > in double-quoted publicId", "input":"x", -"output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]]}, +"output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]], +"errors": [ + { "code": "abrupt-closing-of-doctype", "col": 24, "line": 1 } +]}, {"description":"DOCTYPE with > in single-quoted publicId", "input":"x", -"output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]]}, +"output":["ParseError", ["DOCTYPE", "html", "", null, false], ["Character", "x"]], +"errors": [ + { "code": "abrupt-closing-of-doctype", "col": 24, "line": 1 } +]}, {"description":"DOCTYPE with > in double-quoted systemId", "input":"x", -"output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]]}, +"output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]], +"errors": [ + { "code": "abrupt-closing-of-doctype", "col": 30, "line": 1 } +]}, {"description":"DOCTYPE with > in single-quoted systemId", "input":"x", -"output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]]}, +"output":["ParseError", ["DOCTYPE", "html", "foo", "", false], ["Character", "x"]], +"errors": [ + { "code": "abrupt-closing-of-doctype", "col": 30, "line": 1 } +]}, {"description":"Incomplete doctype", "input":"", "input":"", -"output":["ParseError", "ParseError", ["DOCTYPE", "a", "", null, false]]}, +"output":["ParseError", "ParseError", ["DOCTYPE", "a", "", null, false]], +"errors": [ + { "code": "missing-whitespace-after-doctype-public-keyword", "col": 19, "line": 1 }, + { "code": "abrupt-closing-of-doctype", "col": 20, "line": 1 } +]}, {"description":"", "input":"", -"output":["ParseError", ["DOCTYPE", "a", "", null, true]]}, +"output":["ParseError", ["DOCTYPE", "a", "", null, true]], +"errors": [ + { "code": "missing-whitespace-after-doctype-public-keyword", "col": 19, "line": 1 } +]}, {"description":"", "input":"", -"output":["ParseError", "ParseError", ["DOCTYPE", "a", "", null, false]]}, +"output":["ParseError", "ParseError", ["DOCTYPE", "a", "", null, false]], +"errors": [ + { "code": "missing-whitespace-after-doctype-public-keyword", "col": 19, "line": 1 }, + { "code": "abrupt-closing-of-doctype", "col": 20, "line": 1 } +]}, {"description":"", "input":"", -"output":["ParseError", ["DOCTYPE", "a", null, null, false]]}, +"output":["ParseError", ["DOCTYPE", "a", null, null, false]], +"errors": [ + { "code": "abrupt-closing-of-doctype", "col": 19, "line": 1 } +]}, {"description":"", "input":"", -"output":["ParseError", "ParseError", ["DOCTYPE", "a", null, "", false]]}, +"output":["ParseError", "ParseError", ["DOCTYPE", "a", null, "", false]], +"errors":[ + { "code": "missing-whitespace-after-doctype-system-keyword", "line": 1, "col": 19 }, + { "code": "abrupt-closing-of-doctype", "col": 20, "line": 1 } +]}, {"description":"", "input":"", -"output":["ParseError", ["DOCTYPE", "a", null, "", true]]}, +"output":["ParseError", ["DOCTYPE", "a", null, "", true]], +"errors":[ + { "code": "missing-whitespace-after-doctype-system-keyword", "line": 1, "col": 19 } +]}, {"description":"", "input":"", -"output":["ParseError", "ParseError", ["DOCTYPE", "a", null, "", false]]}, +"output":["ParseError", "ParseError", ["DOCTYPE", "a", null, "", false]], +"errors":[ + { "code": "missing-whitespace-after-doctype-system-keyword", "line": 1, "col": 19 }, + { "code": "abrupt-closing-of-doctype", "col": 20, "line": 1 } +]}, {"description":"", "input":"", -"output":["ParseError", ["DOCTYPE", "a", null, null, false]]}, +"output":["ParseError", ["DOCTYPE", "a", null, null, false]], +"errors":[ + { "code": "abrupt-closing-of-doctype", "line": 1, "col": 19 } +]}, {"description":"", "input":"", "output":["ParseError", "ParseError", "ParseError", ["DOCTYPE", "a", "", null, false]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "missing-whitespace-after-doctype-public-keyword", "line": 1, "col": 18 }, + { "code": "abrupt-closing-of-doctype", "line": 1, "col": 19 } ]}, {"description":"", "input":"", "output":["ParseError", "ParseError", ["DOCTYPE", "a", "", null, true]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "missing-whitespace-after-doctype-public-keyword", "line": 1, "col": 18 } ]}, {"description":"", "input":"", "output":["ParseError", "ParseError", "ParseError", ["DOCTYPE", "a", "", null, false]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "missing-whitespace-after-doctype-public-keyword", "line": 1, "col": 18 }, + { "code": "abrupt-closing-of-doctype", "line": 1, "col": 19 } ]}, {"description":"", "input":"", "output":["ParseError", "ParseError", ["DOCTYPE", "a", null, null, false]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "abrupt-closing-of-doctype", "line": 1, "col": 18 } ]}, {"description":"", "input":"", "output":["ParseError", "ParseError", "ParseError", ["DOCTYPE", "a", null, "", false]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "missing-whitespace-after-doctype-system-keyword", "line": 1, "col": 18 }, + { "code": "abrupt-closing-of-doctype", "line": 1, "col": 19 } ]}, {"description":"", "input":"", "output":["ParseError", "ParseError", ["DOCTYPE", "a", null, "", true]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "missing-whitespace-after-doctype-system-keyword", "line": 1, "col": 18 } ]}, {"description":"", "input":"", "output":["ParseError", "ParseError", "ParseError", ["DOCTYPE", "a", null, "", false]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "missing-whitespace-after-doctype-system-keyword", "line": 1, "col": 18 }, + { "code": "abrupt-closing-of-doctype", "line": 1, "col": 19 } ]}, {"description":"", "input":"", "output":["ParseError", "ParseError", ["DOCTYPE", "a", null, null, false]], "errors":[ - { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 } + { "code": "missing-whitespace-before-doctype-name", "line": 1, "col": 10 }, + { "code": "abrupt-closing-of-doctype", "line": 1, "col": 18 } ]}, {"description":" | @@ -127,6 +129,8 @@ #errors (1,28): unexpected-char-in-doctype (1,28): unknown-doctype +#new-errors +(1:28) abrupt-closing-of-doctype #document | | @@ -139,6 +143,8 @@ #errors (1,34): unexpected-char-in-doctype (1,37): unknown-doctype +#new-errors +(1:34) missing-quote-before-doctype-system-identifier #document | | @@ -151,6 +157,8 @@ #errors (1,25): unexpected-char-in-doctype (1,31): unknown-doctype +#new-errors +(1:25) missing-quote-before-doctype-system-identifier #document | | @@ -196,6 +204,8 @@ #errors (1,24): unexpected-char-in-doctype (1,34): unknown-doctype +#new-errors +(1:24) missing-quote-before-doctype-system-identifier #document | | @@ -222,6 +232,8 @@ #errors (1,24): unexpected-end-of-doctype (1,24): unknown-doctype +#new-errors +(1:24) abrupt-closing-of-doctype #document | | @@ -234,6 +246,8 @@ #errors (1,25): unexpected-end-of-doctype (1,25): unknown-doctype +#new-errors +(1:25) abrupt-closing-of-doctype #document | | @@ -246,6 +260,8 @@ #errors (1,24): unexpected-char-in-doctype (1,28): unknown-doctype +#new-errors +(1:24) missing-quote-before-doctype-public-identifier #document | | @@ -258,6 +274,8 @@ #errors (1,25): unexpected-char-in-doctype (1,29): unknown-doctype +#new-errors +(1:25) missing-quote-before-doctype-public-identifier #document | | @@ -281,6 +299,8 @@ #errors (1,29): unexpected-char-in-doctype (1,32): unknown-doctype +#new-errors +(1:29) missing-quote-before-doctype-system-identifier #document | | @@ -304,6 +324,8 @@ #errors (1,38): unexpected-char-in-doctype (1,48): unknown-doctype +#new-errors +(1:38) missing-quote-before-doctype-system-identifier #document | | @@ -399,6 +421,8 @@ #errors (1,50): unexpected-char-in-doctype +#new-errors +(1:50) missing-whitespace-between-doctype-public-and-system-identifiers #document | | @@ -409,6 +433,8 @@ #errors (1,50): unexpected-char-in-doctype +#new-errors +(1:50) missing-whitespace-between-doctype-public-and-system-identifiers #document | | @@ -420,6 +446,9 @@ #errors (1,21): unexpected-char-in-doctype (1,49): unexpected-char-in-doctype +#new-errors +(1:22) missing-whitespace-after-doctype-public-keyword +(1:49) missing-whitespace-between-doctype-public-and-system-identifiers #document | | @@ -431,6 +460,9 @@ #errors (1,21): unexpected-char-in-doctype (1,49): unexpected-char-in-doctype +#new-errors +(1:22) missing-whitespace-after-doctype-public-keyword +(1:49) missing-whitespace-between-doctype-public-and-system-identifiers #document | |