Everywhere: Rename {Deprecated => Byte}String

This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
Ali Mohammad Pur 2023-12-16 17:49:34 +03:30 committed by Ali Mohammad Pur
parent 38d62563b3
commit 5e1499d104
Notes: sideshowbarker 2024-07-16 23:38:54 +09:00
1615 changed files with 10257 additions and 10257 deletions

View file

@ -4,7 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/DeprecatedString.h>
#include <AK/ByteString.h>
#include <AK/GenericLexer.h>
#include <AK/HashTable.h>
#include <AK/OwnPtr.h>
@ -22,8 +22,8 @@ struct Range {
};
struct StateTransition {
Optional<DeprecatedString> new_state;
Optional<DeprecatedString> action;
Optional<ByteString> new_state;
Optional<ByteString> action;
};
struct MatchedAction {
@ -32,18 +32,18 @@ struct MatchedAction {
};
struct State {
DeprecatedString name;
ByteString name;
Vector<MatchedAction> actions;
Optional<DeprecatedString> entry_action;
Optional<DeprecatedString> exit_action;
Optional<ByteString> entry_action;
Optional<ByteString> exit_action;
};
struct StateMachine {
DeprecatedString name;
DeprecatedString initial_state;
ByteString name;
ByteString initial_state;
Vector<State> states;
Optional<State> anywhere;
Optional<DeprecatedString> namespaces;
Optional<ByteString> namespaces;
};
static OwnPtr<StateMachine>
@ -159,7 +159,7 @@ parse_state_machine(StringView input)
consume_whitespace();
state.exit_action = consume_identifier();
} else if (lexer.next_is('@')) {
auto directive = consume_identifier().to_deprecated_string();
auto directive = consume_identifier().to_byte_string();
fprintf(stderr, "Unimplemented @ directive %s\n", directive.characters());
exit(1);
} else {
@ -189,7 +189,7 @@ parse_state_machine(StringView input)
lexer.consume_specific('@');
state_machine->anywhere = consume_state_description();
} else if (lexer.consume_specific('@')) {
auto directive = consume_identifier().to_deprecated_string();
auto directive = consume_identifier().to_byte_string();
fprintf(stderr, "Unimplemented @ directive %s\n", directive.characters());
exit(1);
} else {
@ -238,9 +238,9 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
return 0;
}
HashTable<DeprecatedString> actions(StateMachine const& machine)
HashTable<ByteString> actions(StateMachine const& machine)
{
HashTable<DeprecatedString> table;
HashTable<ByteString> table;
auto do_state = [&](State const& state) {
if (state.entry_action.has_value())
@ -302,7 +302,7 @@ void output_header(StateMachine const& machine, SourceGenerator& generator)
{
generator.set("class_name", machine.name);
generator.set("initial_state", machine.initial_state);
generator.set("state_count", DeprecatedString::number(machine.states.size() + 1));
generator.set("state_count", ByteString::number(machine.states.size() + 1));
generator.append(R"~~~(
#pragma once