From 4058f9b1704322f8185136c2558c2ab96a4d835c Mon Sep 17 00:00:00 2001 From: mattkae Date: Sun, 23 Apr 2023 20:23:54 -0400 Subject: Initial commit with a working parser --- src/html_token.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/html_token.hpp (limited to 'src/html_token.hpp') diff --git a/src/html_token.hpp b/src/html_token.hpp new file mode 100644 index 0000000..ee385ce --- /dev/null +++ b/src/html_token.hpp @@ -0,0 +1,32 @@ +#ifndef HTML_TOKEN_HPP +#define HTML_TOKEN_HPP + +#include +#include "code_point.h" + +enum HtmlTokenType { + HtmlTokenType_None = 0, + HtmlTokenType_StartTag, + HtmlTokenType_EndTag, + HtmlTokenType_Attribute, + HtmlTokenType_EOF, + HtmlTokenType_Character, + HtmlTokenType_Length +}; + +struct HtmlToken { + HtmlTokenType type; + + // TODO: Performance + char character_token; + std::string tag_name; + + void append_to_tag_name(code_point_t c) { + tag_name += c; + } + + void print(); + void reset(); +}; + +#endif -- cgit v1.2.1