Formatter.h 418 B

123456789101112131415161718192021222324
  1. /*
  2. * Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Forward.h>
  8. #include <AK/String.h>
  9. #include <LibGUI/GML/AST.h>
  10. #include <LibGUI/GML/Parser.h>
  11. namespace GUI::GML {
  12. inline String format_gml(StringView string)
  13. {
  14. auto ast = parse_gml(string);
  15. if (ast.is_error())
  16. return {};
  17. return ast.value()->to_string();
  18. }
  19. }