ソースを参照

LibWeb: Add a PARSE_ERROR() macro to the new HTML parser

Unless otherwise stated, we shouldn't stop parsing just because there's
a parse error, so let's allow ourselves to continue.

With this change, we can now tokenize and parse the ACID1 test. :^)
Andreas Kling 5 年 前
コミット
50265858ab
1 ファイル変更6 行追加2 行削除
  1. 6 2
      Libraries/LibWeb/Parser/HTMLDocumentParser.cpp

+ 6 - 2
Libraries/LibWeb/Parser/HTMLDocumentParser.cpp

@@ -41,6 +41,11 @@
         ASSERT_NOT_REACHED(); \
     } while (0)
 
+#define PARSE_ERROR()            \
+    do {                         \
+        dbg() << "Parse error!"; \
+    } while (0)
+
 namespace Web {
 
 HTMLDocumentParser::HTMLDocumentParser(const StringView& input)
@@ -353,8 +358,7 @@ void HTMLDocumentParser::close_a_p_element()
 {
     generate_implied_end_tags("p");
     if (current_node().tag_name() != "p") {
-        // Parse error.
-        TODO();
+        PARSE_ERROR();
     }
     for (;;) {
         auto popped_element = m_stack_of_open_elements.pop();