1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

JSSpecCompiler: Parse enumerators in xspec mode

This commit is contained in:
Dan Klishch 2024-01-20 22:10:07 -05:00 committed by Andrew Kaster
parent 3d365326af
commit 990e30f458
13 changed files with 69 additions and 0 deletions

View file

@ -185,6 +185,15 @@ void tokenize_tree(SpecificationParsingContext& ctx, TokenizerState& state, XML:
return;
}
if (element.name == tag_emu_const) {
auto maybe_contents = get_text_contents(child);
if (!maybe_contents.has_value())
report_error("malformed <emu-const> subtree, expected single text child node");
tokens.append({ TokenType::Enumerator, maybe_contents.value_or(""sv), move(child_location) });
return;
}
if (tree_type == TreeType::Header && element.name == tag_span) {
auto element_class = get_attribute_by_name(child, attribute_class);
if (element_class != class_secnum)