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.
26 lines
595 B
C++
26 lines
595 B
C++
/*
|
|
* 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
|
|
|
|
#include <AK/Error.h>
|
|
#include <AK/Optional.h>
|
|
#include <AK/Utf16String.h>
|
|
#include <LibJS/Export.h>
|
|
#include <LibJS/SourceRange.h>
|
|
|
|
namespace JS {
|
|
|
|
struct JS_API ParserError {
|
|
Utf16String message;
|
|
Optional<Position> position;
|
|
|
|
Utf16String to_utf16_string() const;
|
|
Utf16String source_location_hint(Utf16View const& source, char spacer = ' ', char indicator = '^') const;
|
|
};
|
|
|
|
}
|