- removed cache

- few comptime related changes
This commit is contained in:
2026-01-27 16:04:02 +05:30
parent aca930af41
commit 90c8f6f2fb
11 changed files with 140 additions and 378 deletions

View File

@@ -14,33 +14,31 @@ pub const Token = lexer.Token;
// Inline Tags (tags that are typically inline in HTML)
// ============================================================================
const inline_tags = [_][]const u8{
"a",
"abbr",
"acronym",
"b",
"br",
"code",
"em",
"font",
"i",
"img",
"ins",
"kbd",
"map",
"samp",
"small",
"span",
"strong",
"sub",
"sup",
};
/// Comptime hash map for O(1) inline tag lookup instead of O(19) linear search
const inline_tags_map = std.StaticStringMap(void).initComptime(.{
.{ "a", {} },
.{ "abbr", {} },
.{ "acronym", {} },
.{ "b", {} },
.{ "br", {} },
.{ "code", {} },
.{ "em", {} },
.{ "font", {} },
.{ "i", {} },
.{ "img", {} },
.{ "ins", {} },
.{ "kbd", {} },
.{ "map", {} },
.{ "samp", {} },
.{ "small", {} },
.{ "span", {} },
.{ "strong", {} },
.{ "sub", {} },
.{ "sup", {} },
});
fn isInlineTag(name: []const u8) bool {
for (inline_tags) |tag| {
if (mem.eql(u8, name, tag)) return true;
}
return false;
inline fn isInlineTag(name: []const u8) bool {
return inline_tags_map.has(name);
}
// ============================================================================