2022-11-23 11:39:23 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2020, Stephan Unverwerth <s.unverwerth@serenityos.org>
|
|
|
|
* Copyright (c) 2021-2022, David Tuin <davidot@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2023-12-16 14:19:34 +00:00
|
|
|
#include <AK/ByteString.h>
|
2023-02-16 16:03:49 +00:00
|
|
|
#include <AK/Error.h>
|
2022-11-23 11:39:23 +00:00
|
|
|
#include <AK/Optional.h>
|
2023-02-16 16:03:49 +00:00
|
|
|
#include <AK/String.h>
|
2022-11-23 11:39:23 +00:00
|
|
|
#include <LibJS/SourceRange.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
struct ParserError {
|
2023-12-16 14:19:34 +00:00
|
|
|
ByteString message;
|
2022-11-23 11:39:23 +00:00
|
|
|
Optional<Position> position;
|
|
|
|
|
2024-04-04 22:39:53 +00:00
|
|
|
String to_string() const;
|
2023-12-16 14:19:34 +00:00
|
|
|
ByteString to_byte_string() const;
|
|
|
|
ByteString source_location_hint(StringView source, char const spacer = ' ', char const indicator = '^') const;
|
2022-11-23 11:39:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|