diff --git a/.vscode/settings.json b/.vscode/settings.json index 53fdbbc..ff91745 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -60,7 +60,7 @@ "cwd": "/mnt/d/Work/WeChatProjects/miniprogram-demo/miniprogram", "args": [ "\"--config-path\"", - "\"/mnt/d/Work/disassembly/wcc-exec/wcc/config/llw2.txt\"" + "\"/mnt/d/Work/disassembly/wcc-exec/wcsc/config/ll1.txt\"" ] }, "cmake.configureSettings": { diff --git a/CMakeLists.txt b/CMakeLists.txt index c31d446..3d25a41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,9 +51,17 @@ add_executable(wcc add_executable(wcsc src/wcsc.cpp src/wcsc/usage.cpp - src/wxss/css_tree_lib/parser.cpp + src/wxa/wxa.cpp + src/wxml/rewrite.cpp src/wxss/common.cpp + src/wxss/token.cpp + src/wxss/tokenizer.cpp src/wxss/x_compiler.cpp + src/wxss/css_tree_lib/base.cpp + src/wxss/css_tree_lib/css_syntax_tree.cpp + src/wxss/css_tree_lib/lexical_checker.cpp + src/wxss/css_tree_lib/parser.cpp + src/wxss/css_tree_lib/transit_table.cpp src/utils/json.cpp src/utils/string_utils.cpp src/utils/file.cpp diff --git a/src/include/wxss.h b/src/include/wxss.h index e810c47..127a00b 100644 --- a/src/include/wxss.h +++ b/src/include/wxss.h @@ -6,6 +6,7 @@ #include #include #include +#include namespace WXSS { @@ -13,29 +14,73 @@ namespace WXSS int NewLintAndParseCSSList(std::map const&, std::vector &, std::string&, std::string&, int, bool, std::string const&, std::string const&); int LintAndParseCSSList(std::map const&, std::string&, std::string&, std::string&, int, bool, bool, bool, std::string const&); void LintAndParseCSS(std::string const&, std::string const&, std::string&, std::string&, bool, bool, bool, bool, std::string const&); - + enum TokenType { + A, + }; class Token { private: /* data */ public: + int offset_0; + int offset_20; + int offset_24; + std::string offset_28; Token(/* args */); ~Token(); std::string GetLiteral(void); + WXSS::Token& operator=(WXSS::Token const&); + }; + + class Tokenizer + { + private: + /* data */ + public: + struct STATE + { + /* data */ + }; + + static int TT[26113]; + static bool bInited; + std::string offset_0; + std::string offset_24; + Tokenizer(/* args */); + Tokenizer(char const*,std::string const&); + ~Tokenizer(); + void InitTransitTable(void); + void InitSubStrCheckingCaluseTable(void); + WXSS::TokenType TryGetAnotherTypeByAnySubStr(char const*, uint, WXSS::Tokenizer::STATE, WXSS::TokenType); + int GetTokens(std::vector &, std::string &, int); }; - namespace CSSTreeLib { - class CSSSyntaxTree + class TransitTable { private: /* data */ + public: + TransitTable(/* args */); + ~TransitTable(); + static TransitTable* GetInstance(); + void Init(void); + std::string GetTopType(); + }; + + class CSSSyntaxTree + { + private: + /* data + size: 0xB0 + */ public: std::string offset_0; WXSS::Token offset_24; std::vector> offset_120; std::shared_ptr offset_140; + std::string offset_164; // 类型? CSSSyntaxTree(/* args */); ~CSSSyntaxTree(); void GetHostRule(std::string &); @@ -54,11 +99,28 @@ namespace WXSS void Traval(std::shared_ptr &); void GetInstance(void); }; - + using Offset0Type = int(); + class Base + { + private: + /* data + size: 0x78u + */ + public: + Offset0Type *offset_0; + std::string offset_4; + Base(/* args */); + ~Base(); + }; + + class Parser { private: /* data */ + std::shared_ptr offset_0; + std::deque> offset_8; + std::deque> offset_48; public: Parser(/* args */); ~Parser(); diff --git a/src/wcsc.cpp b/src/wcsc.cpp index 2632ece..bf25f14 100644 --- a/src/wcsc.cpp +++ b/src/wcsc.cpp @@ -16,7 +16,7 @@ int main(int argc, const char **argv) { return usage(argc, argv); } // main - 5 - std::string configPath = ""; + std::string configFilePath = ""; std::vector v69; for (int i = 1; i < argc; i++) { @@ -29,7 +29,7 @@ int main(int argc, const char **argv) { if (isUseConfigFile) { i++; - configPath = argv[i]; + configFilePath = argv[i]; } else { @@ -37,11 +37,11 @@ int main(int argc, const char **argv) { } } // main - 10 - if (configPath.length() > 0) + if (configFilePath.length() > 0) { // 使用配置文件 std::string configData = ""; - readFile(configPath.data(), configData); + readFile(configFilePath.data(), configData); while (configData.length() > 0) { std::string v104; v104 = getNextArg(configData, "\n"); @@ -51,6 +51,9 @@ int main(int argc, const char **argv) { // main - 15 bool v56 = false; + /** + * 文件列表 + */ std::vector v66; std::string v75, v83; int v29 = 0; @@ -185,6 +188,9 @@ int main(int argc, const char **argv) { { f = fopen(fileName.data(), "w"); } + /** + * 文件内容map filename -> fileContent + */ std::map v77; if (!v35) { diff --git a/src/wxss/common.cpp b/src/wxss/common.cpp index c2d28e7..5bbf816 100644 --- a/src/wxss/common.cpp +++ b/src/wxss/common.cpp @@ -11,5 +11,9 @@ namespace WXSS { throw "not implement"; } + int NewLintAndParseCSSList(std::map const&, std::vector &, std::string&, std::string&, int, bool, std::string const&, std::string const&) + { + throw "not implement"; + } } \ No newline at end of file diff --git a/src/wxss/css_tree_lib/base.cpp b/src/wxss/css_tree_lib/base.cpp new file mode 100644 index 0000000..1939c4b --- /dev/null +++ b/src/wxss/css_tree_lib/base.cpp @@ -0,0 +1,16 @@ +#include "../../include/wxss.h" + +namespace WXSS +{ + namespace CSSTreeLib + { + Base::Base(/* args */) + { + } + + Base::~Base() + { + } + } + +} // namespace WXSS \ No newline at end of file diff --git a/src/wxss/css_tree_lib/lexical_checker.cpp b/src/wxss/css_tree_lib/lexical_checker.cpp index 0b2f3f6..1030a71 100644 --- a/src/wxss/css_tree_lib/lexical_checker.cpp +++ b/src/wxss/css_tree_lib/lexical_checker.cpp @@ -4,10 +4,23 @@ namespace WXSS { namespace CSSTreeLib { + LexicalChecker::LexicalChecker(/* args */) + { + throw "not implement"; + } + LexicalChecker::~LexicalChecker(/* args */) + { + // throw "not implement"; + } void LexicalChecker::GetInstance(/* args */) { + throw "not implement"; } - + void LexicalChecker::Traval(std::shared_ptr &) + { + throw "not implement"; + } + } } // namespace WXSS \ No newline at end of file diff --git a/src/wxss/css_tree_lib/parser.cpp b/src/wxss/css_tree_lib/parser.cpp index da3993c..2c3a203 100644 --- a/src/wxss/css_tree_lib/parser.cpp +++ b/src/wxss/css_tree_lib/parser.cpp @@ -1,5 +1,5 @@ #include "../../include/wxss.h" - +#include namespace WXSS { namespace CSSTreeLib @@ -13,8 +13,241 @@ namespace WXSS { } - int Parser::Parse(std::string const&, std::string const&, std::string&, std::string const&) + int Parser::Parse(std::string const& a2, std::string const& a3, std::string& a4, std::string const& a5) { + // Parse - 0 + WXSS::Tokenizer v125(a2.data(), a3); + std::vector v118; + int ret = v125.GetTokens(v118, a4, -1); + if (ret) + { + return ret; + } + + this->offset_8.clear(); + this->offset_48.clear(); + + TransitTable * instance = TransitTable::GetInstance(); + instance->Init(); + + // Parse - 5 + std::shared_ptr le(new WXSS::CSSTreeLib::CSSSyntaxTree()); + + if (v118.begin() == v118.end()) + { + return 0; + } + + // Parse - 10 + WXSS::Token v127; + v118.push_back(v127); + + std::shared_ptr v102(new WXSS::CSSTreeLib::Base()); + v102->offset_4 = "$"; + this->offset_8.push_back(v102); + + // off_519A44 + std::shared_ptr v104(new WXSS::CSSTreeLib::Base()); + // v104->offset_0 = off_519A44; + v104->offset_4 = instance->GetTopType(); + this->offset_8.push_back(v104); + + // Parse - 15 + // 一堆东西 + + // Parse - 20 + int v75 = 0; + while (true) + { + if (/* ??? || */v75 >= v118.size()) + { + break; + } + auto cur = v118[v75]; + std::string str; + switch (cur.offset_0) + { + case 1: + /* code */ + str = cur.offset_28; + break; + + case 2: + /* code */ + str = "$VALUE"; + break; + + case 3: + /* code */ + str = "$STRING"; + break; + + case 4: + /* code */ + str = "$NAME"; + break; + + case 5: + /* code */ + str = "$ID"; + break; + + case 6: + /* code */ + str = "$MULTI_EXPR"; + break; + + case 7: + /* code */ + str = "$$"; + break; + + case 9: + /* code */ + str = "$ESV"; + break; + + default: + str = "$"; + break; + } + // Parse - 20-0 + if (true) + { + if (true) + { + std::stringstream v135; + if (str[0] != '$' || str[1]) + { + v135 << a3 << "("; + v135 << cur.offset_20; + v135 << ":"; + v135 << cur.offset_24; + v135 << "): error at token `"; + std::string v41; + if (cur.offset_0 != 1) + { + v41 = "$"; + if (cur.offset_0 != 8) + { + v41 = "UNKNOWN"; + // if (cur.offset_4) + // { + // v41 = cur.offset_4; + // } + } + } + v135 << v41; + v135 << "`"; + a4 = v135.str(); + } + else + { + v135 << a3 << "("; + v135 << cur.offset_20; + v135 << ":"; + v135 << cur.offset_24; + v135 << "): unexpected end of input or bad input"; + a4 = v135.str(); + } + return -1; + } + v75++; + this->offset_8.pop_back(); + if (str[0] != '$' || str[1]) + { + std::shared_ptr v82(new WXSS::CSSTreeLib::CSSSyntaxTree()); + + this->offset_48.push_back(v82); + } + } + // Parse - 20-5 + else if (true) + { + this->offset_8.pop_back(); + if (2) + { + if (this->offset_48.begin() == this->offset_48.end()) + { + a4 = "interal error: 1001"; + return 1001; + } + auto v44 = this->offset_48.back(); + this->offset_48.pop_back(); + if (this->offset_48.begin() == this->offset_48.end()) + { + a4 = "interal error: 1002"; + return 1002; + } + auto v45 = this->offset_48.back(); + if (v45->offset_120.begin() == v45->offset_120.end()) + { + v45->offset_164 = v44->offset_164; + } + v45->offset_120.push_back(v44); + + } + else + { + int stra = 1; + std::shared_ptr lh(new WXSS::CSSTreeLib::CSSSyntaxTree()); + std::shared_ptr v123(new WXSS::CSSTreeLib::CSSSyntaxTree()); + // v123->offset_0.assign(v84->offset_4); + for (int j = 0; j < stra; j++) + { + if (this->offset_48.begin() == this->offset_48.end()) + { + a4 = "interal error: 1003"; + return 1003; + } + auto v47 = this->offset_48.back(); + // lb->offset_120.push_back(v47); + this->offset_48.pop_back(); + } + if (stra > 0) + { + + } + int v76 = 1; + if (!v76) + { + if (v123->offset_120.begin() != v123->offset_120.end()) + { + int sb = 0; + for (auto lc = v123->offset_120.size() - 1; lc > sb; lc--) + { + auto t = v123->offset_120[sb]; + v123->offset_120[sb] = v123->offset_120[lc]; + v123->offset_120[lc] = t; + sb++; + } + } + } + this->offset_48.push_back(v123); + + } + + } + // Parse - 20-10 + else if (true) + { + + } + // Parse - 20-15 + } + + // Parse - 25 + if (this->offset_48.begin() == this->offset_48.end()) + { + a4 = "interal error: 1004"; + return 1004; + } + else + { + auto v68 = this->offset_48.back(); + this->offset_0 = v68; + } + // Parse - 30 throw "not implement"; } } diff --git a/src/wxss/css_tree_lib/transit_table.cpp b/src/wxss/css_tree_lib/transit_table.cpp new file mode 100644 index 0000000..4ba0ae7 --- /dev/null +++ b/src/wxss/css_tree_lib/transit_table.cpp @@ -0,0 +1,29 @@ +#include "../../include/wxss.h" + +namespace WXSS +{ + namespace CSSTreeLib + { + TransitTable::TransitTable() + { + + } + TransitTable::~TransitTable() + { + + } + TransitTable* TransitTable::GetInstance() + { + throw "not implement"; + } + + void TransitTable::Init() + { + + } + std::string TransitTable::GetTopType() + { + throw "not implement"; + } + } +} \ No newline at end of file diff --git a/src/wxss/token.cpp b/src/wxss/token.cpp index f29d71d..d05a4aa 100644 --- a/src/wxss/token.cpp +++ b/src/wxss/token.cpp @@ -10,4 +10,13 @@ namespace WXSS Token::~Token() { } + + std::string Token::GetLiteral(void) + { + throw "not implement"; + } + WXSS::Token& Token::operator=(WXSS::Token const&) + { + throw "not implement"; + } } \ No newline at end of file diff --git a/src/wxss/tokenizer.cpp b/src/wxss/tokenizer.cpp new file mode 100644 index 0000000..d63e7d5 --- /dev/null +++ b/src/wxss/tokenizer.cpp @@ -0,0 +1,332 @@ +#include "../include/wxss.h" +#include +#include + +namespace WXSS +{ + + Tokenizer::Tokenizer(/* args */) + { + } + + Tokenizer::Tokenizer(char const* str, std::string const& a3) + { + this->offset_0.replace(0, 0, str, strlen(str)); + this->offset_24.assign(a3); + } + + Tokenizer::~Tokenizer() + { + } + + int Tokenizer::TT[26113] = {0}; + bool Tokenizer::bInited = false; + void Tokenizer::InitTransitTable(/* args */) + { + // start 0x005222A0 + if(!this->bInited) + { + // InitTransitTable - 0 + this->bInited = true; + const char* ntr = " \n\t\r"; + for (int i = 0; i < 5; i++) + { + char v1 = ntr[i]; + this->TT[(0x5232A0 - 0x005222A0) / 4 + 2 * v1] = 134217729; + this->TT[(0x5232A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + const char* dotabc = ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-"; + for (int i = 0; i < 56; i++) + { + char v1 = dotabc[i]; + this->TT[(0x5232A0 - 0x005222A0) / 4 + 2 * v1] = 2; + this->TT[(0x5232A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + const char* _0123 = "0123456789"; + for (int i = 0; i < 11; i++) + { + char v1 = _0123[i]; + this->TT[(0x5232A0 - 0x005222A0) / 4 + 2 * v1] = 5; + this->TT[(0x5232A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + // InitTransitTable - 5 + const char* sharp = "#*,{}[]:()~=|>\"+^@;"; + for (int i = 0; i < 20; i++) + { + char v1 = sharp[i]; + this->TT[(0x5232A0 - 0x005222A0) / 4 + 2 * v1] = 1114113; + this->TT[(0x5232A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + this->TT[(0x523678 - 0x005222A0) / 4] = 1114116; + this->TT[(0x52367C - 0x005222A0) / 4] = 0; + this->TT[(0x5232A0 - 0x005222A0) / 4] = 1; + this->TT[(0x5232A4 - 0x005222A0) / 4] = 0; + this->TT[(0x5233B0 - 0x005222A0) / 4] = 6; + this->TT[(0x5233B4 - 0x005222A0) / 4] = 0; + this->TT[(0x5233D8 - 0x005222A0) / 4] = 7; + this->TT[(0x5233DC - 0x005222A0) / 4] = 0; + this->TT[(0x5234A0 - 0x005222A0) / 4] = 23; + this->TT[(0x5234A4 - 0x005222A0) / 4] = 0; + this->TT[(0x5233B8 - 0x005222A0) / 4] = 3; + this->TT[(0x5233BC - 0x005222A0) / 4] = 0; + this->TT[(0x523AA0 - 0x005222A0) / 4] = -1; + this->TT[(0x523AA4 - 0x005222A0) / 4] = -1; + this->TT[(0x5233C0 - 0x005222A0) / 4] = 33619969; + this->TT[(0x5233C4 - 0x005222A0) / 4] = 0; + this->TT[(0x53A678 - 0x005222A0) / 4] = 88211481; + this->TT[(0x53A67C - 0x005222A0) / 4] = 0; + this->TT[(0x53A2A0 - 0x005222A0) / 4] = -1; + this->TT[(0x53A2A4 - 0x005222A0) / 4] = -1; + this->TT[(0x53AAA0 - 0x005222A0) / 4] = 24; + this->TT[(0x53AAA4 - 0x005222A0) / 4] = 0; + this->TT[(0x53B678 - 0x005222A0) / 4] = 1114113; + this->TT[(0x53B67C - 0x005222A0) / 4] = 0; + this->TT[(0x53BAA0 - 0x005222A0) / 4] = -1; + this->TT[(0x53BAA4 - 0x005222A0) / 4] = -1; + // InitTransitTable - 10 + for (int i = 0; i < 56; i++) + { + char v1 = dotabc[i]; + this->TT[(0x5392A0 - 0x005222A0) / 4 + 2 * v1] = 2; + this->TT[(0x5392A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + this->TT[(0x539AA0 - 0x005222A0) / 4] = 68288513; + this->TT[(0x539AA4 - 0x005222A0) / 4] = 0; + for (int i = 0; i < 56; i++) + { + char v1 = dotabc[i]; + this->TT[(0x5272A0 - 0x005222A0) / 4 + 2 * v1] = 5; + this->TT[(0x5272A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + // InitTransitTable - 15 + for (int i = 0; i < 11; i++) + { + char v1 = _0123[i]; + this->TT[(0x5272A0 - 0x005222A0) / 4 + 2 * v1] = 5; + this->TT[(0x5272A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + this->TT[(0x5273C8 - 0x005222A0) / 4] = 589825; + this->TT[(0x5273CC - 0x005222A0) / 4] = 0; + this->TT[(0x527AA0 - 0x005222A0) / 4] = 67502081; + this->TT[(0x527AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x5283B0 - 0x005222A0) / 4] = 327681; + this->TT[(0x5283B4 - 0x005222A0) / 4] = 0; + this->TT[(0x528AA0 - 0x005222A0) / 4] = 6; + this->TT[(0x528AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x5293D8 - 0x005222A0) / 4] = 327681; + this->TT[(0x5293DC - 0x005222A0) / 4] = 0; + this->TT[(0x529AA0 - 0x005222A0) / 4] = 7; + this->TT[(0x529AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x523418 - 0x005222A0) / 4] = 134217743; + this->TT[(0x52341C - 0x005222A0) / 4] = 0; + this->TT[(0x5313F0 - 0x005222A0) / 4] = 16; + this->TT[(0x5313F4 - 0x005222A0) / 4] = 0; + this->TT[(0x531AA0 - 0x005222A0) / 4] = 134217729; + this->TT[(0x531AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x5323F0 - 0x005222A0) / 4] = 17; + this->TT[(0x5323F4 - 0x005222A0) / 4] = 0; + this->TT[(0x532AA0 - 0x005222A0) / 4] = 16; + this->TT[(0x532AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x533418 - 0x005222A0) / 4] = 134217729; + this->TT[(0x53341C - 0x005222A0) / 4] = 0; + this->TT[(0x5333F0 - 0x005222A0) / 4] = 67108880; + this->TT[(0x5333F4 - 0x005222A0) / 4] = 0; + this->TT[(0x533AA0 - 0x005222A0) / 4] = 16; + this->TT[(0x533AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x526418 - 0x005222A0) / 4] = 134217746; + this->TT[(0x52641C - 0x005222A0) / 4] = 0; + this->TT[(0x5343F0 - 0x005222A0) / 4] = 19; + this->TT[(0x5343F4 - 0x005222A0) / 4] = 0; + this->TT[(0x534AA0 - 0x005222A0) / 4] = 134217732; + this->TT[(0x534AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x5353F0 - 0x005222A0) / 4] = 20; + this->TT[(0x5353F4 - 0x005222A0) / 4] = 0; + this->TT[(0x535AA0 - 0x005222A0) / 4] = 19; + this->TT[(0x535AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x536418 - 0x005222A0) / 4] = 134217732; + this->TT[(0x53641C - 0x005222A0) / 4] = 0; + this->TT[(0x5363F0 - 0x005222A0) / 4] = 67108883; + this->TT[(0x5363F4 - 0x005222A0) / 4] = 0; + this->TT[(0x536AA0 - 0x005222A0) / 4] = 19; + this->TT[(0x536AA4 - 0x005222A0) / 4] = 0; + // InitTransitTable - 20 + for (int i = 0; i < 56; i++) + { + char v1 = dotabc[i]; + this->TT[(0x5242A0 - 0x005222A0) / 4 + 2 * v1] = 2; + this->TT[(0x5242A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + for (int i = 0; i < 11; i++) + { + char v1 = _0123[i]; + this->TT[(0x5242A0 - 0x005222A0) / 4 + 2 * v1] = 2; + this->TT[(0x5242A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + for (int i = 0; i < 5; i++) + { + char v1 = ntr[i]; + this->TT[(0x5242A0 - 0x005222A0) / 4 + 2 * v1] = 67764225; + this->TT[(0x5242A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + // InitTransitTable - 25 + this->TT[(0x5243B0 - 0x005222A0) / 4] = 67764225; + this->TT[(0x5243B4 - 0x005222A0) / 4] = 0; + this->TT[(0x524AA0 - 0x005222A0) / 4] = 67764225; + this->TT[(0x524AA4 - 0x005222A0) / 4] = 0; + for (int i = 0; i < 56; i++) + { + char v1 = dotabc[i]; + this->TT[(0x5252A0 - 0x005222A0) / 4 + 2 * v1] = 3; + this->TT[(0x5252A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + for (int i = 0; i < 11; i++) + { + char v1 = _0123[i]; + this->TT[(0x5252A0 - 0x005222A0) / 4 + 2 * v1] = 3; + this->TT[(0x5252A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + // InitTransitTable - 30 + this->TT[(0x525AA0 - 0x005222A0) / 4] = 69337089; + this->TT[(0x525AA4 - 0x005222A0) / 4] = 0; + for (int i = 0; i < 5; i++) + { + char v1 = ntr[i]; + this->TT[(0x5262A0 - 0x005222A0) / 4 + 2 * v1] = 134217732; + this->TT[(0x5262A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + for (int i = 0; i < 56; i++) + { + char v1 = dotabc[i]; + this->TT[(0x5262A0 - 0x005222A0) / 4 + 2 * v1] = 8; + this->TT[(0x5262A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + for (int i = 0; i < 56; i++) + { + char v1 = dotabc[i]; + this->TT[(0x52A2A0 - 0x005222A0) / 4 + 2 * v1] = 8; + this->TT[(0x52A2A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + // InitTransitTable - 35 + for (int i = 0; i < 11; i++) + { + char v1 = _0123[i]; + this->TT[(0x52A2A0 - 0x005222A0) / 4 + 2 * v1] = 8; + this->TT[(0x52A2A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + for (int i = 0; i < 5; i++) + { + char v1 = ntr[i]; + this->TT[(0x52A2A0 - 0x005222A0) / 4 + 2 * v1] = 67764228; + this->TT[(0x52A2A4 - 0x005222A0) / 4 + 2 * v1] = 0; + } + this->TT[(0x52A470 - 0x005222A0) / 4] = 67764228; + this->TT[(0x52A474 - 0x005222A0) / 4] = 0; + this->TT[(0x52A688 - 0x005222A0) / 4] = 67764228; + this->TT[(0x52A68C - 0x005222A0) / 4] = 0; + this->TT[(0x52A478 - 0x005222A0) / 4] = 67764228; + this->TT[(0x52A47C - 0x005222A0) / 4] = 0; + this->TT[(0x52AAA0 - 0x005222A0) / 4] = -1; + this->TT[(0x52AAA4 - 0x005222A0) / 4] = -1; + this->TT[(0x526470 - 0x005222A0) / 4] = 1114121; + this->TT[(0x526474 - 0x005222A0) / 4] = 0; + this->TT[(0x526478 - 0x005222A0) / 4] = 1114116; + this->TT[(0x52647C - 0x005222A0) / 4] = 0; + this->TT[(0x526688 - 0x005222A0) / 4] = 1114113; + this->TT[(0x52668C - 0x005222A0) / 4] = 0; + this->TT[(0x526AA0 - 0x005222A0) / 4] = -1; + this->TT[(0x526AA4 - 0x005222A0) / 4] = -1; + this->TT[(0x52B478 - 0x005222A0) / 4] = 84279300; + this->TT[(0x52B47C - 0x005222A0) / 4] = 0; + this->TT[(0x52B688 - 0x005222A0) / 4] = 84279300; + this->TT[(0x52B68C - 0x005222A0) / 4] = 0; + this->TT[(0x52B3E0 - 0x005222A0) / 4] = 10; + this->TT[(0x52B3E4 - 0x005222A0) / 4] = 0; + this->TT[(0x52B3B0 - 0x005222A0) / 4] = 11; + this->TT[(0x52B3B4 - 0x005222A0) / 4] = 0; + this->TT[(0x52B3D8 - 0x005222A0) / 4] = 13; + this->TT[(0x52B3DC - 0x005222A0) / 4] = 0; + this->TT[(0x52C3E8 - 0x005222A0) / 4] = 9; + this->TT[(0x52C3EC - 0x005222A0) / 4] = 0; + this->TT[(0x52C3B0 - 0x005222A0) / 4] = 12; + this->TT[(0x52C3B4 - 0x005222A0) / 4] = 0; + this->TT[(0x52C3D8 - 0x005222A0) / 4] = 14; + this->TT[(0x52C3DC - 0x005222A0) / 4] = 0; + this->TT[(0x52CAA0 - 0x005222A0) / 4] = 10; + this->TT[(0x52CAA4 - 0x005222A0) / 4] = 0; + this->TT[(0x52D3B0 - 0x005222A0) / 4] = 9; + this->TT[(0x52D3B4 - 0x005222A0) / 4] = 0; + this->TT[(0x52F3D8 - 0x005222A0) / 4] = 9; + this->TT[(0x52F3DC - 0x005222A0) / 4] = 0; + this->TT[(0x52E3B0 - 0x005222A0) / 4] = 10; + this->TT[(0x52E3B4 - 0x005222A0) / 4] = 0; + this->TT[(0x5303D8 - 0x005222A0) / 4] = 10; + this->TT[(0x5303DC - 0x005222A0) / 4] = 0; + this->TT[(0x52DAA0 - 0x005222A0) / 4] = 11; + this->TT[(0x52DAA4 - 0x005222A0) / 4] = 0; + this->TT[(0x52FAA0 - 0x005222A0) / 4] = 13; + this->TT[(0x52FAA4 - 0x005222A0) / 4] = 0; + this->TT[(0x52EAA0 - 0x005222A0) / 4] = 12; + this->TT[(0x52EAA4 - 0x005222A0) / 4] = 0; + this->TT[(0x530AA0 - 0x005222A0) / 4] = 14; + this->TT[(0x530AA4 - 0x005222A0) / 4] = 0; + this->TT[(0x52BAA0 - 0x005222A0) / 4] = 9; + this->TT[(0x52BAA4 - 0x005222A0) / 4] = 0; + // InitTransitTable - 40 + } + } + + void Tokenizer::InitSubStrCheckingCaluseTable() + { + + } + int Tokenizer::GetTokens(std::vector & a2, std::string & a3, int a4) + { + // GetTokens - 0 + this->InitTransitTable(); + this->InitSubStrCheckingCaluseTable(); + + int v4 = 1; + if (a4 > 0) + { + v4 = a4; + } + std::string v35, v41; + int v47 = 0, v44 = 0; + a2.reserve(a2.size()); + // GetTokens - 5 + int AnotherTypeByAnySubStr = 0; + int v33 = 4194305; + int v31 = 0; + for (int sa = 0; ; sa = v31) + { + if (v47 > this->offset_0.length()) + { + return 0; + } + if (!--v33) + { + a3 = "something must be wrong"; + return -1; + } + char v10 = this->offset_0[v47]; + if (v47 == this->offset_0.length()) + { + v10 = 0; + } + int v11 = this->TT[1024 * v4 + 2 * 10]; + WXSS::TokenType AnotherTypeByAnySubStr = A; + // AnotherTypeByAnySubStr = this->TryGetAnotherTypeByAnySubStr(this->offset_0.data(), v47, v42, AnotherTypeByAnySubStr); + } + + // GetTokens - 10 + std::stringstream v66; + v66 << this->offset_24 << "(" << v35; + v66 << ":" << v41 << "): unexpected `" << v44 << "` at pos " << (v47 + 1); + if (!v47 && v44 > 0xFDu) + { + v66 << " (shoud you check if there's any BOM at the begin of file)"; + } + a3 = v66.str(); + return 0; + } +} \ No newline at end of file diff --git a/src/wxss/x_compiler.cpp b/src/wxss/x_compiler.cpp index 2fc1e03..e55039b 100644 --- a/src/wxss/x_compiler.cpp +++ b/src/wxss/x_compiler.cpp @@ -140,5 +140,44 @@ namespace WXSS { } - + void XCompiler::DealRPX(std::string &, std::stringstream &) + { + throw "not implement"; + } + void XCompiler::GetHostRule(std::string &) + { + throw "not implement"; + } + void XCompiler::ShowTree(std::string &) + { + throw "not implement"; + } + void XCompiler::GetCompiled(std::string const&, std::string&) + { + throw "not implement"; + } + void XCompiler::GetJSCompiled(std::string const&, std::string&) + { + throw "not implement"; + } + void XCompiler::GetWellFormattedJSCompiled(std::string const&, std::string&) + { + throw "not implement"; + } + void XCompiler::GenExpr(std::shared_ptr, std::stringstream &, std::string &) + { + throw "not implement"; + } + int XCompiler::GetPageCss(std::string const&, std::string&, uint) + { + throw "not implement"; + } + void XCompiler::MarkImported(std::string const&) + { + throw "not implement"; + } + int XCompiler::GetCommHead(std::vector &, std::string&, bool, std::string const&) + { + throw "not implement"; + } } // namespace WXSS \ No newline at end of file diff --git a/test/wcsc.disassembly.cpp b/test/wcsc.disassembly.cpp index 984f11d..ddf81d4 100644 --- a/test/wcsc.disassembly.cpp +++ b/test/wcsc.disassembly.cpp @@ -11119,19 +11119,23 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns char v137[4]; // [esp+1A8h] [ebp-D0h] BYREF char v138[204]; // [esp+1ACh] [ebp-CCh] BYREF + // Parse - 0 WXSS::Tokenizer::Tokenizer((int)v125, *a2, (int)a3); v118 = 0; v119 = 0; v120 = 0; Tokens = WXSS::Tokenizer::GetTokens((int *)v125, (int)&v118, a4, -1); if ( Tokens ) - goto LABEL_107; + goto LABEL_107; // 销毁数据,返回Tokens + + // int this while ( *(_DWORD *)(this + 16) != *(_DWORD *)(this + 32) ) std::deque>::pop_back((_DWORD *)(this + 8)); while ( *(_DWORD *)(this + 56) != *(_DWORD *)(this + 72) ) std::deque>::pop_back((_DWORD *)(this + 48)); - if ( !(_BYTE)`guard variable for'WXSS::CSSTreeLib::TransitTable::GetInstance(void)::ret - && __cxa_guard_acquire(&`guard variable for'WXSS::CSSTreeLib::TransitTable::GetInstance(void)::ret) ) + + if ( !(_BYTE)`guard variable for WXSS::CSSTreeLib::TransitTable::GetInstance(void)::ret + && __cxa_guard_acquire(&`guard variable for WXSS::CSSTreeLib::TransitTable::GetInstance(void)::ret) ) { dword_50CBE0 = 0; dword_50CBE4 = 0; @@ -11143,6 +11147,8 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns atexit(__tcf_0); } WXSS::CSSTreeLib::TransitTable::Init((int)&WXSS::CSSTreeLib::TransitTable::GetInstance(void)::ret); + + // Parse - 5 lpuexcpte = (struct _Unwind_Exception *)operator new(0xB0u); WXSS::CSSTreeLib::CSSSyntaxTree::CSSSyntaxTree((int)lpuexcpte); zcc::shared_ptr::shared_ptr(lpuexcpte); @@ -11152,7 +11158,7 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns std::string::operator=(*(unsigned int ***)this, "RULES"); lpuexcpt = (struct _Unwind_Exception *)v119; if ( v118 == v119 ) - goto LABEL_107; + goto LABEL_107; // 销毁数据,返回Tokens v132 = 0; v133 = 0; v134[0] = 0; @@ -11181,6 +11187,8 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns *((_DWORD *)lpuexcpt + 6) = v133; qmemcpy((char *)lpuexcpt + 28, v134, 0x40u); } + + // Parse - 10 v7 = operator new(0x78u); *v7 = &off_519B58; v7[1] = v7 + 3; @@ -11197,10 +11205,13 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns zcc::shared_ptr::shared_ptr(&v102, (int)v7); lpuexcptf = v102; std::string::basic_string((void **)&v135, "$"); + // lpuexcptf->offset_4 = "$" std::string::_M_assign((int)lpuexcptf + 4, (int)&v135); std::string::_M_dispose((void **)&v135); + v78 = (_DWORD *)(this + 8); std::deque>::push_back(this + 8, (int *)&v102); + v8 = operator new(8u); *v8 = &off_519A44; v8[1] = 0; @@ -11208,22 +11219,39 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns lpuexcptg = v104; *((_DWORD *)lpuexcptg + 1) = WXSS::CSSTreeLib::TransitTable::GetTopType(); std::deque>::push_back(this + 8, (int *)&v104); - v9 = operator new(0x48u); + + // Parse - 15 + v9 = operator new(0x48u); // 0x48 -> 72 = 24 * 3 v106 = 0; memset(v9, 0, 0x48u); v107 = 0; v112 = v9; v113 = 0; + // v9->offset_0 = &v9->offset_8 *v9 = v9 + 2; + // v9->offset_24 = v9->offset_32 v9[6] = v9 + 8; + // v9->offset_48 = v9->offset_56 v9[12] = v9 + 14; - v10 = (volatile signed __int32 *)operator new(0x10u); + /* + v9: + std::string offset_0; + std::string offset_24; + std::string offset_48; + */ + + v10 = (volatile signed __int32 *)operator new(0x10u); // 0x10 -> 16 v11 = (int)v112; + // v10->offset_4 *((_DWORD *)v10 + 1) = 1; v12 = v106; + // v10->offset_8 *((_DWORD *)v10 + 2) = 1; + // v10->offset_0 *v10 = (volatile signed __int32)&off_51AD2C; + // v10->offset_12 *((_DWORD *)v10 + 3) = v9; + v106 = v11; v13 = v107; v112 = (_DWORD *)v12; @@ -11232,10 +11260,15 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v113); std::string::_M_assign(v106, (int)a3); std::string::_M_assign(v106 + 24, a5); - v14 = operator new(0x5Cu); + + v14 = operator new(0x5Cu); // 0x5C -> 92 + // v14->offset_4 v14[1] = 0; + // v14->offset_8 v14[2] = 0; + // v14->offset_28 *((_BYTE *)v14 + 28) = 0; + // v14->offset_0 = 1 *v14 = 1; v14[3] = 0; v14[4] = 0; @@ -11246,13 +11279,19 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns v109 = 0; v114 = (int)v14; v115 = 0; - v15 = (volatile signed __int32 *)operator new(0x10u); + + v15 = (volatile signed __int32 *)operator new(0x10u); // 0x10 -> 16 v16 = v114; + // v15->offset_4 *((_DWORD *)v15 + 1) = 1; v17 = v108; + // v15->offset_8 *((_DWORD *)v15 + 2) = 1; + // v15->offset_0 *v15 = (volatile signed __int32)&off_51AD9C; + // v15->offset_12 *((_DWORD *)v15 + 3) = v81; + v108 = v16; v18 = v109; v114 = v17; @@ -11260,19 +11299,25 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns v115 = v18; std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v115); *(_DWORD *)(v108 + 12) = -1; - v79 = (char *)operator new(0x18u); + + v79 = (char *)operator new(0x18u); // 0x18 -> 24 std::string::basic_string(v79, (int)a3); v110 = 0; v111 = 0; v116 = v79; v117 = 0; - v19 = (volatile signed __int32 *)operator new(0x10u); + + v19 = (volatile signed __int32 *)operator new(0x10u); // 0x10 ->16 v20 = (int *)v79; v21 = v116; + // v19->offset_4 *((_DWORD *)v19 + 1) = 1; v22 = v110; + // v19->offset_8 *((_DWORD *)v19 + 2) = 1; + // v19->offset_0 *v19 = (volatile signed __int32)&off_51ADB8; + // v19->offset_12 *((_DWORD *)v19 + 3) = v79; v110 = v21; v116 = v22; @@ -11286,10 +11331,13 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns v116 = 0; v117 = 0; v75 = 0; + + // Parse - 20 while ( 1 ) { v24 = this; - v25 = *(_DWORD *)(this + 32); + v25 = *(_DWORD *)(this + 32); // it_finish + // this->offset_16 -> it_start, v75 索引 if ( *(_DWORD *)(this + 16) == v25 || v75 >= -373475417 * ((v119 - v118) >> 2) ) break; if ( v25 == *(_DWORD *)(this + 36) ) @@ -11328,13 +11376,14 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns Str = "$"; break; } + // Parse - 20-0 if ( (*(int (__thiscall **)(char *, int, int))(*(_DWORD *)v116 + 8))(v116, v26, v74) == 1 ) { v27 = *((_DWORD *)v116 + 1); if ( *Str != *(_BYTE *)v27 || strcmp(Str + 1, (const char *)(v27 + 1)) ) { std::basic_stringstream,std::allocator>::basic_stringstream((int)&v135); - if ( *Str != 36 || Str[1] ) + if ( *Str != '$'/*36*/ || Str[1] ) { v37 = std::operator<<((std::ostream::sentry *)v137, a3); std::operator<<>(v37, "("); @@ -11372,11 +11421,11 @@ int __thiscall WXSS::CSSTreeLib::Parser::Parse(int this, char **a2, int *a3, uns std::string::operator=((unsigned __int8 **)a4, (int)v121); v36 = v121; } -LABEL_48: + LABEL_48:// 销毁数据,返回-1 std::string::_M_dispose((void **)v36); std::basic_stringstream,std::allocator>::~basic_stringstream((int)&v135); Tokens = -1; - goto LABEL_106; + goto LABEL_106;// 销毁数据,返回Tokens } ++v75; std::deque>::pop_back(v78); @@ -11395,7 +11444,7 @@ LABEL_48: v83[10] = *((_DWORD *)lpuexcpta + 4); v83[11] = *((_DWORD *)lpuexcpta + 5); v83[12] = *((_DWORD *)lpuexcpta + 6); - for ( i = 0; i != 64; ++i ) + for ( i = 0; i != '@'/*64*/; ++i ) *((_BYTE *)v83 + i + 52) = *((_BYTE *)lpuexcpta + i + 28); std::string::operator=((unsigned int **)v83, Str); v31 = *((_DWORD *)lpuexcpta + 3); @@ -11411,6 +11460,7 @@ LABEL_48: goto LABEL_59; } } + // Parse - 20-5 else if ( (*(int (__fastcall **)(char *))(*(_DWORD *)v116 + 8))(v116) == 3 ) { std::deque>::pop_back(v78); @@ -11424,7 +11474,7 @@ LABEL_48: std::string::operator=(a4, "interal error: "); std::string::operator+=(a4, "1001"); Tokens = 1001; - goto LABEL_106; + goto LABEL_106;// 销毁数据,返回Tokens } v44 = (int *)std::deque>::back((_DWORD *)(this + 48)); std::__shared_ptr::__shared_ptr((int *)&v123, v44); @@ -11435,12 +11485,14 @@ LABEL_48: std::string::operator+=(a4, "1002"); std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(v124); Tokens = 1002; - goto LABEL_106; + goto LABEL_106;// 销毁数据,返回Tokens } v45 = (int *)std::deque>::back((_DWORD *)(this + 48)); std::__shared_ptr::__shared_ptr((int *)&v135, v45); v46 = (void **)v135; + // offset_124 offset_120 if ( v135[31] == v135[30] ) + // offset_164 v135[41] = *((_DWORD *)v123 + 41); std::vector>::push_back(v46 + 30, &v123); v135[42] = *((_DWORD *)v123 + 42); @@ -11465,7 +11517,7 @@ LABEL_48: std::string::operator+=(a4, "1003"); std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(v124); Tokens = 1003; - goto LABEL_106; + goto LABEL_106;// 销毁数据,返回Tokens } v47 = (_DWORD *)std::deque>::back((_DWORD *)(this + 48)); std::vector>::push_back((void **)lpuexcptb + 30, v47); @@ -11473,33 +11525,38 @@ LABEL_48: } if ( (int)Stra > 0 ) { - v20 = (int *)lpuexcptb; + v20 = (int *)lpuexcptb; // v123 v48 = (int *)*((_DWORD *)v123 + 30); v49 = v48[2 * (_DWORD)Stra - 2]; v50 = *v48; + // v123->offset_164 *((_DWORD *)lpuexcptb + 41) = *(_DWORD *)(v49 + 164); + // v123->offset_168 *((_DWORD *)lpuexcptb + 42) = *(_DWORD *)(v50 + 168); + // v123->offset_148 *((_DWORD *)lpuexcptb + 37) = v106; std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=((volatile signed __int32 **)lpuexcptb + 38, v107); + // v123->offset_156 *((_DWORD *)lpuexcptb + 39) = v108; std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=((volatile signed __int32 **)lpuexcptb + 40, v109); } if ( !v76 ) { - v51 = *((_DWORD *)lpuexcptb + 31); + // lpuexcptb -> v123 + v51 = *((_DWORD *)lpuexcptb + 31); // end if ( *((_DWORD *)lpuexcptb + 30) != v51 ) { v20 = (int *)(v51 - 8); Strb = (char *)*((_DWORD *)lpuexcptb + 30); - for ( lpuexcptc = (struct _Unwind_Exception *)(v51 - 8); - lpuexcptc > (struct _Unwind_Exception *)Strb; + for ( lpuexcptc = (struct _Unwind_Exception *)(v51 - 8); // end + lpuexcptc > (struct _Unwind_Exception *)Strb; // begin lpuexcptc = (struct _Unwind_Exception *)((char *)lpuexcptc - 8) ) { std::__shared_ptr::__shared_ptr( (int *)&v135, (int *)Strb); - v20 = (int *)Strb; - *(_DWORD *)Strb = *(_DWORD *)lpuexcptc; + v20 = (int *)Strb; // pre + *(_DWORD *)Strb = *(_DWORD *)lpuexcptc; // suf std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=( (volatile signed __int32 **)Strb + 1, *((volatile signed __int32 **)lpuexcptc + 1)); @@ -11514,10 +11571,11 @@ LABEL_48: } std::deque>::push_back(this + 48, (int *)&v123); } - v32 = v124; -LABEL_59: + v32 = v124; // 只是为了销毁 + LABEL_59: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(v32); } + // Parse - 20-10 else if ( (*(int (__fastcall **)(char *))(*(_DWORD *)v116 + 8))(v116) == 2 ) { v86 = &dword_50CBE0; @@ -11592,7 +11650,7 @@ LABEL_59: std::stringbuf::str((int)&v123, (int)v138); std::string::operator=((unsigned __int8 **)a4, (int)&v123); v36 = (char *)&v123; - goto LABEL_48; + goto LABEL_48;// 销毁数据,返回-1 } std::deque>::pop_back(v78); for ( lpuexcptd = ((*(_DWORD *)(*((_DWORD *)Strc + 10) + 4) - **((_DWORD **)Strc + 10)) >> 3) - 1; @@ -11609,6 +11667,7 @@ LABEL_59: } } } + // Parse - 25 if ( *(_DWORD *)(this + 72) == *(_DWORD *)(this + 56) ) { std::string::operator=(a4, "interal error: "); @@ -11623,7 +11682,8 @@ LABEL_59: *(_DWORD *)this = v69; std::__shared_count<(__gnu_cxx::_Lock_policy)2>::operator=((volatile signed __int32 **)(this + 4), v70); } -LABEL_106: + // Parse - 30 + LABEL_106: std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v117); std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v109); std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v107); @@ -11716,13 +11776,15 @@ void __thiscall WXSS::Tokenizer::Tokenizer(int this, char *Str, int a3) size_t v3; // eax int v4; // [esp+14h] [ebp-44h] - *(_DWORD *)(this + 4) = 0; *(_DWORD *)this = this + 8; + *(_DWORD *)(this + 4) = 0; *(_BYTE *)(this + 8) = 0; + v4 = this + 24; - *(_DWORD *)(this + 28) = 0; *(_DWORD *)(this + 24) = this + 32; + *(_DWORD *)(this + 28) = 0; *(_BYTE *)(this + 32) = 0; + v3 = strlen(Str); std::string::_M_replace((unsigned int **)this, 0, 0, Str, v3); std::string::_M_assign(v4, a3); @@ -11768,6 +11830,7 @@ void WXSS::Tokenizer::InitTransitTable() if ( !WXSS::Tokenizer::InitTransitTable(void)::bInited ) { + // InitTransitTable - 0 WXSS::Tokenizer::InitTransitTable(void)::bInited = 1; for ( i = " \n\t\r"; ; ++i ) { @@ -11793,6 +11856,7 @@ void WXSS::Tokenizer::InitTransitTable() dword_5232A0[2 * v5] = 5; dword_5232A4[2 * v5] = 0; } + // InitTransitTable - 5 for ( m = "#*,{}[]:()~=|>\"+^@;"; ; ++m ) { v7 = *m; @@ -11802,7 +11866,6 @@ void WXSS::Tokenizer::InitTransitTable() dword_5232A4[2 * v7] = 0; } dword_523678 = 1114116; - v8 = ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-"; dword_52367C = 0; dword_5232A0[0] = 1; dword_5232A4[0] = 0; @@ -11828,6 +11891,8 @@ void WXSS::Tokenizer::InitTransitTable() dword_53B67C = 0; dword_53BAA0 = -1; dword_53BAA4 = -1; + // InitTransitTable - 10 + v8 = ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-"; while ( 1 ) { v9 = *v8; @@ -11849,6 +11914,7 @@ void WXSS::Tokenizer::InitTransitTable() ++v10; dword_5272A4[2 * v11] = 0; } + // InitTransitTable - 15 for ( n = "0123456789"; ; ++n ) { v13 = *n; @@ -11902,6 +11968,7 @@ void WXSS::Tokenizer::InitTransitTable() dword_5363F4 = 0; dword_536AA0 = 19; dword_536AA4 = 0; + // InitTransitTable - 20 while ( 1 ) { v15 = *v14; @@ -11927,6 +11994,7 @@ void WXSS::Tokenizer::InitTransitTable() dword_5242A0[2 * v19] = 67764225; dword_5242A4[2 * v19] = 0; } + // InitTransitTable - 25 dword_5243B0 = 67764225; v20 = ".abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-"; dword_5243B4 = 0; @@ -11949,6 +12017,7 @@ void WXSS::Tokenizer::InitTransitTable() dword_5252A0[2 * v23] = 3; dword_5252A4[2 * v23] = 0; } + // InitTransitTable - 30 dword_525AA0 = 69337089; v24 = " \n\t\r"; dword_525AA4 = 0; @@ -11977,6 +12046,7 @@ void WXSS::Tokenizer::InitTransitTable() dword_52A2A0[2 * v29] = 8; dword_52A2A4[2 * v29] = 0; } + // InitTransitTable - 35 for ( i1 = "0123456789"; ; ++i1 ) { v31 = *i1; @@ -12045,6 +12115,7 @@ void WXSS::Tokenizer::InitTransitTable() dword_530AA4 = 0; dword_52BAA0 = 9; dword_52BAA4 = 0; + // InitTransitTable - 40 } } // 5232A0: using guessed type int dword_5232A0[]; @@ -12353,6 +12424,7 @@ int __thiscall WXSS::Tokenizer::GetTokens(int *this, int a2, unsigned int **a3, int v72; // [esp+118h] [ebp-C0h] char v73[184]; // [esp+11Ch] [ebp-BCh] BYREF + // GetTokens - 0 WXSS::Tokenizer::InitTransitTable(); WXSS::Tokenizer::InitSubStrCheckingCaluseTable(); v36 = this[1]; @@ -12361,11 +12433,14 @@ int __thiscall WXSS::Tokenizer::GetTokens(int *this, int a2, unsigned int **a3, v4 = a4; v42 = v4; v45 = *this; + + // this->offset_0.length() / 7 v5 = v36 / 7; if ( v36 > 0x9BD37A9 ) std::__throw_length_error((std::length_error *)"vector::reserve"); - v6 = *(volatile signed __int32 ***)a2; - lpuexcpt = *(struct _Unwind_Exception **)(a2 + 8); + + v6 = *(volatile signed __int32 ***)a2; // begin + lpuexcpt = *(struct _Unwind_Exception **)(a2 + 8); // end if ( v5 > -373475417 * ((lpuexcpt - (struct _Unwind_Exception *)v6) >> 2) ) { lpuexcpt = 0; @@ -12385,6 +12460,7 @@ int __thiscall WXSS::Tokenizer::GetTokens(int *this, int a2, unsigned int **a3, *(_DWORD *)(a2 + 4) = (char *)v8 + v46; *(_DWORD *)(a2 + 8) = (char *)lpuexcpt + (_DWORD)String1; } + // GetTokens - 5 v33 = 4194305; AnotherTypeByAnySubStr = 0; v37 = 1; @@ -12584,7 +12660,7 @@ int __thiscall WXSS::Tokenizer::GetTokens(int *this, int a2, unsigned int **a3, } } std::vector::push_back(a2, (int *)&v58); -LABEL_77: + LABEL_77: String1a = (char *)(v43 + 1); v37 = v41 + 1; std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v60); @@ -12613,6 +12689,9 @@ LABEL_77: if ( ((unsigned int)lpuexcpt & 0x8000000) != 0 ) v31 = (char *)v47; } + // for end + + // GetTokens - 10 std::basic_stringstream,std::allocator>::basic_stringstream((int)&v66); v14 = std::operator<<((std::ostream::sentry *)&v68, this + 6); std::operator<<>(v14, "(");