From 2341294c205e826ce87db3c47be94ba69e030dc3 Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Sat, 8 Oct 2022 16:47:08 -0600 Subject: [PATCH] LibIDL: Parse extended attributes that have () wrapped expressions This includes things like Exposed and LegacyFactoryFunction. --- Userland/Libraries/LibIDL/IDLParser.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp index c576b0193d..6f840f9b29 100644 --- a/Userland/Libraries/LibIDL/IDLParser.cpp +++ b/Userland/Libraries/LibIDL/IDLParser.cpp @@ -114,7 +114,17 @@ HashMap 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, {});