2022-11-23 08:39:23 -03: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-02-16 13:03:49 -03:00
|
|
|
#include <AK/Error.h>
|
2022-11-23 08:39:23 -03:00
|
|
|
#include <AK/Optional.h>
|
2026-06-21 14:03:10 -03:00
|
|
|
#include <AK/Utf16String.h>
|
2025-07-19 17:49:30 -03:00
|
|
|
#include <LibJS/Export.h>
|
2022-11-23 08:39:23 -03:00
|
|
|
#include <LibJS/SourceRange.h>
|
|
|
|
|
|
|
|
|
|
namespace JS {
|
|
|
|
|
|
2025-07-19 17:49:30 -03:00
|
|
|
struct JS_API ParserError {
|
2026-06-21 14:03:10 -03:00
|
|
|
Utf16String message;
|
2022-11-23 08:39:23 -03:00
|
|
|
Optional<Position> position;
|
|
|
|
|
|
2026-06-21 14:03:10 -03:00
|
|
|
Utf16String to_utf16_string() const;
|
Libraries: Clean up UTF-16 source text paths
Store parser errors, source range filenames, source code filenames,
module source, and Rust parser errors as UTF-16 where they flow back
into JavaScript-visible strings. Keep byte-oriented source buffers
byte-backed.
Remove temporary PrimitiveString, ByteString, and UTF-8 detours from
JSON, RegExp, module debug logging, print formatting, and tests.
2026-06-21 14:03:19 -03:00
|
|
|
Utf16String source_location_hint(Utf16View const& source, char spacer = ' ', char indicator = '^') const;
|
2022-11-23 08:39:23 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|