From c5d507fa239e6c052410bfbca09bf65dad36c8ae Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 10 Nov 2026 20:34:29 +0000 Subject: [PATCH] Decompile fn_18261 (CTokenizer::Parse) Batch #16513 by Yommy: 1 byte-identical, 0 confirmed by peer review. - fn_18261 CTokenizer::Parse: byte-identical Merged automatically: every function is byte-identical to the original. --- Source/Utility/Tokenizer.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Source/Utility/Tokenizer.cpp b/Source/Utility/Tokenizer.cpp index 7fa8b8445..edb9bb94d 100644 --- a/Source/Utility/Tokenizer.cpp +++ b/Source/Utility/Tokenizer.cpp @@ -33,17 +33,17 @@ void CTokenizer::Parse(const std::string& text) { unsigned int length = 0; State state = State::Token; const int size = static_cast(text.size()); - this->tokens.clear(); + this->tokens.erase(this->tokens.begin(), this->tokens.end()); int index = 0; for (; index < size; ++index) { - const char value = text[index]; - if (state == State::Token) { - if (value == '/' && text[index + 1] == '/') { + switch (state) { + case State::Token: + if (text[index] == '/' && text[index + 1] == '/') { return; } - if (std::iswspace(static_cast(value)) && value >= 0) { + if (std::iswspace(static_cast(text[index])) && text[index] >= 0) { if (index != 0) { token[length] = '\0'; this->tokens.push_back(std::string(token)); @@ -51,11 +51,15 @@ void CTokenizer::Parse(const std::string& text) { } state = State::Whitespace; } else { - token[length++] = value; + token[length++] = text[index]; } - } else if (!std::iswspace(static_cast(value)) || value < 0) { - --index; - state = State::Token; + break; + case State::Whitespace: + if (!std::iswspace(static_cast(text[index])) || text[index] < 0) { + --index; + state = State::Token; + } + break; } }