1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Support dictionary-only IDL files

This commit is contained in:
Idan Horowitz 2021-10-01 19:45:59 +03:00 committed by Andreas Kling
parent b888d14e42
commit 43482dfde3

View file

@ -256,17 +256,6 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView
if (lexer.consume_specific('['))
interface->extended_attributes = parse_extended_attributes();
assert_string("interface");
consume_whitespace();
interface->name = lexer.consume_until([](auto ch) { return isspace(ch); });
consume_whitespace();
if (lexer.consume_specific(':')) {
consume_whitespace();
interface->parent_name = lexer.consume_until([](auto ch) { return isspace(ch); });
consume_whitespace();
}
assert_specific('{');
auto parse_type = [&] {
bool unsigned_ = lexer.consume_specific("unsigned");
if (unsigned_)
@ -539,6 +528,17 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView
}
};
if (lexer.consume_specific("interface")) {
consume_whitespace();
interface->name = lexer.consume_until([](auto ch) { return isspace(ch); });
consume_whitespace();
if (lexer.consume_specific(':')) {
consume_whitespace();
interface->parent_name = lexer.consume_until([](auto ch) { return isspace(ch); });
consume_whitespace();
}
assert_specific('{');
for (;;) {
HashMap<String, String> extended_attributes;
@ -604,8 +604,9 @@ static NonnullOwnPtr<Interface> parse_interface(StringView filename, StringView
interface->constructor_class = String::formatted("{}Constructor", interface->name);
interface->prototype_class = String::formatted("{}Prototype", interface->name);
interface->prototype_base_class = String::formatted("{}Prototype", interface->parent_name.is_empty() ? "Object" : interface->parent_name);
consume_whitespace();
}
while (!lexer.is_eof()) {
assert_string("dictionary");
consume_whitespace();