mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 15:57:35 +00:00
AK+Everywhere: Rename String to DeprecatedString
We have a new, improved string type coming up in AK (OOM aware, no null state), and while it's going to use UTF-8, the name UTF8String is a mouthful - so let's free up the String name by renaming the existing class. Making the old one have an annoying name will hopefully also help with quick adoption :^)
This commit is contained in:
parent
f74251606d
commit
6e19ab2bbc
2006 changed files with 11635 additions and 11636 deletions
|
@ -20,14 +20,14 @@ enum class Version {
|
|||
};
|
||||
|
||||
struct Doctype {
|
||||
String type;
|
||||
DeprecatedString type;
|
||||
Vector<MarkupDeclaration> markup_declarations;
|
||||
Optional<ExternalID> external_id;
|
||||
};
|
||||
|
||||
class Document {
|
||||
public:
|
||||
explicit Document(NonnullOwnPtr<Node> root, Optional<Doctype> doctype, HashMap<Name, String> processing_instructions, Version version)
|
||||
explicit Document(NonnullOwnPtr<Node> root, Optional<Doctype> doctype, HashMap<Name, DeprecatedString> processing_instructions, Version version)
|
||||
: m_root(move(root))
|
||||
, m_processing_instructions(move(processing_instructions))
|
||||
, m_version(version)
|
||||
|
@ -38,7 +38,7 @@ public:
|
|||
Node& root() { return *m_root; }
|
||||
Node const& root() const { return *m_root; }
|
||||
|
||||
HashMap<Name, String> const& processing_instructions() const { return m_processing_instructions; }
|
||||
HashMap<Name, DeprecatedString> const& processing_instructions() const { return m_processing_instructions; }
|
||||
|
||||
Version version() const { return m_version; }
|
||||
|
||||
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
private:
|
||||
NonnullOwnPtr<Node> m_root;
|
||||
HashMap<Name, String> m_processing_instructions;
|
||||
HashMap<Name, DeprecatedString> m_processing_instructions;
|
||||
Version m_version;
|
||||
Optional<Doctype> m_explicit_doctype;
|
||||
};
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashTable.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibXML/FundamentalTypes.h>
|
||||
|
@ -73,7 +73,7 @@ struct AttributeListDeclaration {
|
|||
};
|
||||
struct Enumeration {
|
||||
// FIXME: NMToken
|
||||
HashTable<String> tokens;
|
||||
HashTable<DeprecatedString> tokens;
|
||||
};
|
||||
using Type = Variant<StringType, TokenizedType, NotationType, Enumeration>;
|
||||
|
||||
|
@ -82,10 +82,10 @@ struct AttributeListDeclaration {
|
|||
struct Implied {
|
||||
};
|
||||
struct Fixed {
|
||||
String value;
|
||||
DeprecatedString value;
|
||||
};
|
||||
struct DefaultValue {
|
||||
String value;
|
||||
DeprecatedString value;
|
||||
};
|
||||
|
||||
using Default = Variant<Required, Implied, Fixed, DefaultValue>;
|
||||
|
@ -100,11 +100,11 @@ struct AttributeListDeclaration {
|
|||
};
|
||||
|
||||
struct PublicID {
|
||||
String public_literal;
|
||||
DeprecatedString public_literal;
|
||||
};
|
||||
|
||||
struct SystemID {
|
||||
String system_literal;
|
||||
DeprecatedString system_literal;
|
||||
};
|
||||
|
||||
struct ExternalID {
|
||||
|
@ -119,12 +119,12 @@ struct EntityDefinition {
|
|||
|
||||
struct GEDeclaration {
|
||||
Name name;
|
||||
Variant<String, EntityDefinition> definition;
|
||||
Variant<DeprecatedString, EntityDefinition> definition;
|
||||
};
|
||||
|
||||
struct PEDeclaration {
|
||||
Name name;
|
||||
Variant<String, ExternalID> definition;
|
||||
Variant<DeprecatedString, ExternalID> definition;
|
||||
};
|
||||
|
||||
using EntityDeclaration = Variant<GEDeclaration, PEDeclaration>;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/NonnullOwnPtrVector.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/Variant.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibXML/FundamentalTypes.h>
|
||||
|
@ -17,7 +17,7 @@ namespace XML {
|
|||
|
||||
struct Attribute {
|
||||
Name name;
|
||||
String value;
|
||||
DeprecatedString value;
|
||||
};
|
||||
|
||||
struct Node {
|
||||
|
@ -25,11 +25,11 @@ struct Node {
|
|||
StringBuilder builder;
|
||||
};
|
||||
struct Comment {
|
||||
String text;
|
||||
DeprecatedString text;
|
||||
};
|
||||
struct Element {
|
||||
Name name;
|
||||
HashMap<Name, String> attributes;
|
||||
HashMap<Name, DeprecatedString> attributes;
|
||||
NonnullOwnPtrVector<Node> children;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/String.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
|
||||
namespace XML {
|
||||
|
||||
// FIXME: Maybe extend this to something more sophisticated?
|
||||
using Name = String;
|
||||
using Name = DeprecatedString;
|
||||
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ void Parser::append_node(NonnullOwnPtr<Node> node)
|
|||
}
|
||||
}
|
||||
|
||||
void Parser::append_text(String text)
|
||||
void Parser::append_text(DeprecatedString text)
|
||||
{
|
||||
if (m_listener) {
|
||||
m_listener->text(text);
|
||||
|
@ -111,7 +111,7 @@ void Parser::append_text(String text)
|
|||
});
|
||||
}
|
||||
|
||||
void Parser::append_comment(String text)
|
||||
void Parser::append_comment(DeprecatedString text)
|
||||
{
|
||||
if (m_listener) {
|
||||
m_listener->comment(text);
|
||||
|
@ -219,7 +219,7 @@ ErrorOr<void, ParseError> Parser::parse_internal()
|
|||
if (auto it = find_if(matched_source.begin(), matched_source.end(), s_restricted_characters); !it.is_end()) {
|
||||
return parse_error(
|
||||
it.index(),
|
||||
String::formatted("Invalid character #{:x} used in document", *it));
|
||||
DeprecatedString::formatted("Invalid character #{:x} used in document", *it));
|
||||
}
|
||||
|
||||
if (!m_lexer.is_eof())
|
||||
|
@ -234,7 +234,7 @@ ErrorOr<void, ParseError> Parser::expect(StringView expected)
|
|||
|
||||
if (!m_lexer.consume_specific(expected)) {
|
||||
if (m_options.treat_errors_as_fatal)
|
||||
return parse_error(m_lexer.tell(), String::formatted("Expected '{}'", expected));
|
||||
return parse_error(m_lexer.tell(), DeprecatedString::formatted("Expected '{}'", expected));
|
||||
}
|
||||
|
||||
rollback.disarm();
|
||||
|
@ -248,7 +248,7 @@ requires(IsCallableWithArguments<Pred, char>) ErrorOr<StringView, ParseError> Pa
|
|||
auto start = m_lexer.tell();
|
||||
if (!m_lexer.next_is(predicate)) {
|
||||
if (m_options.treat_errors_as_fatal)
|
||||
return parse_error(m_lexer.tell(), String::formatted("Expected {}", description));
|
||||
return parse_error(m_lexer.tell(), DeprecatedString::formatted("Expected {}", description));
|
||||
}
|
||||
|
||||
m_lexer.ignore();
|
||||
|
@ -269,7 +269,7 @@ requires(IsCallableWithArguments<Pred, char>) ErrorOr<StringView, ParseError> Pa
|
|||
|
||||
if (m_lexer.tell() == start) {
|
||||
if (m_options.treat_errors_as_fatal) {
|
||||
return parse_error(m_lexer.tell(), String::formatted("Expected {}", description));
|
||||
return parse_error(m_lexer.tell(), DeprecatedString::formatted("Expected {}", description));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ ErrorOr<void, ParseError> Parser::parse_version_info()
|
|||
m_in_compatibility_mode = true;
|
||||
} else {
|
||||
if (version_string != "1.1" && m_options.treat_errors_as_fatal)
|
||||
return parse_error(m_lexer.tell(), String::formatted("Expected '1.1', found '{}'", version_string));
|
||||
return parse_error(m_lexer.tell(), DeprecatedString::formatted("Expected '1.1', found '{}'", version_string));
|
||||
}
|
||||
|
||||
m_version = Version::Version11;
|
||||
|
@ -495,7 +495,7 @@ ErrorOr<void, ParseError> Parser::parse_processing_instruction()
|
|||
auto accept = accept_rule();
|
||||
|
||||
auto target = TRY(parse_processing_instruction_target());
|
||||
String data;
|
||||
DeprecatedString data;
|
||||
if (auto result = skip_whitespace(Required::Yes); !result.is_error())
|
||||
data = m_lexer.consume_until("?>");
|
||||
TRY(expect("?>"sv));
|
||||
|
@ -572,7 +572,7 @@ ErrorOr<void, ParseError> Parser::parse_doctype_decl()
|
|||
if (resource_result.is_error()) {
|
||||
return parse_error(
|
||||
id_start,
|
||||
String::formatted("Failed to resolve external subset '{}': {}", doctype.external_id->system_id.system_literal, resource_result.error()));
|
||||
DeprecatedString::formatted("Failed to resolve external subset '{}': {}", doctype.external_id->system_id.system_literal, resource_result.error()));
|
||||
}
|
||||
StringView resolved_source = resource_result.value();
|
||||
TemporaryChange source { m_source, resolved_source };
|
||||
|
@ -581,7 +581,7 @@ ErrorOr<void, ParseError> Parser::parse_doctype_decl()
|
|||
if (!m_lexer.is_eof()) {
|
||||
return parse_error(
|
||||
m_lexer.tell(),
|
||||
String::formatted("Failed to resolve external subset '{}': garbage after declarations", doctype.external_id->system_id.system_literal));
|
||||
DeprecatedString::formatted("Failed to resolve external subset '{}': garbage after declarations", doctype.external_id->system_id.system_literal));
|
||||
}
|
||||
doctype.markup_declarations.extend(move(declarations));
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ ErrorOr<NonnullOwnPtr<Node>, ParseError> Parser::parse_empty_element_tag()
|
|||
auto accept = accept_rule();
|
||||
|
||||
auto name = TRY(parse_name());
|
||||
HashMap<Name, String> attributes;
|
||||
HashMap<Name, DeprecatedString> attributes;
|
||||
|
||||
while (true) {
|
||||
if (auto result = skip_whitespace(Required::Yes); result.is_error())
|
||||
|
@ -693,7 +693,7 @@ ErrorOr<Attribute, ParseError> Parser::parse_attribute()
|
|||
}
|
||||
|
||||
// 2.3.10. AttValue, https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-AttValue
|
||||
ErrorOr<String, ParseError> Parser::parse_attribute_value()
|
||||
ErrorOr<DeprecatedString, ParseError> Parser::parse_attribute_value()
|
||||
{
|
||||
auto rollback = rollback_point();
|
||||
auto rule = enter_rule();
|
||||
|
@ -710,7 +710,7 @@ ErrorOr<String, ParseError> Parser::parse_attribute_value()
|
|||
return text;
|
||||
}
|
||||
|
||||
ErrorOr<String, ParseError> Parser::parse_attribute_value_inner(StringView disallow)
|
||||
ErrorOr<DeprecatedString, ParseError> Parser::parse_attribute_value_inner(StringView disallow)
|
||||
{
|
||||
StringBuilder builder;
|
||||
while (true) {
|
||||
|
@ -724,7 +724,7 @@ ErrorOr<String, ParseError> Parser::parse_attribute_value_inner(StringView disal
|
|||
|
||||
if (m_lexer.next_is('&')) {
|
||||
auto reference = TRY(parse_reference());
|
||||
if (auto* char_reference = reference.get_pointer<String>())
|
||||
if (auto* char_reference = reference.get_pointer<DeprecatedString>())
|
||||
builder.append(*char_reference);
|
||||
else
|
||||
builder.append(TRY(resolve_reference(reference.get<EntityReference>(), ReferencePlacement::AttributeValue)));
|
||||
|
@ -739,7 +739,7 @@ ErrorOr<String, ParseError> Parser::parse_attribute_value_inner(StringView disal
|
|||
constexpr static auto s_characters = ranges_for_search<Range(0x1, 0xd7ff), Range(0xe000, 0xfffd), Range(0x10000, 0x10ffff)>();
|
||||
|
||||
// 4.1.67. Reference, https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-Reference
|
||||
ErrorOr<Variant<Parser::EntityReference, String>, ParseError> Parser::parse_reference()
|
||||
ErrorOr<Variant<Parser::EntityReference, DeprecatedString>, ParseError> Parser::parse_reference()
|
||||
{
|
||||
auto rollback = rollback_point();
|
||||
auto rule = enter_rule();
|
||||
|
@ -802,7 +802,7 @@ ErrorOr<NonnullOwnPtr<Node>, ParseError> Parser::parse_start_tag()
|
|||
auto accept = accept_rule();
|
||||
|
||||
auto name = TRY(parse_name());
|
||||
HashMap<Name, String> attributes;
|
||||
HashMap<Name, DeprecatedString> attributes;
|
||||
|
||||
while (true) {
|
||||
if (auto result = skip_whitespace(Required::Yes); result.is_error())
|
||||
|
@ -856,7 +856,7 @@ ErrorOr<void, ParseError> Parser::parse_content()
|
|||
goto try_char_data;
|
||||
if (auto result = parse_reference(); !result.is_error()) {
|
||||
auto reference = result.release_value();
|
||||
if (auto char_reference = reference.get_pointer<String>())
|
||||
if (auto char_reference = reference.get_pointer<DeprecatedString>())
|
||||
append_text(*char_reference);
|
||||
else
|
||||
TRY(resolve_reference(reference.get<EntityReference>(), ReferencePlacement::Content));
|
||||
|
@ -993,7 +993,7 @@ ErrorOr<Optional<MarkupDeclaration>, ParseError> Parser::parse_markup_declaratio
|
|||
}
|
||||
|
||||
// 2.8.28a DeclSep, https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-DeclSep
|
||||
ErrorOr<Optional<String>, ParseError> Parser::parse_declaration_separator()
|
||||
ErrorOr<Optional<DeprecatedString>, ParseError> Parser::parse_declaration_separator()
|
||||
{
|
||||
auto rollback = rollback_point();
|
||||
auto rule = enter_rule();
|
||||
|
@ -1007,7 +1007,7 @@ ErrorOr<Optional<String>, ParseError> Parser::parse_declaration_separator()
|
|||
|
||||
if (auto result = skip_whitespace(Required::Yes); !result.is_error()) {
|
||||
rollback.disarm();
|
||||
return Optional<String> {};
|
||||
return Optional<DeprecatedString> {};
|
||||
}
|
||||
|
||||
return parse_error(m_lexer.tell(), "Expected either whitespace, or a PEReference");
|
||||
|
@ -1143,7 +1143,7 @@ ErrorOr<AttributeListDeclaration::Definition, ParseError> Parser::parse_attribut
|
|||
TRY(expect(")"sv));
|
||||
type = AttributeListDeclaration::NotationType { move(names) };
|
||||
} else {
|
||||
HashTable<String> names;
|
||||
HashTable<DeprecatedString> names;
|
||||
TRY(expect("("sv));
|
||||
TRY(skip_whitespace());
|
||||
names.set(TRY(parse_nm_token()));
|
||||
|
@ -1428,7 +1428,7 @@ ErrorOr<EntityDeclaration, ParseError> Parser::parse_general_entity_declaration(
|
|||
{
|
||||
auto rollback = rollback_point();
|
||||
auto rule = enter_rule();
|
||||
Variant<String, EntityDefinition, Empty> definition;
|
||||
Variant<DeprecatedString, EntityDefinition, Empty> definition;
|
||||
|
||||
// GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'
|
||||
TRY(expect("<!ENTITY"sv));
|
||||
|
@ -1458,7 +1458,7 @@ ErrorOr<EntityDeclaration, ParseError> Parser::parse_general_entity_declaration(
|
|||
rollback.disarm();
|
||||
return GEDeclaration {
|
||||
move(name),
|
||||
move(definition).downcast<String, EntityDefinition>(),
|
||||
move(definition).downcast<DeprecatedString, EntityDefinition>(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1468,7 +1468,7 @@ ErrorOr<EntityDeclaration, ParseError> Parser::parse_parameter_entity_declaratio
|
|||
auto rollback = rollback_point();
|
||||
auto rule = enter_rule();
|
||||
|
||||
Variant<String, ExternalID, Empty> definition;
|
||||
Variant<DeprecatedString, ExternalID, Empty> definition;
|
||||
// PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>'
|
||||
TRY(expect("<!ENTITY"sv));
|
||||
auto accept = accept_rule();
|
||||
|
@ -1490,7 +1490,7 @@ ErrorOr<EntityDeclaration, ParseError> Parser::parse_parameter_entity_declaratio
|
|||
rollback.disarm();
|
||||
return PEDeclaration {
|
||||
move(name),
|
||||
move(definition).downcast<String, ExternalID>(),
|
||||
move(definition).downcast<DeprecatedString, ExternalID>(),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1604,7 +1604,7 @@ ErrorOr<Name, ParseError> Parser::parse_notation_data_declaration()
|
|||
}
|
||||
|
||||
// 2.3.9 EntityValue, https://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EntityValue
|
||||
ErrorOr<String, ParseError> Parser::parse_entity_value()
|
||||
ErrorOr<DeprecatedString, ParseError> Parser::parse_entity_value()
|
||||
{
|
||||
auto rollback = rollback_point();
|
||||
auto rule = enter_rule();
|
||||
|
@ -1699,11 +1699,11 @@ ErrorOr<void, ParseError> Parser::parse_text_declaration()
|
|||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<String, ParseError> Parser::resolve_reference(EntityReference const& reference, ReferencePlacement placement)
|
||||
ErrorOr<DeprecatedString, ParseError> Parser::resolve_reference(EntityReference const& reference, ReferencePlacement placement)
|
||||
{
|
||||
static HashTable<Name> reference_lookup {};
|
||||
if (reference_lookup.contains(reference.name))
|
||||
return parse_error(m_lexer.tell(), String::formatted("Invalid recursive definition for '{}'", reference.name));
|
||||
return parse_error(m_lexer.tell(), DeprecatedString::formatted("Invalid recursive definition for '{}'", reference.name));
|
||||
|
||||
reference_lookup.set(reference.name);
|
||||
ScopeGuard remove_lookup {
|
||||
|
@ -1712,7 +1712,7 @@ ErrorOr<String, ParseError> Parser::resolve_reference(EntityReference const& ref
|
|||
}
|
||||
};
|
||||
|
||||
Optional<String> resolved;
|
||||
Optional<DeprecatedString> resolved;
|
||||
if (m_doctype.has_value()) {
|
||||
// FIXME: Split these up and resolve them ahead of time.
|
||||
for (auto& declaration : m_doctype->markup_declarations) {
|
||||
|
@ -1725,23 +1725,23 @@ ErrorOr<String, ParseError> Parser::resolve_reference(EntityReference const& ref
|
|||
if (ge_declaration->name != reference.name)
|
||||
continue;
|
||||
TRY(ge_declaration->definition.visit(
|
||||
[&](String const& definition) -> ErrorOr<void, ParseError> {
|
||||
[&](DeprecatedString const& definition) -> ErrorOr<void, ParseError> {
|
||||
resolved = definition;
|
||||
return {};
|
||||
},
|
||||
[&](EntityDefinition const& definition) -> ErrorOr<void, ParseError> {
|
||||
if (placement == ReferencePlacement::AttributeValue)
|
||||
return parse_error(m_lexer.tell(), String::formatted("Attribute references external entity '{}'", reference.name));
|
||||
return parse_error(m_lexer.tell(), DeprecatedString::formatted("Attribute references external entity '{}'", reference.name));
|
||||
|
||||
if (definition.notation.has_value())
|
||||
return parse_error(0u, String::formatted("Entity reference to unparsed entity '{}'", reference.name));
|
||||
return parse_error(0u, DeprecatedString::formatted("Entity reference to unparsed entity '{}'", reference.name));
|
||||
|
||||
if (!m_options.resolve_external_resource)
|
||||
return parse_error(0u, String::formatted("Failed to resolve external entity '{}'", reference.name));
|
||||
return parse_error(0u, DeprecatedString::formatted("Failed to resolve external entity '{}'", reference.name));
|
||||
|
||||
auto result = m_options.resolve_external_resource(definition.id.system_id, definition.id.public_id);
|
||||
if (result.is_error())
|
||||
return parse_error(0u, String::formatted("Failed to resolve external entity '{}': {}", reference.name, result.error()));
|
||||
return parse_error(0u, DeprecatedString::formatted("Failed to resolve external entity '{}': {}", reference.name, result.error()));
|
||||
|
||||
resolved = result.release_value();
|
||||
return {};
|
||||
|
@ -1761,7 +1761,7 @@ ErrorOr<String, ParseError> Parser::resolve_reference(EntityReference const& ref
|
|||
return "'";
|
||||
if (reference.name == "quot")
|
||||
return "\"";
|
||||
return parse_error(0u, String::formatted("Reference to undeclared entity '{}'", reference.name));
|
||||
return parse_error(0u, DeprecatedString::formatted("Reference to undeclared entity '{}'", reference.name));
|
||||
}
|
||||
|
||||
StringView resolved_source = *resolved;
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Debug.h>
|
||||
#include <AK/DeprecatedString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/GenericLexer.h>
|
||||
#include <AK/HashMap.h>
|
||||
#include <AK/OwnPtr.h>
|
||||
#include <AK/SourceLocation.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/TemporaryChange.h>
|
||||
#include <LibXML/DOM/Document.h>
|
||||
#include <LibXML/DOM/DocumentTypeDeclaration.h>
|
||||
|
@ -23,19 +23,19 @@ namespace XML {
|
|||
|
||||
struct ParseError {
|
||||
size_t offset;
|
||||
String error;
|
||||
DeprecatedString error;
|
||||
};
|
||||
|
||||
struct Listener {
|
||||
virtual ~Listener() { }
|
||||
|
||||
virtual void set_source(String) { }
|
||||
virtual void set_source(DeprecatedString) { }
|
||||
virtual void document_start() { }
|
||||
virtual void document_end() { }
|
||||
virtual void element_start(Name const&, HashMap<Name, String> const&) { }
|
||||
virtual void element_start(Name const&, HashMap<Name, DeprecatedString> const&) { }
|
||||
virtual void element_end(Name const&) { }
|
||||
virtual void text(String const&) { }
|
||||
virtual void comment(String const&) { }
|
||||
virtual void text(DeprecatedString const&) { }
|
||||
virtual void comment(DeprecatedString const&) { }
|
||||
virtual void error(ParseError const&) { }
|
||||
};
|
||||
|
||||
|
@ -45,7 +45,7 @@ public:
|
|||
bool preserve_cdata { true };
|
||||
bool preserve_comments { false };
|
||||
bool treat_errors_as_fatal { true };
|
||||
Function<ErrorOr<String>(SystemID const&, Optional<PublicID> const&)> resolve_external_resource {};
|
||||
Function<ErrorOr<DeprecatedString>(SystemID const&, Optional<PublicID> const&)> resolve_external_resource {};
|
||||
};
|
||||
|
||||
Parser(StringView source, Options options)
|
||||
|
@ -73,8 +73,8 @@ private:
|
|||
|
||||
ErrorOr<void, ParseError> parse_internal();
|
||||
void append_node(NonnullOwnPtr<Node>);
|
||||
void append_text(String);
|
||||
void append_comment(String);
|
||||
void append_text(DeprecatedString);
|
||||
void append_comment(DeprecatedString);
|
||||
void enter_node(Node&);
|
||||
void leave_node();
|
||||
|
||||
|
@ -82,8 +82,8 @@ private:
|
|||
AttributeValue,
|
||||
Content,
|
||||
};
|
||||
ErrorOr<String, ParseError> resolve_reference(EntityReference const&, ReferencePlacement);
|
||||
ErrorOr<String, ParseError> resolve_parameter_entity_reference(EntityReference const&);
|
||||
ErrorOr<DeprecatedString, ParseError> resolve_reference(EntityReference const&, ReferencePlacement);
|
||||
ErrorOr<DeprecatedString, ParseError> resolve_parameter_entity_reference(EntityReference const&);
|
||||
|
||||
enum class Required {
|
||||
No,
|
||||
|
@ -109,12 +109,12 @@ private:
|
|||
ErrorOr<Name, ParseError> parse_end_tag();
|
||||
ErrorOr<void, ParseError> parse_content();
|
||||
ErrorOr<Attribute, ParseError> parse_attribute();
|
||||
ErrorOr<String, ParseError> parse_attribute_value();
|
||||
ErrorOr<Variant<EntityReference, String>, ParseError> parse_reference();
|
||||
ErrorOr<DeprecatedString, ParseError> parse_attribute_value();
|
||||
ErrorOr<Variant<EntityReference, DeprecatedString>, ParseError> parse_reference();
|
||||
ErrorOr<StringView, ParseError> parse_char_data();
|
||||
ErrorOr<Vector<MarkupDeclaration>, ParseError> parse_internal_subset();
|
||||
ErrorOr<Optional<MarkupDeclaration>, ParseError> parse_markup_declaration();
|
||||
ErrorOr<Optional<String>, ParseError> parse_declaration_separator();
|
||||
ErrorOr<Optional<DeprecatedString>, ParseError> parse_declaration_separator();
|
||||
ErrorOr<Vector<MarkupDeclaration>, ParseError> parse_external_subset_declaration();
|
||||
ErrorOr<ElementDeclaration, ParseError> parse_element_declaration();
|
||||
ErrorOr<AttributeListDeclaration, ParseError> parse_attribute_list_declaration();
|
||||
|
@ -129,12 +129,12 @@ private:
|
|||
ErrorOr<PublicID, ParseError> parse_public_id();
|
||||
ErrorOr<SystemID, ParseError> parse_system_id();
|
||||
ErrorOr<ExternalID, ParseError> parse_external_id();
|
||||
ErrorOr<String, ParseError> parse_entity_value();
|
||||
ErrorOr<DeprecatedString, ParseError> parse_entity_value();
|
||||
ErrorOr<Name, ParseError> parse_notation_data_declaration();
|
||||
ErrorOr<StringView, ParseError> parse_public_id_literal();
|
||||
ErrorOr<StringView, ParseError> parse_system_id_literal();
|
||||
ErrorOr<StringView, ParseError> parse_cdata_section();
|
||||
ErrorOr<String, ParseError> parse_attribute_value_inner(StringView disallow);
|
||||
ErrorOr<DeprecatedString, ParseError> parse_attribute_value_inner(StringView disallow);
|
||||
ErrorOr<Vector<MarkupDeclaration>, ParseError> parse_external_subset();
|
||||
ErrorOr<void, ParseError> parse_text_declaration();
|
||||
|
||||
|
@ -186,7 +186,7 @@ private:
|
|||
rule_name = rule_name.substring_view(6);
|
||||
m_parse_errors.append({
|
||||
error.offset,
|
||||
String::formatted("{}: {}", rule_name, error.error),
|
||||
DeprecatedString::formatted("{}: {}", rule_name, error.error),
|
||||
});
|
||||
}
|
||||
return error;
|
||||
|
@ -201,11 +201,11 @@ private:
|
|||
Node* m_entered_node { nullptr };
|
||||
Version m_version { Version::Version11 };
|
||||
bool m_in_compatibility_mode { false };
|
||||
String m_encoding;
|
||||
DeprecatedString m_encoding;
|
||||
bool m_standalone { false };
|
||||
HashMap<Name, String> m_processing_instructions;
|
||||
HashMap<Name, DeprecatedString> m_processing_instructions;
|
||||
struct AcceptedRule {
|
||||
Optional<String> rule {};
|
||||
Optional<DeprecatedString> rule {};
|
||||
bool accept { false };
|
||||
} m_current_rule {};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue