Ver Fonte

LibWeb: Add HTMLToken::make_character()

It's tedious to make character tokens manually all the time.
Andreas Kling há 5 anos atrás
pai
commit
4788bcd6f8
1 ficheiros alterados com 8 adições e 0 exclusões
  1. 8 0
      Libraries/LibWeb/Parser/HTMLToken.h

+ 8 - 0
Libraries/LibWeb/Parser/HTMLToken.h

@@ -49,6 +49,14 @@ public:
         EndOfFile,
     };
 
+    static HTMLToken make_character(u32 codepoint)
+    {
+        HTMLToken token;
+        token.m_type = Type::Character;
+        token.m_comment_or_character.data.append(codepoint);
+        return token;
+    }
+
     bool is_doctype() const { return m_type == Type::DOCTYPE; }
     bool is_start_tag() const { return m_type == Type::StartTag; }
     bool is_end_tag() const { return m_type == Type::EndTag; }