LibIDL: Parse extended attributes that have () wrapped expressions

This includes things like Exposed and LegacyFactoryFunction.
This commit is contained in:
Andrew Kaster 2022-10-08 16:47:08 -06:00 committed by Andreas Kling
parent 67ceba2e6a
commit 2341294c20
Notes: sideshowbarker 2024-07-17 17:49:11 +09:00

View File

@ -114,7 +114,17 @@ HashMap<String, String> Parser::parse_extended_attributes()
break;
auto name = lexer.consume_until([](auto ch) { return ch == ']' || ch == '=' || ch == ','; });
if (lexer.consume_specific('=')) {
auto value = lexer.consume_until([](auto ch) { return ch == ']' || ch == ','; });
bool did_open_paren = false;
auto value = lexer.consume_until(
[&did_open_paren](auto ch) mutable {
if (ch == '(') {
did_open_paren = true;
return false;
}
if (did_open_paren)
return ch == ')';
return ch == ']' || ch == ',';
});
extended_attributes.set(name, value);
} else {
extended_attributes.set(name, {});