Produce JS-visible string results as UTF-16 at their source, including numeric formatting, BigInt and BigFraction formatting, URI encoding, console formatting, parser errors, regular expression errors, Intl and Temporal records, LibUnicode locale boundaries, and LibWeb bindings. Handle fractional radix formatting through the UTF-16 builder view.
28 lines
660 B
C++
28 lines
660 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/ByteString.h>
|
|
#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;
|
|
ByteString to_byte_string() const;
|
|
ByteString source_location_hint(Utf16View const& source, char spacer = ' ', char indicator = '^') const;
|
|
};
|
|
|
|
}
|