2022-11-23 06:39:23 -05: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 09:19:34 -05:00
|
|
|
#include <AK/ByteString.h>
|
2023-02-16 11:03:49 -05:00
|
|
|
#include <AK/Error.h>
|
2022-11-23 06:39:23 -05:00
|
|
|
#include <AK/Optional.h>
|
2023-02-16 11:03:49 -05:00
|
|
|
#include <AK/String.h>
|
2022-11-23 06:39:23 -05:00
|
|
|
#include <LibJS/SourceRange.h>
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
|
|
struct ParserError {
|
2023-12-16 09:19:34 -05:00
|
|
|
ByteString message;
|
2022-11-23 06:39:23 -05:00
|
|
|
Optional<Position> position;
|
|
|
|
|
2024-04-04 18:39:53 -04:00
|
|
|
String to_string() const;
|
2023-12-16 09:19:34 -05:00
|
|
|
ByteString to_byte_string() const;
|
|
|
|
ByteString source_location_hint(StringView source, char const spacer = ' ', char const indicator = '^') const;
|
2022-11-23 06:39:23 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|