mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: 添加一些方法
This commit is contained in:
parent
7e477026f1
commit
00f4999f19
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -67,10 +67,7 @@
|
||||
"CMAKE_TOOLCHAIN_FILE": "/root/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
},
|
||||
"clangd.arguments": [
|
||||
"-log=verbose",
|
||||
"-pretty",
|
||||
"--background-index",
|
||||
//"--query-driver=/bin/arm-buildroot-linux-gnueabihf-g++", //for cross compile usage
|
||||
"--compile-commands-dir=${workspaceFolder}/build/"
|
||||
],
|
||||
"cmake.sourceDirectory": "/root/github/wx-compiler"
|
||||
|
@ -54,6 +54,7 @@ add_executable(wcsc
|
||||
src/wxa/wxa.cpp
|
||||
src/wxml/common.cpp
|
||||
src/wxml/rewrite.cpp
|
||||
src/wxml/rpx.cpp
|
||||
src/wxss/common.cpp
|
||||
src/wxss/token.cpp
|
||||
src/wxss/tokenizer.cpp
|
||||
@ -63,6 +64,7 @@ add_executable(wcsc
|
||||
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/rule.cpp
|
||||
src/wxss/css_tree_lib/transit_table.cpp
|
||||
src/utils/bittest.cpp
|
||||
src/utils/json.cpp
|
||||
|
@ -31,8 +31,28 @@ namespace WXML
|
||||
std::string ToStringCode2(std::string const&);
|
||||
std::string ToStringCode3(char const*, int);
|
||||
std::string ToStringCode3(std::string const&);
|
||||
void GetToken(std::string const&,std::vector<std::pair<int,std::string>> &);
|
||||
int RewriteImg(std::string const&,std::string&,std::string,int,int);
|
||||
int RewriteRPX(std::string const&,std::string&,char const*,char const*);
|
||||
}
|
||||
|
||||
namespace RPX
|
||||
{
|
||||
struct Table
|
||||
{
|
||||
bool inited = false;
|
||||
int *nextPos;
|
||||
int canAccept[266];
|
||||
};
|
||||
|
||||
int accept(int *,int *[266],int &,char const*);
|
||||
int acceptID(char const*,int &);
|
||||
int acceptStr(char const*,int &);
|
||||
int acceptNum(char const*,int &);
|
||||
int acceptSymbol(char const*,int &,int &);
|
||||
} // namespace RPX
|
||||
|
||||
|
||||
class NameAllocator
|
||||
{
|
||||
private:
|
||||
|
@ -132,7 +132,7 @@ namespace WXSS
|
||||
WXSS::Token offset_24;
|
||||
int offset_116; // 类型未确定
|
||||
std::vector<std::shared_ptr<CSSSyntaxTree>> offset_120;
|
||||
bool offset_132; // 类型未确定,不是布尔值
|
||||
std::shared_ptr<std::string> offset_132; // 类型未确定,不是布尔值
|
||||
std::shared_ptr<std::string> offset_140;
|
||||
std::shared_ptr<std::string[3]> offset_148;
|
||||
std::shared_ptr<Token> offset_156;
|
||||
@ -158,6 +158,14 @@ namespace WXSS
|
||||
std::vector<std::string> offset_4_vecStr;
|
||||
// ~Rule();
|
||||
};
|
||||
|
||||
namespace RuleDebugRule
|
||||
{
|
||||
void InsertOriginSelectorInfo(
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &,
|
||||
int,
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &);
|
||||
}
|
||||
class LexicalChecker
|
||||
{
|
||||
private:
|
||||
|
14
src/wcsc.cpp
14
src/wcsc.cpp
@ -233,7 +233,7 @@ int main(int argc, const char **argv) {
|
||||
|
||||
v96.assign(lt.offset_8);
|
||||
std::map<std::string, std::string> v92;
|
||||
if (!lt.offset_4)
|
||||
if (!lt.offset_0)
|
||||
{
|
||||
int ret = lt.GetCommHead(v72, v94, true, v76);
|
||||
if (ret)
|
||||
@ -245,7 +245,7 @@ int main(int argc, const char **argv) {
|
||||
std::string v98;
|
||||
std::string cur = v72[i];
|
||||
std::string v101 = WXML::Rewrite::ToStringCode(cur);
|
||||
int ret = lt.GetPageCss(v101, v98, 0);
|
||||
ret = lt.GetPageCss(v101, v98, 0);
|
||||
if (ret)
|
||||
{
|
||||
fprintf(stderr, "INFO: GetPageCss fail ret %d", ret);
|
||||
@ -261,6 +261,15 @@ int main(int argc, const char **argv) {
|
||||
v104 << "}";
|
||||
std::string v101 = v104.str();
|
||||
|
||||
if (ret)
|
||||
{
|
||||
fprintf(stderr, "ERR: %s\nerror file count: %d\n", v90.data(), 0);
|
||||
return 1;
|
||||
}
|
||||
fprintf(f, "%s", v88.data());
|
||||
fclose(f);
|
||||
// main - 45
|
||||
return 0;
|
||||
}
|
||||
fprintf(stderr, "ERR: wxss GetCompiledResult: %s, error file count: %d, ret %d", v96.data(), lt.offset_4, lt.offset_0);
|
||||
return 1;
|
||||
@ -280,6 +289,7 @@ int main(int argc, const char **argv) {
|
||||
goto LABEL_102;
|
||||
}
|
||||
int v25 = WXSS::NewLintAndParseCSSList(v77, v72, v88, v90, 0, v37, v75, v76);
|
||||
|
||||
if (v25)
|
||||
{
|
||||
fprintf(stderr, "ERR: %s\nerror file count: %d\n", v90.data(), 0);
|
||||
|
@ -230,5 +230,121 @@ namespace WXML {
|
||||
{
|
||||
return ToStringCode3(src.data(), src.size());
|
||||
}
|
||||
|
||||
void GetToken(std::string const& a1,std::vector<std::pair<int,std::string>> & a2)
|
||||
{
|
||||
for (int i = 0; i < a1.length(); )
|
||||
{
|
||||
int v9 = a1.length() - i;
|
||||
const char* v6 = &a1[i];
|
||||
int v8 = -1;
|
||||
int lt = WXML::RPX::acceptID(v6, v9);
|
||||
if (lt)
|
||||
{
|
||||
lt = 1;
|
||||
if (WXML::RPX::acceptNum(v6, v9))
|
||||
{
|
||||
lt = 2;
|
||||
if (WXML::RPX::acceptStr(v6, v9))
|
||||
{
|
||||
lt = 3;
|
||||
if (!WXML::RPX::acceptSymbol(v6, v9, v8))
|
||||
{
|
||||
lt = (v8 == 7) + 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::string v10(a1.begin() + i, a1.end() - 9);
|
||||
a2.push_back(std::make_pair(lt, v10));
|
||||
i = a1.length() - v9;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int RewriteImg(std::string const& a1, std::string& a2, std::string a3, int a4, int a5)
|
||||
{
|
||||
std::vector<std::pair<int,std::string>> v21;
|
||||
WXML::Rewrite::GetToken(a1, v21);
|
||||
a2 = "";
|
||||
bool v17 = 1;
|
||||
int result = 0;
|
||||
for (int i=0; i < v21.size() - 1; i++)
|
||||
{
|
||||
auto cur = v21[i];
|
||||
if (
|
||||
v21[i].second == "url"
|
||||
&& v21[i + 1].second == "("
|
||||
)
|
||||
{
|
||||
std::string v24 = "";
|
||||
while (v21.size() - 1 > ++i)
|
||||
{
|
||||
if (v21[i].second == ")")
|
||||
{
|
||||
const char*sa = v24.data();
|
||||
while (v24.length() > 0 && (*sa == ' ' || *sa == '\t'))
|
||||
{
|
||||
sa++;
|
||||
}
|
||||
if (
|
||||
!strncmp(sa, "http://", 7)
|
||||
|| !strncmp(sa, "https://", 8)
|
||||
|| !strncmp(sa, "//", 2)
|
||||
|| !strncmp(sa, "data:", 5)
|
||||
)
|
||||
{
|
||||
std::string v26 = "url(" + v24 + ")";
|
||||
a2 += v26;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::stringstream v29;
|
||||
v29 << "url(" << sa << "-do-not-use-local-path-" << a3;
|
||||
v29 << "&" << a4 << "&" << a5 << ")";
|
||||
std::string v26 = v29.str();
|
||||
a2 += v26;
|
||||
result = 1;
|
||||
}
|
||||
if (++i == v21.size() - 1)
|
||||
{
|
||||
v17 = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
auto v5 = v21[i];
|
||||
if (v5.first != 4)
|
||||
{
|
||||
if (v5.first == 2)
|
||||
{
|
||||
std::string v29 = v5.second.substr(1, v5.second.length() - 2);
|
||||
a2 += v29;
|
||||
}
|
||||
else
|
||||
{
|
||||
a2 += v5.second;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
a2 += v21[i].second;
|
||||
}
|
||||
}
|
||||
if (v21.end() != v21.begin() && v17)
|
||||
{
|
||||
a2 += v21.back().second;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
int RewriteRPX(std::string const&,std::string&,char const*,char const*)
|
||||
{
|
||||
|
||||
throw "not implement";
|
||||
}
|
||||
}
|
||||
}
|
980
src/wxml/rpx.cpp
Normal file
980
src/wxml/rpx.cpp
Normal file
@ -0,0 +1,980 @@
|
||||
|
||||
#include "../include/wxml.h"
|
||||
|
||||
namespace WXML
|
||||
{
|
||||
|
||||
namespace RPX
|
||||
{
|
||||
// 0x0051FE20
|
||||
int id_nextPos[0x850u];
|
||||
Table id = {
|
||||
false,
|
||||
id_nextPos,
|
||||
{1210319104,
|
||||
1432641893,
|
||||
539249746,
|
||||
610552100,
|
||||
1600073760,
|
||||
1701603686,
|
||||
24415,
|
||||
1210318848,
|
||||
1432641893,
|
||||
539249746,
|
||||
610552100,
|
||||
1600073760,
|
||||
1701603686,
|
||||
24415,
|
||||
0,
|
||||
1210318848,
|
||||
1432641893,
|
||||
539249746,
|
||||
610552100,
|
||||
1600073760,
|
||||
1701603686,
|
||||
24415,
|
||||
0,
|
||||
-162267136,
|
||||
-161742768,
|
||||
-167575472,
|
||||
-167116720,
|
||||
-166395824,
|
||||
-165150640,
|
||||
-161152944,
|
||||
-160497584,
|
||||
-159514544,
|
||||
-158728112,
|
||||
80,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0}};
|
||||
|
||||
// 0x0051E520
|
||||
int str_nextPos[0x18F0u];
|
||||
Table str = {
|
||||
false,
|
||||
str_nextPos,
|
||||
{0,
|
||||
16777472,
|
||||
1634027556,
|
||||
1280464228,
|
||||
1227104292,
|
||||
807412836,
|
||||
1768316767,
|
||||
1600087404,
|
||||
0,
|
||||
1634027556,
|
||||
1280464228,
|
||||
1227104292,
|
||||
807412836,
|
||||
1768316767,
|
||||
1600087404,
|
||||
0,
|
||||
0,
|
||||
1634027556,
|
||||
1280464228,
|
||||
1227104292,
|
||||
807412836,
|
||||
1768316767,
|
||||
1600087404,
|
||||
0,
|
||||
0,
|
||||
5305940,
|
||||
5305948,
|
||||
5305859,
|
||||
5305866,
|
||||
5305877,
|
||||
5305896,
|
||||
5305957,
|
||||
5305967,
|
||||
5305982,
|
||||
5305994,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0}};
|
||||
|
||||
// 0x0051D040
|
||||
int num_nextPos[0x14C8u];
|
||||
Table num = {
|
||||
false,
|
||||
num_nextPos,
|
||||
{65536,
|
||||
1,
|
||||
0,
|
||||
16777472,
|
||||
1634027556,
|
||||
1280464228,
|
||||
1227104292,
|
||||
807412836,
|
||||
1768316767,
|
||||
1600087404,
|
||||
0,
|
||||
1634027556,
|
||||
1280464228,
|
||||
1227104292,
|
||||
807412836,
|
||||
1768316767,
|
||||
1600087404,
|
||||
0,
|
||||
0,
|
||||
1634027556,
|
||||
1280464228,
|
||||
1227104292,
|
||||
807412836,
|
||||
1768316767,
|
||||
1600087404,
|
||||
0,
|
||||
0,
|
||||
5305940,
|
||||
5305948,
|
||||
5305859,
|
||||
5305866,
|
||||
5305877,
|
||||
5305896,
|
||||
5305957,
|
||||
5305967,
|
||||
5305982,
|
||||
5305994,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0}};
|
||||
|
||||
/**
|
||||
* TODO: 逻辑待验证
|
||||
*/
|
||||
int accept(int *a1, int a2[266], int &a3, char const *a4)
|
||||
{
|
||||
int v4 = 0;
|
||||
int v7 = 0;
|
||||
int i;
|
||||
for (i = a3; i > 0; i--)
|
||||
{
|
||||
int v7 = v4;
|
||||
v4 = a1[266 * v4 + *a4];
|
||||
if (v4 == -1)
|
||||
{
|
||||
break;
|
||||
}
|
||||
a4++;
|
||||
}
|
||||
|
||||
if (a2[v7])
|
||||
{
|
||||
a3 = i;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
int acceptID(char const *a1, int &a2)
|
||||
{
|
||||
if (!id.inited)
|
||||
{
|
||||
// 0x0051FE20
|
||||
memset(id.nextPos, 255, 0x850u);
|
||||
int v2 = 0;
|
||||
id.nextPos[(0x51FF9C - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x5203C4 - 0x0051FE20) / 4] = 1;
|
||||
do
|
||||
{
|
||||
id.nextPos[(0x51FFA4 - 0x0051FE20) / 4 + v2] = 1;
|
||||
id.nextPos[(0x51FF24 - 0x0051FE20) / 4 + v2] = 1;
|
||||
id.nextPos[(0x5203CC - 0x0051FE20) / 4 + v2] = 1;
|
||||
id.nextPos[(0x52034C - 0x0051FE20) / 4 + v2++] = 1;
|
||||
}
|
||||
while(v2 != 26);
|
||||
id.nextPos[(0x520308 - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x52030C - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x520310 - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x520314 - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x520318 - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x52031C - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x520320 - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x520324 - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x520328 - 0x0051FE20) / 4] = 1;
|
||||
id.nextPos[(0x52032C - 0x0051FE20) / 4] = 1;
|
||||
|
||||
id.inited = true;
|
||||
}
|
||||
return accept(id.nextPos, id.canAccept, a2, a1);
|
||||
|
||||
}
|
||||
int acceptStr(char const *a1, int & a2)
|
||||
{
|
||||
if (!str.inited)
|
||||
{
|
||||
// 0x0051E520
|
||||
memset(str.nextPos, 255, 0x18F0u);
|
||||
|
||||
for (int i = 0; i != 256; ++i )
|
||||
{
|
||||
str.nextPos[(0x51E948 - 0x0051E520) / 4 + i] = 1;
|
||||
str.nextPos[(0x51ED70 - 0x0051E520) / 4 + i] = 2;
|
||||
str.nextPos[(0x51F198 - 0x0051E520) / 4 + i] = 1;
|
||||
str.nextPos[(0x51F5C0 - 0x0051E520) / 4 + i] = 2;
|
||||
}
|
||||
str.nextPos[(0x51E5A8 - 0x0051E520) / 4] = 1;
|
||||
str.nextPos[(0x51E5BC - 0x0051E520) / 4] = 2;
|
||||
str.nextPos[(0x51EAB8 - 0x0051E520) / 4] = 3;
|
||||
str.nextPos[(0x51EEE0 - 0x0051E520) / 4] = 4;
|
||||
str.nextPos[(0x51E9D0 - 0x0051E520) / 4] = 5;
|
||||
str.nextPos[(0x51EE0C - 0x0051E520) / 4] = 5;
|
||||
str.inited = true;
|
||||
}
|
||||
return accept(str.nextPos, str.canAccept, a2, a1);
|
||||
}
|
||||
int acceptNum(char const *a1, int & a2)
|
||||
{
|
||||
if (!num.inited)
|
||||
{
|
||||
// 0x0051D040
|
||||
memset(num.nextPos, 255, 0x18F0u);
|
||||
int v2 = 0;
|
||||
num.nextPos[(0x51D0EC - 0x0051D040) / 4] = 1;
|
||||
num.nextPos[(0x51D0F4 - 0x0051D040) / 4] = 1;
|
||||
num.nextPos[(0x51D0F8 - 0x0051D040) / 4] = 3;
|
||||
num.nextPos[(0x51D520 - 0x0051D040) / 4] = 3;
|
||||
num.nextPos[(0x51D948 - 0x0051D040) / 4] = 4;
|
||||
do
|
||||
{
|
||||
num.nextPos[(0x51D100 - 0x0051D040) / 4 + v2] = 2;
|
||||
num.nextPos[(0x51D528 - 0x0051D040) / 4 + v2] = 2;
|
||||
num.nextPos[(0x51D950 - 0x0051D040) / 4 + v2] = 2;
|
||||
num.nextPos[(0x51DD78 - 0x0051D040) / 4 + v2] = 4;
|
||||
num.nextPos[(0x51E1A0 - 0x0051D040) / 4 + v2++] = 4;
|
||||
}
|
||||
while ( v2 != 10 );
|
||||
num.inited = true;
|
||||
}
|
||||
return accept(num.nextPos, num.canAccept, a2, a1);
|
||||
}
|
||||
int acceptSymbol(char const *a1, int &a2, int &a3)
|
||||
{
|
||||
const char *v3 = a1;
|
||||
int v4 = a2;
|
||||
int v5 = a2 - 1;
|
||||
a2 = v5;
|
||||
switch (a1[1])
|
||||
{
|
||||
case '(':
|
||||
a3 = 3;
|
||||
break;
|
||||
case ')':
|
||||
a3 = 4;
|
||||
break;
|
||||
case '+':
|
||||
a3 = 1;
|
||||
break;
|
||||
case ',':
|
||||
a3 = 6;
|
||||
break;
|
||||
case '-':
|
||||
a3 = 2;
|
||||
case '.':
|
||||
a3 = 5;
|
||||
break;
|
||||
|
||||
default:
|
||||
a2 = v4;
|
||||
if (a1[0] == ' ' || a1[0] == '\t')
|
||||
{
|
||||
while (a2 > 0 && (*v3 == ' ' || *v3 == '\t'))
|
||||
{
|
||||
v3++;
|
||||
a2--;
|
||||
}
|
||||
a3 = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
a2 = v5;
|
||||
a3 = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ namespace WXSS
|
||||
{
|
||||
if (this->offset_132 && a3)
|
||||
{
|
||||
a2 += this->offset_132;
|
||||
a2 += *this->offset_132;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,9 +1,309 @@
|
||||
#include "../../include/wxss.h"
|
||||
#include "../../include/wxml.h"
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <strings.h>
|
||||
|
||||
namespace WXSS
|
||||
{
|
||||
namespace CSSTreeLib
|
||||
{
|
||||
|
||||
int off_519A58(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::MarkHostRule::MarkGood
|
||||
for (auto lt = a2->offset_120.begin(); lt != a2->offset_120.end(); lt++)
|
||||
{
|
||||
if (lt->get()->offset_0 == "SELECTORS")
|
||||
{
|
||||
auto v2 = lt->get()->offset_120;
|
||||
if (v2.size() == 1)
|
||||
{
|
||||
auto v3 = v2.front().get();
|
||||
if (v3->offset_0 == "F_SELECTOR")
|
||||
{
|
||||
auto v4 = v2.front()->offset_120;
|
||||
if (v4.size() > 1)
|
||||
{
|
||||
auto v12 = v4[1];
|
||||
if (v12->offset_0 == "$NAME")
|
||||
{
|
||||
auto lit = v12->offset_24.GetLiteral();
|
||||
if (!strncmp(lit.data(), "host", 4))
|
||||
{
|
||||
a2->offset_172 = 1;
|
||||
if (v4.size() == 5)
|
||||
{
|
||||
auto lb = v4[3].get();
|
||||
if (lb->offset_0 == "SELECTOR")
|
||||
{
|
||||
auto v13 = lb->offset_120;
|
||||
if (v13.end() != v13.begin())
|
||||
{
|
||||
auto lc = v13[0];
|
||||
if (
|
||||
lc->offset_0 == "$NAME"
|
||||
&& lc->offset_24.GetLiteral()[0] == '.'
|
||||
)
|
||||
{
|
||||
a2->offset_172 = 2;
|
||||
if (nullptr == v13[0]->offset_132.get())
|
||||
{
|
||||
std::shared_ptr<std::string> v6(new std::string());
|
||||
|
||||
v13[0]->offset_132 = v6;
|
||||
}
|
||||
auto v7 = v13[0]->offset_24.GetLiteral();
|
||||
auto v23 = v7.substr(1);
|
||||
v23.insert(0, ".%%HERESUFFIX%%");
|
||||
*v13[0]->offset_132 = v23;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
int off_519A70(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::AttrDebugRule::MarkGood
|
||||
auto v9 = a2->offset_168;
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> la(new WXSS::CSSTreeLib::CSSSyntaxTree());
|
||||
std::stringstream v26;
|
||||
bool v11 = false;
|
||||
bool v12 = false;
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> v20;
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> v22;
|
||||
for(int i = 0; i < a2->offset_120.size(); i++)
|
||||
{
|
||||
auto cur = a2->offset_120[i];
|
||||
if (!v12)
|
||||
{
|
||||
v12 = cur->offset_0 == "$NAME";
|
||||
if (v12)
|
||||
{
|
||||
v20 = cur;
|
||||
}
|
||||
}
|
||||
if (!v11)
|
||||
{
|
||||
v11 = cur->offset_0 == "$ESV";
|
||||
if (v11)
|
||||
{
|
||||
v22 = cur;
|
||||
}
|
||||
}
|
||||
}
|
||||
bool v13 = v11 && v12;
|
||||
if (v13)
|
||||
{
|
||||
v26 << ";wxcs_style_";
|
||||
std::string lit = v20->offset_24.GetLiteral();
|
||||
v26 << lit << " : ";
|
||||
v26 << v22->offset_24.GetLiteral();
|
||||
v26 << ";";
|
||||
std::shared_ptr<CSSSyntaxTree> v18(new CSSSyntaxTree());
|
||||
v18->offset_0 = "FAKE_ATTR";
|
||||
|
||||
std::shared_ptr<std::string> v24(new std::string());
|
||||
*v24 = v26.str();
|
||||
|
||||
v18->offset_24.offset_4 = v24;
|
||||
v18->offset_164 = v9 + 1;
|
||||
v18->offset_168 = v9 + 2;
|
||||
|
||||
a2->offset_120.push_back(v18);
|
||||
a2->offset_116 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
a2->offset_116 = 0;
|
||||
}
|
||||
return v13;
|
||||
}
|
||||
int off_519A88(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::BlackListRule::MarkGood
|
||||
auto lit = a2->offset_24.GetLiteral();
|
||||
for (int i = 0; i < a1->offset_4_vecStr.size(); i++) {
|
||||
std::string cur = a1->offset_4_vecStr[i];
|
||||
if (!strcasecmp(cur.data(), lit.data()))
|
||||
{
|
||||
a2->offset_116 = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return a2->offset_116;
|
||||
}
|
||||
int off_519AA0(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::RuleDebugRule::MarkGood
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> v21;
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> v23;
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> v25;
|
||||
for (int i = 0; i < a2->offset_120.size(); i++)
|
||||
{
|
||||
auto cur = a2->offset_120[i];
|
||||
if (cur->offset_0 == "ATTRS")
|
||||
{
|
||||
v21 = cur;
|
||||
}
|
||||
else if (cur->offset_0 == "{")
|
||||
{
|
||||
v23 = cur;
|
||||
}
|
||||
}
|
||||
auto v11 = v21->offset_168;
|
||||
auto v17 = a2->offset_120[0];
|
||||
bool la = false;
|
||||
for (auto cur = a2->offset_120.begin(); cur != a2->offset_120.end(); cur++)
|
||||
{
|
||||
if ((*cur)->offset_0 == "SELECTORS")
|
||||
{
|
||||
WXSS::CSSTreeLib::RuleDebugRule::InsertOriginSelectorInfo(v17, v11 + 1, v21);
|
||||
auto v15 = v17->offset_120;
|
||||
for (auto v15_i = v15.begin(); v15_i != v15.end(); v15_i++)
|
||||
{
|
||||
if (
|
||||
(*v15_i)->offset_0 == "SELECTOR"
|
||||
|| (*v15_i)->offset_0 == "U_SELECTOR"
|
||||
|| (*v15_i)->offset_0 == "F_SELECTOR"
|
||||
)
|
||||
{
|
||||
v25 = (*v15_i)->offset_120[0];
|
||||
la = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (la)
|
||||
{
|
||||
std::stringstream v31;
|
||||
v31 << ";wxcs_fileinfo: ";
|
||||
v31 << a2->offset_148[0];
|
||||
v31 << " " << v25->offset_24.offset_20;
|
||||
v31 << " " << v25->offset_24.offset_24 << ";";
|
||||
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> v18(new WXSS::CSSTreeLib::CSSSyntaxTree());
|
||||
v18->offset_0 = "FAKE_ATTR";
|
||||
std::shared_ptr<std::string> v29(new std::string());
|
||||
*v29 = v31.str();
|
||||
v18->offset_24.offset_4 = v29;
|
||||
v18->offset_24.offset_0 = 3;
|
||||
v18->offset_164 = v11 + 2;
|
||||
v18->offset_168 = v11 + 3;
|
||||
|
||||
v21->offset_120.push_back(v18);
|
||||
a2->offset_116 = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
a2->offset_116 = 0;
|
||||
}
|
||||
return la;
|
||||
}
|
||||
int off_519AB8(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::ReWriteRpxRule::MarkGood
|
||||
auto lit = a2->offset_24.GetLiteral();
|
||||
std::string v9;
|
||||
if (WXML::Rewrite::RewriteRPX(lit, v9, "%%?", "?%%"))
|
||||
{
|
||||
std::shared_ptr<std::string> str(new std::string());
|
||||
*str = v9;
|
||||
a2->offset_132 = str;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int off_519AD0(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::MarkSelectorRule::MarkGood
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519AE8(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::RewriteImgUrlRule::MarkGood
|
||||
std::string lit = a2->offset_24.GetLiteral();
|
||||
std::string v10;
|
||||
auto la = a2->offset_24.offset_24;
|
||||
int v5 = WXML::Rewrite::RewriteImg(lit, v10, a2->offset_148[0], a2->offset_24.offset_20, la);
|
||||
if (!v5)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
if (v5 == 1)
|
||||
{
|
||||
std::shared_ptr<std::string> str(new std::string());
|
||||
*str = v10;
|
||||
a2->offset_132 = str;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int off_519B40(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::AndRules::MarkGood
|
||||
for (int i=0; i < a1->offset_4_vecPtr.size(); i++)
|
||||
{
|
||||
auto cur = a1->offset_4_vecPtr[i];
|
||||
int ret = cur->offset_0(cur, a2);
|
||||
if (!ret)
|
||||
{
|
||||
a2->offset_116 = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
a2->offset_116 = 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int off_519B6C(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
// WXSS::CSSTreeLib::TrueRule::MarkGood
|
||||
a2->offset_116 = 1;
|
||||
return 1;
|
||||
}
|
||||
/**
|
||||
* WXSS::CSSTreeLib::ChildRule::MarkGood
|
||||
*/
|
||||
int off_519B84(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
int v8 = 1;
|
||||
for (int j = 0; j < a2->offset_120.size(); j++)
|
||||
{
|
||||
auto v6 = a2->offset_120[j];
|
||||
for (auto i = a1->offset_4_vecPair.begin(); i != a1->offset_4_vecPair.end(); i++)
|
||||
{
|
||||
if (i->first == v6->offset_0)
|
||||
{
|
||||
v8 &= i->second->offset_0(i->second, v6);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
a2->offset_116 = v8;
|
||||
return v8;
|
||||
}
|
||||
int off_519B9C(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
/**
|
||||
* 00519BB4 - WXSS::CSSTreeLib::RuleChain::MarkGood
|
||||
*
|
||||
*/
|
||||
int off_519BB4(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
int ret = 0;
|
||||
@ -16,59 +316,10 @@ namespace WXSS
|
||||
a2->offset_116 = ret;
|
||||
return ret;
|
||||
}
|
||||
|
||||
int off_519B6C(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519B9C(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519AA0(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519A58(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
|
||||
/**
|
||||
* WXSS::CSSTreeLib::ChildRule::MarkGood
|
||||
*/
|
||||
int off_519B84(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519B40(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519BCC(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519A88(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519AB8(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519A70(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519AE8(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
int off_519AD0(std::shared_ptr<WXSS::CSSTreeLib::Rule>& a1, std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &a2)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
|
||||
LexicalChecker::LexicalChecker(/* args */)
|
||||
{
|
||||
|
@ -61,6 +61,8 @@ namespace WXSS
|
||||
|
||||
// Parse - 15
|
||||
std::shared_ptr<std::string[3]> v9(new std::string[3]());
|
||||
v9[0].assign(a3);
|
||||
v9[1].assign(a5);
|
||||
std::shared_ptr<WXSS::Token> v14(new WXSS::Token());
|
||||
v14->offset_4.reset(new std::string());
|
||||
|
||||
|
@ -4,8 +4,16 @@ namespace WXSS
|
||||
{
|
||||
namespace CSSTreeLib
|
||||
{
|
||||
Rule::~Rule()
|
||||
namespace RuleDebugRule
|
||||
{
|
||||
void InsertOriginSelectorInfo(
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &,
|
||||
int,
|
||||
std::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree> &)
|
||||
{
|
||||
throw "not implement";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -316,6 +316,7 @@ namespace WXSS
|
||||
int v41 = 1;
|
||||
int v35 = 1;
|
||||
int v31 = 0;
|
||||
WXSS::TokenType AnotherTypeByAnySubStr = 0;
|
||||
for (int sa = 0; ; sa = v31)
|
||||
{
|
||||
if (v47 > this->offset_0.length())
|
||||
@ -334,7 +335,6 @@ namespace WXSS
|
||||
}
|
||||
v44 = v10;
|
||||
int lt = this->TT[1024 * v4 + 2 * v10];
|
||||
WXSS::TokenType AnotherTypeByAnySubStr;
|
||||
AnotherTypeByAnySubStr = this->TryGetAnotherTypeByAnySubStr(this->offset_0.data(), v47, v4, AnotherTypeByAnySubStr);
|
||||
|
||||
if (!lt)
|
||||
|
@ -10193,7 +10193,7 @@ void __cdecl WXML::Rewrite::GetToken(int a1, int a2)
|
||||
v2 = *(_DWORD *)(a1 + 4);
|
||||
while ( 1 )
|
||||
{
|
||||
v5 = v2;
|
||||
v5 = v2; // 剩余长度
|
||||
if ( v2 <= 0 )
|
||||
break;
|
||||
v8 = -1;
|
||||
@ -10234,8 +10234,9 @@ void __cdecl WXML::Rewrite::GetToken(int a1, int a2)
|
||||
}
|
||||
std::string::_M_dispose(v13);
|
||||
std::string::_M_dispose(v10);
|
||||
v2 = *(_DWORD *)v9;
|
||||
v6 = (WXML::RPX *)((char *)v6 + v5 - *(_DWORD *)v9);
|
||||
v2 = *(_DWORD *)v9; // 剩余长度
|
||||
// v6 + v5 最后一个字符后的指针
|
||||
v6 = (WXML::RPX *)((char *)v6 + v5 - *(_DWORD *)v9); // 当前指针位置
|
||||
}
|
||||
}
|
||||
|
||||
@ -10375,32 +10376,33 @@ int __cdecl WXML::Rewrite::RewriteImg(int a1, unsigned int **a2, int *a3, int a4
|
||||
v22 = 0;
|
||||
v23 = 0;
|
||||
WXML::Rewrite::GetToken(a1, (int)&v21);
|
||||
std::string::operator=(a2, (char *)&byte_50F1AA);
|
||||
std::string::operator=(a2, (char *)&byte_50F1AA); // '\0'
|
||||
v17 = 1;
|
||||
lpuexcpt = 1;
|
||||
v15 = 0;
|
||||
while ( lpuexcpt < -1227133513 * ((v22 - v21) >> 2) )
|
||||
{
|
||||
Str1 = (char *)(28 * (lpuexcpt - 1));
|
||||
if ( !std::string::compare((int)&Str1[(_DWORD)v21 + 4], (char *)off_50F1C8)
|
||||
if ( !std::string::compare((int)&Str1[(_DWORD)v21 + 4], (char *)off_50F1C8) // "url"
|
||||
&& !std::string::compare((int)&Str1[(_DWORD)v21 + 32], "(") )
|
||||
{
|
||||
std::string::basic_string((void **)&v24, (char *)&byte_50F1AA);
|
||||
std::string::basic_string((void **)&v24, (char *)&byte_50F1AA); // '\0'
|
||||
while ( -1227133513 * ((v22 - v21) >> 2) > ++lpuexcpt )
|
||||
{
|
||||
if ( !std::string::compare((int)&v21[28 * lpuexcpt + 4], ")") )
|
||||
{
|
||||
v14 = v25;
|
||||
for ( Str1a = v24; &v24[v25] - Str1a > 0 && (*Str1a == 32 || *Str1a == 9); ++Str1a )
|
||||
for ( Str1a = v24; &v24[v25] - Str1a > 0 && (*Str1a == ' '/*32*/ || *Str1a == '\t'/*9*/); ++Str1a )
|
||||
;
|
||||
if ( !strncmp(Str1a, "http://", 7u)
|
||||
|| !strncmp(Str1a, "https://", 8u)
|
||||
|| !strncmp(Str1a, "//", 2u)
|
||||
|| !strncmp(Str1a, "data:", 5u) )
|
||||
{
|
||||
v27 = 0;
|
||||
v26 = (int)&v28;
|
||||
v27 = 0;
|
||||
v28 = 0;
|
||||
|
||||
std::string::reserve(&v26, v14 + 4);
|
||||
if ( (unsigned int)(0x3FFFFFFF - v27) <= 3 )
|
||||
std::__throw_length_error((std::length_error *)"basic_string::append");
|
||||
@ -44633,6 +44635,7 @@ void __fastcall WXSS::CSSTreeLib::NonTerminal::~NonTerminal(void *a1)
|
||||
operator delete(a1);
|
||||
}
|
||||
|
||||
// off_519A58
|
||||
//----- (004430BC) --------------------------------------------------------
|
||||
char __stdcall WXSS::CSSTreeLib::MarkHostRule::MarkGood(
|
||||
WXSS::CSSTreeLib::MarkHostRule *this,
|
||||
@ -44671,8 +44674,9 @@ char __stdcall WXSS::CSSTreeLib::MarkHostRule::MarkGood(
|
||||
if ( *(_DWORD *)(*lpuexcpt + 124) - (_DWORD)v2 == 8 )
|
||||
{
|
||||
v3 = **v2;
|
||||
if ( *(_BYTE *)v3 == 70 && !strcmp((const char *)(v3 + 1), "_SELECTOR") )
|
||||
if ( *(_BYTE *)v3 == 'F'/*70*/ && !strcmp((const char *)(v3 + 1), "_SELECTOR") )
|
||||
{
|
||||
// v2
|
||||
std::__shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree,(__gnu_cxx::_Lock_policy)2>::__shared_ptr(&v18[1], v11);
|
||||
v4 = *(struct _Unwind_Exception **)(*(_DWORD *)&v18[1] + 120);
|
||||
lpuexcpta = v4;
|
||||
@ -44696,7 +44700,7 @@ char __stdcall WXSS::CSSTreeLib::MarkHostRule::MarkGood(
|
||||
{
|
||||
lpuexcptc = *v13;
|
||||
if ( !strcmp(*(const char **)*v13, "$NAME")
|
||||
&& *WXSS::Token::GetLiteral((_DWORD *)lpuexcptc + 6) == 46 )
|
||||
&& *WXSS::Token::GetLiteral((_DWORD *)lpuexcptc + 6) == '.'/*46*/ )
|
||||
{
|
||||
*((_DWORD *)this + 43) = 2;
|
||||
std::__shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree,(__gnu_cxx::_Lock_policy)2>::__shared_ptr(
|
||||
@ -44704,9 +44708,9 @@ char __stdcall WXSS::CSSTreeLib::MarkHostRule::MarkGood(
|
||||
v13);
|
||||
if ( !*(_DWORD *)(v20 + 132) )
|
||||
{
|
||||
v6 = operator new(0x18u);
|
||||
v6[1] = 0;
|
||||
v6 = operator new(0x18u); // std::string
|
||||
*v6 = v6 + 2;
|
||||
v6[1] = 0;
|
||||
*((_BYTE *)v6 + 8) = 0;
|
||||
zcc::shared_ptr<std::string>::shared_ptr(v6);
|
||||
std::__shared_ptr<std::string,(__gnu_cxx::_Lock_policy)2>::operator=(
|
||||
@ -44746,6 +44750,7 @@ void __fastcall WXSS::CSSTreeLib::MarkHostRule::~MarkHostRule(void *a1)
|
||||
operator delete(a1);
|
||||
}
|
||||
|
||||
// off_519A70
|
||||
//----- (0044345C) --------------------------------------------------------
|
||||
bool __stdcall WXSS::CSSTreeLib::AttrDebugRule::MarkGood(
|
||||
WXSS::CSSTreeLib::AttrDebugRule *this,
|
||||
@ -44793,6 +44798,7 @@ bool __stdcall WXSS::CSSTreeLib::AttrDebugRule::MarkGood(
|
||||
while ( 1 )
|
||||
{
|
||||
v2 = *((_DWORD *)this + 30);
|
||||
// lpuexcpt 索引
|
||||
if ( (*((_DWORD *)this + 31) - v2) >> 3 <= (unsigned int)lpuexcpt )
|
||||
break;
|
||||
if ( !v12 )
|
||||
@ -44823,6 +44829,7 @@ bool __stdcall WXSS::CSSTreeLib::AttrDebugRule::MarkGood(
|
||||
v5 = (char *)WXSS::Token::GetLiteral((_DWORD *)v22 + 6);
|
||||
v6 = std::operator<<<std::char_traits<char>>(lpuexcptc, v5);
|
||||
std::operator<<<std::char_traits<char>>(v6, ";");
|
||||
|
||||
std::string::operator=(v18, "FAKE_ATTR");
|
||||
Block = operator new(0x18u);
|
||||
std::stringbuf::str((int)Block, (int)v28);
|
||||
@ -44830,8 +44837,12 @@ bool __stdcall WXSS::CSSTreeLib::AttrDebugRule::MarkGood(
|
||||
std::__shared_ptr<std::string,(__gnu_cxx::_Lock_policy)2>::operator=((volatile signed __int32 **)v18 + 7, &v24);
|
||||
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v25);
|
||||
v7 = v18;
|
||||
// v18->offset_24
|
||||
v18[6] = (unsigned int *)3;
|
||||
|
||||
// v18->offset_164
|
||||
v7[41] = (unsigned int *)(v9 + 1);
|
||||
// v18->offset_168
|
||||
v7[42] = (unsigned int *)(v9 + 2);
|
||||
std::vector<zcc::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>>::push_back((void **)this + 30, &v18);
|
||||
*((_BYTE *)this + 116) = 1;
|
||||
@ -44855,6 +44866,7 @@ void __fastcall WXSS::CSSTreeLib::AttrDebugRule::~AttrDebugRule(void *a1)
|
||||
operator delete(a1);
|
||||
}
|
||||
|
||||
// off_519A88
|
||||
//----- (0044385C) --------------------------------------------------------
|
||||
char __userpurge WXSS::CSSTreeLib::BlackListRule::MarkGood@<al>(
|
||||
int a1@<ecx>,
|
||||
@ -45228,6 +45240,7 @@ void __stdcall WXSS::CSSTreeLib::RuleDebugRule::InsertOriginSelectorInfo(int *a1
|
||||
// 4440A8: using guessed type char var_D0[4];
|
||||
// 4440A8: using guessed type char var_CC[204];
|
||||
|
||||
// off_519AA0
|
||||
//----- (00444380) --------------------------------------------------------
|
||||
bool __stdcall WXSS::CSSTreeLib::RuleDebugRule::MarkGood(
|
||||
WXSS::CSSTreeLib::RuleDebugRule *this,
|
||||
@ -45277,6 +45290,7 @@ bool __stdcall WXSS::CSSTreeLib::RuleDebugRule::MarkGood(
|
||||
if ( (*((_DWORD *)this + 31) - v2) >> 3 <= (unsigned int)lpuexcpt )
|
||||
break;
|
||||
v12 = 8 * (_DWORD)lpuexcpt;
|
||||
// cur
|
||||
v14 = std::operator==<char>(*(_DWORD *)(v2 + 8 * (_DWORD)lpuexcpt), "ATTRS");
|
||||
v3 = *((_DWORD *)this + 30);
|
||||
if ( v14 )
|
||||
@ -45309,13 +45323,16 @@ bool __stdcall WXSS::CSSTreeLib::RuleDebugRule::MarkGood(
|
||||
{
|
||||
std::__shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree,(__gnu_cxx::_Lock_policy)2>::__shared_ptr(&v31, &v21);
|
||||
std::__shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree,(__gnu_cxx::_Lock_policy)2>::__shared_ptr(&v29, v17);
|
||||
// WXSS::CSSTreeLib::RuleDebugRule::InsertOriginSelectorInfo(zcc::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>,int,zcc::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>)
|
||||
WXSS::CSSTreeLib::RuleDebugRule::InsertOriginSelectorInfo((int *)&v29, (unsigned int *)(v11 + 1), (int)&v31);
|
||||
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v30);
|
||||
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v32);
|
||||
v15 = *(int **)(*v17 + 120);
|
||||
while ( !lpuexcpta )
|
||||
{
|
||||
if ( *(int **)(*v17 + 124) == v15 )
|
||||
if ( *(int **)(*v17 + 124) == v15 ) // end == v15
|
||||
// lpuexcpta = false
|
||||
// v13 = true
|
||||
goto LABEL_16;
|
||||
if ( std::operator==<char>(*v15, "SELECTOR")
|
||||
|| std::operator==<char>(*v15, "U_SELECTOR")
|
||||
@ -45324,14 +45341,16 @@ bool __stdcall WXSS::CSSTreeLib::RuleDebugRule::MarkGood(
|
||||
std::__shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree,(__gnu_cxx::_Lock_policy)2>::operator=(
|
||||
&v25,
|
||||
*(volatile signed __int32 ***)(*v15 + 120));
|
||||
// v13 -> true; break
|
||||
lpuexcpta = v13;
|
||||
}
|
||||
v15 += 2;
|
||||
v15 += 2; // next
|
||||
}
|
||||
// lpuexcpta = true
|
||||
v13 = lpuexcpta;
|
||||
}
|
||||
LABEL_16:
|
||||
v17 += 2;
|
||||
LABEL_16:
|
||||
v17 += 2; // next
|
||||
}
|
||||
while ( !v13 );
|
||||
if ( lpuexcpta )
|
||||
@ -45344,6 +45363,7 @@ LABEL_16:
|
||||
std::operator<<<std::char_traits<char>>(v6, " ");
|
||||
v7 = (std::ostream::sentry *)std::ostream::operator<<(*((_DWORD *)v25 + 12));
|
||||
std::operator<<<std::char_traits<char>>(v7, ";");
|
||||
|
||||
v18 = operator new(0xB0u);
|
||||
WXSS::CSSTreeLib::CSSSyntaxTree::CSSSyntaxTree((int)v18);
|
||||
zcc::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>::shared_ptr(v18);
|
||||
@ -45354,8 +45374,11 @@ LABEL_16:
|
||||
std::__shared_ptr<std::string,(__gnu_cxx::_Lock_policy)2>::operator=((volatile signed __int32 **)v27 + 7, &v29);
|
||||
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v30);
|
||||
v8 = v27;
|
||||
// v18->offset_24
|
||||
v27[6] = (unsigned int *)3;
|
||||
// v18->offset_164
|
||||
v8[41] = (unsigned int *)(v11 + 2);
|
||||
// v18->offset_168
|
||||
v8[42] = (unsigned int *)(v11 + 3);
|
||||
std::vector<zcc::shared_ptr<WXSS::CSSTreeLib::CSSSyntaxTree>>::push_back((void **)v21 + 30, &v27);
|
||||
std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count(&v28);
|
||||
@ -46131,12 +46154,15 @@ char __stdcall WXSS::CSSTreeLib::RewriteImgUrlRule::MarkGood(
|
||||
|
||||
Literal = (char *)WXSS::Token::GetLiteral((_DWORD *)this + 6);
|
||||
std::string::basic_string(v9, Literal, (int)&v12);
|
||||
v10[1] = 0;
|
||||
|
||||
v10[0] = &v11;
|
||||
v10[1] = 0;
|
||||
|
||||
v11 = 0;
|
||||
lpuexcpta = (struct _Unwind_Exception *)*((_DWORD *)this + 12);
|
||||
v4 = *((_DWORD *)this + 11);
|
||||
std::string::basic_string((char *)&v12, *((_DWORD *)this + 37));
|
||||
// WXML::Rewrite::RewriteImg(std::string const&,std::string&,std::string,int,int)
|
||||
v5 = WXML::Rewrite::RewriteImg((int)v9, (unsigned int **)v10, &v12, v4, (int)lpuexcpta);
|
||||
std::string::_M_dispose((void **)&v12);
|
||||
if ( !v5 )
|
||||
@ -46510,6 +46536,7 @@ void __fastcall WXSS::CSSTreeLib::TrueRule::~TrueRule(void *a1)
|
||||
operator delete(a1);
|
||||
}
|
||||
|
||||
// off_519B84
|
||||
//----- (00446C90) --------------------------------------------------------
|
||||
char __userpurge WXSS::CSSTreeLib::ChildRule::MarkGood@<al>(
|
||||
int a1@<ecx>,
|
||||
@ -46524,6 +46551,7 @@ char __userpurge WXSS::CSSTreeLib::ChildRule::MarkGood@<al>(
|
||||
|
||||
v3 = 0;
|
||||
v8 = 1;
|
||||
// a2->offset_124 a2->offset_120
|
||||
while ( (*((_DWORD *)this + 31) - *((_DWORD *)this + 30)) >> 3 > v3 )
|
||||
{
|
||||
for ( i = *(_DWORD *)(a1 + 4); *(_DWORD *)(a1 + 8) != i; i += 32 )
|
||||
@ -180373,6 +180401,7 @@ int __cdecl main(int argc, const char **argv, const char **envp)
|
||||
v51 = v79;
|
||||
v61 = (int *)v79;
|
||||
v46 = &v78;
|
||||
// int *v61
|
||||
while ( v61 )
|
||||
{
|
||||
v11 = (unsigned __int8)std::operator<<char>((int)(v61 + 4), (int)v76) == 0;
|
||||
@ -180415,9 +180444,12 @@ int __cdecl main(int argc, const char **argv, const char **envp)
|
||||
if ( insert_hint_unique_pos == &v78
|
||||
|| (unsigned __int8)std::operator<<char>((int)v76, (int)(insert_hint_unique_pos + 4)) )
|
||||
{
|
||||
// char* Block
|
||||
Block = (char *)operator new(0x40u);
|
||||
std::string::basic_string(Block + 16, (int)v76);
|
||||
// block->offset_16
|
||||
*((_DWORD *)Block + 11) = 0;
|
||||
// block->offset_44
|
||||
Block[48] = 0;
|
||||
*((_DWORD *)Block + 10) = Block + 48;
|
||||
insert_hint_unique_pos = (int *)std::_Rb_tree<std::string,std::pair<std::string const,std::string>,std::_Select1st<std::pair<std::string const,std::string>>,std::less<std::string>,std::allocator<std::pair<std::string const,std::string>>>::_M_get_insert_hint_unique_pos(
|
||||
|
Loading…
x
Reference in New Issue
Block a user