blob: 904e79a77bb4acf15dbf08e8d45c2a4cf59b61b6 (
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
|
#include "html_token.hpp"
#include <matte/logger.h>
const char* TOKEN_TO_NAME_MAP[HtmlTokenType_Length] = {
"Text",
"Start Tag",
"End Tag",
"Attribute",
"EOF",
"Character"
};
void HtmlToken::print() {
const char* name = TOKEN_TO_NAME_MAP[type];
switch (type) {
case HtmlTokenType_Character:
logger_info("%s, %c", name, character_token);
break;
case HtmlTokenType_StartTag:
case HtmlTokenType_EndTag:
logger_info("%s, %s", name, tag_name.c_str());
break;
default:
logger_info("%s", name);
}
}
void HtmlToken::reset() {
type = HtmlTokenType_None;
tag_name.clear();
}
|