ParserError.h 655 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
  3. * Copyright (c) 2021-2022, David Tuin <davidot@serenityos.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/DeprecatedString.h>
  9. #include <AK/Error.h>
  10. #include <AK/Optional.h>
  11. #include <AK/String.h>
  12. #include <LibJS/SourceRange.h>
  13. namespace JS {
  14. struct ParserError {
  15. DeprecatedString message;
  16. Optional<Position> position;
  17. ErrorOr<String> to_string() const;
  18. DeprecatedString to_deprecated_string() const;
  19. DeprecatedString source_location_hint(StringView source, char const spacer = ' ', char const indicator = '^') const;
  20. };
  21. }