summaryrefslogtreecommitdiff
path: root/src/html_token.hpp
blob: ee385cebe972ea7ab605f17448173a13ff9cae8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef HTML_TOKEN_HPP
#define HTML_TOKEN_HPP

#include <string>
#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