diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2022-04-08 17:42:15 +0300 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2022-04-08 19:19:37 +0300 |
commit | 280e99073bb2415f52c991f1ffbc658a1056e521 (patch) | |
tree | 7d6d24808ce50aba1ed7012c531460e877e0fcb9 /Userland | |
parent | 40c40b75519210649628e2a8d8abf05e22792f47 (diff) | |
download | serenity-280e99073bb2415f52c991f1ffbc658a1056e521.zip |
LibGUI: Stop dropping comments between children and end of GML objects
Any left-over comments in the pending_comments vector are now inserted
as sub object children, as these are serialized last and will therefore
show up in their expected location.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGUI/GML/Parser.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGUI/GML/Parser.cpp b/Userland/Libraries/LibGUI/GML/Parser.cpp index 8e6cfcd71b..169f24c8b9 100644 --- a/Userland/Libraries/LibGUI/GML/Parser.cpp +++ b/Userland/Libraries/LibGUI/GML/Parser.cpp @@ -1,6 +1,7 @@ /* * Copyright (c) 2020, Andreas Kling <kling@serenityos.org> * Copyright (c) 2022, kleines Filmröllchen <filmroellchen@serenityos.org> + * Copyright (c) 2022, Idan Horowitz <idan.horowitz@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ @@ -91,6 +92,10 @@ static ErrorOr<NonnullRefPtr<Object>> parse_gml_object(Queue<Token>& tokens) } } + // Insert any left-over comments as sub object children, as these will be serialized last + while (!pending_comments.is_empty()) + TRY(object->add_sub_object_child(pending_comments.take_first())); + if (peek() != Token::Type::RightCurly) return Error::from_string_literal("Expected }}"sv); |