feat: 增加一些方法

This commit is contained in:
msojocs 2023-07-25 16:46:37 +08:00
parent 4a46920418
commit 5e4c598e37
9 changed files with 387 additions and 139 deletions

View File

@ -63,8 +63,9 @@ namespace night
public:
std::string offset_0;
std::string offset_24;
int offset_48;
int offset_52;
int offset_48 = 0;
int offset_52 = 0;
int offset_56 = 0;
std::string offset_60;
std::string offset_84;
std::string offset_108;
@ -77,10 +78,15 @@ namespace night
std::vector<night::ns_node *>* offset_196 = nullptr;
bool offset_200 = false;
night::ns_node * offset_204 = nullptr;
night::ns_node * offset_208 = nullptr;
night::ns_node * offset_212 = nullptr;
night::ns_node * offset_216 = nullptr;
night::ns_node * offset_220 = nullptr;
std::vector<std::vector<night::ns_node *>*> offset_224;
std::vector<night::ns_node *>* offset_228 = nullptr;
std::vector<night::ns_node *>* offset_232 = nullptr;
std::vector<std::vector<night::ns_node *>*>* offset_236 = nullptr;
std::vector<night::ns_node *>* offset_240 = nullptr;
ns_node(/* args */);
~ns_node();
std::string debug_no_space(void);
@ -131,6 +137,8 @@ namespace night
NSStream(/* args */);
NSStream(std::string const&,std::string const&,uint);
~NSStream();
NSStream(NSStream const&);
NSStream& operator=(NSStream const&);
bool eof(void);
bool eof_2(void);
void err(std::string const&,int,int,bool);
@ -144,8 +152,8 @@ namespace night
private:
/* data */
public:
NSGod offset_0;
NSStream offset_4; // 不是int
NSGod* offset_0 = nullptr;
NSStream * offset_4 = nullptr;
night::ns_node* offset_8 = nullptr;
std::vector<night::ns_node *> offset_12;
std::map<std::string, unsigned int> offset_24;
@ -183,10 +191,10 @@ namespace night
std::string offset_0;
night::NSGod * offset_24 = nullptr;
night::NSToken * offset_28 = nullptr;
int offset_36;
int offset_40;
int offset_32 = 0;
int offset_36 = 0;
int offset_40 = 0;
std::string offset_44;
int offset_52;
public:
NSASTParse(/* args */);
NSASTParse(std::string, night::NSToken *, night::NSGod *);
@ -306,7 +314,7 @@ namespace night
namespace str
{
std::string get_token(std::string const&, int);
bool path_combine(
int path_combine(
std::string const&,
std::string const&,
std::string&

View File

@ -60,11 +60,14 @@ namespace night
night::NSStream v38(a1, a3, a4);
night::NSToken v27;
night::NSGod v17;
v27.offset_0 = &v17;
v27.offset_4 = &v38;
night::NSASTParse v39(a1, &v27, &v17);
NSCompileJs cjs;
std::string v19;
std::vector<std::string> v18;
cjs.offset_24 = &v39;
cjs.offset_48 = 1;
std::string v21 = cjs.compile_once(v19, &v18, a6);
v17.hamlet();
if (v21.length())

View File

@ -15,7 +15,6 @@ namespace night
this->offset_36 = 0;
this->offset_40 = 0;
this->offset_44 = "";
this->offset_52 = 0;
}
NSASTParse::~NSASTParse()
@ -378,8 +377,8 @@ namespace night
{
auto v3 = this->offset_28->offset_4;
auto v61 = this->offset_28;
int v27;
int v30;
int v27 = v3->offset_52;
int v30 = v3->offset_56;
std::string v81 = "Unexpected statement[" + v80->offset_0 + "]";
this->offset_28->err(v81, v27, v30, 1);
}
@ -437,8 +436,8 @@ namespace night
{
auto v3 = this->offset_28->next();
auto v4 = this->offset_28->offset_4;
int v15 = v4.offset_52;
int v16 = v4.offset_56;
int v15 = v4->offset_52;
int v16 = v4->offset_56;
if ("?" == v3->offset_60)
{
auto v19 = this->ast_ternary_expression();
@ -517,27 +516,112 @@ namespace night
night::ns_node *NSASTParse::ast_ternary_expression()
{
printf("ast_ternary_expression\n");
}
night::ns_node *NSASTParse::ast_obj_dot(night::ns_node*)
{
printf("ast_obj_dot\n");
}
night::ns_node *NSASTParse::ast_obj_op(night::ns_node*)
{
printf("ast_obj_op\n");
}
night::ns_node *NSASTParse::ast_call(night::ns_node*)
{
printf("ast_call\n");
}
night::ns_node *NSASTParse::ast_function()
{
printf("ast_function\n");
}
night::ns_node *NSASTParse::ast_var()
{
printf("ast_var\n");
}
night::ns_node *NSASTParse::ast_trans_kw()
{
auto v1 = this->offset_28;
auto v2 = v1->offset_4;
auto v19 = v2->offset_52;
auto v20 = v2->offset_56;
auto v24 = v1->next();
std::string v43 = v24->offset_60;
night::ns_node *v3;
if ("true" == v43 || "false" == v43)
{
v3 = this->offset_24->gen_son(night::NS_TYPE_BOOL);
// goto LABEL_31;
}
if (
"null" == v43
|| "undefined" == v43
|| "NaN" == v43
|| "Infinity" == v43
)
{
auto son = this->offset_24->gen_son(night::NS_TYPE_KW);
son->offset_24.assign(v24->offset_24);
son->offset_48 = v24->offset_48;
son->offset_52 = v24->offset_52;
son->offset_60.assign(v43);
return son;
}
if (
"return" == v43
|| "delete" == v43
|| "void" == v43
)
{
if (!v43.compare("return") && this->offset_32 <= 0)
{
std::string msg = "Illegal " + v43 + " statement";
this->offset_28->err(msg, v19, v20, true);
}
auto v21 = this->offset_24->gen_son(night::NS_TYPE_VAR);
v21->offset_60.assign(v43);
v21->offset_24.assign(v24->offset_24);
v21->offset_48 = v24->offset_48;
v21->offset_52 = v24->offset_52;
auto v25 = this->offset_24->gen_girl(night::std_v_v_n);
auto lt = this->offset_24->gen_son(night::NS_TYPE_CALL);
lt->offset_220 = v21;
// lt->offset_224 = v25; // TODO...
auto v5 = this->offset_28->peek();
std::vector<night::ns_node *> * v44;
if (v5 && v5->offset_84.find('\n') == -1)
{
v44 = this->offset_24->gen_girl(night::std_v_n);
auto v45 = this->ast_expression(); // TODO...待确认
v44->emplace_back(v45);
}
else
{
v44 = this->offset_24->gen_girl(night::std_v_n);
}
// v25->push_back(v44);
return lt;
}
if ("typeof" == v43)
{
}
if ("this" == v43)
{
}
if ("arguments" != v43)
{
}
if (this->offset_32 < 0)
{
}
}
bool NSASTParse::is_punctuation(std::string const &a2)
@ -584,17 +668,31 @@ namespace night
night::ns_node *NSASTParse::top_down()
{
auto v6 = this->offset_24->gen_girl(night::std_v_n);
night::ns_node ret;
while (!this->offset_28->eof())
{
auto v16 = this->ast_expression();
v6->push_back(v16);
auto v7 = this->offset_28;
auto v1 = v7->offset_4;
auto v5 = v1.offset_56;
auto v4 = v1.offset_52;
auto v5 = v1->offset_56;
auto v4 = v1->offset_52;
if (
night::NS_TYPE_BOOL == v16->offset_0 || night::NS_TYPE_VAR == v16->offset_0 || night::NS_TYPE_STR == v16->offset_0 || night::NS_TYPE_NUM == v16->offset_0 || night::NS_TYPE_B_TYPE == v16->offset_0 || night::NS_TYPE_KW == v16->offset_0 || night::NS_TYPE_OP_SELF == v16->offset_0 || night::NS_TYPE_BINARY == v16->offset_0 || night::NS_TYPE_ASSIGN == v16->offset_0 || night::NS_TYPE_TERNARY == v16->offset_0 || night::NS_TYPE_OBJ_DOT == v16->offset_0 || night::NS_TYPE_OBJ_PROPERTY == v16->offset_0 || night::NS_TYPE_OBJ_SELF_OP == v16->offset_0 || night::NS_TYPE_ARRAY == v16->offset_0 || night::NS_TYPE_BRACKET == v16->offset_0 || night::NS_TYPE_CALL == v16->offset_0)
night::NS_TYPE_BOOL == v16->offset_0
|| night::NS_TYPE_VAR == v16->offset_0
|| night::NS_TYPE_STR == v16->offset_0
|| night::NS_TYPE_NUM == v16->offset_0
|| night::NS_TYPE_B_TYPE == v16->offset_0
|| night::NS_TYPE_KW == v16->offset_0
|| night::NS_TYPE_OP_SELF == v16->offset_0
|| night::NS_TYPE_BINARY == v16->offset_0
|| night::NS_TYPE_ASSIGN == v16->offset_0
|| night::NS_TYPE_TERNARY == v16->offset_0
|| night::NS_TYPE_OBJ_DOT == v16->offset_0
|| night::NS_TYPE_OBJ_PROPERTY == v16->offset_0
|| night::NS_TYPE_OBJ_SELF_OP == v16->offset_0
|| night::NS_TYPE_ARRAY == v16->offset_0
|| night::NS_TYPE_BRACKET == v16->offset_0
|| night::NS_TYPE_CALL == v16->offset_0)
{
night::ns_node *v2 = v7->peek();
if (v2)
@ -615,7 +713,8 @@ namespace night
}
}
auto son = this->offset_24->gen_son(night::NS_TYPE_PROG);
son->offset_108 = "";
son->offset_228 = v6;
son->offset_108 = "\0";
return son;
}
@ -632,8 +731,8 @@ namespace night
v17->push_back(v22);
this->offset_28->next();
auto v2 = this->offset_28->offset_4;
int v8 = v2.offset_52;
int v9 = v2.offset_56;
int v8 = v2->offset_52;
int v9 = v2->offset_56;
auto v3 = this->offset_28->next();
if (!v3 || night::NS_TYPE_STR != v3->offset_0)

View File

@ -93,23 +93,72 @@ namespace night
}
std::string NSCompileJs::compile_do_while(night::ns_node *a3)
{
std::string str = "";
str += "do";
// 要确认加的长度是str还是"do"的
std::string result = "";
result += "do";
this->offset_48 += 2;
result += this->compile(a3->offset_216);
return "";
result += "while(";
this->offset_48 += 6;
result += this->compile(a3->offset_204);
result += ");";
this->offset_48 += 2;
return result;
}
std::string NSCompileJs::compile_for(night::ns_node *a3)
{
return "";
std::string result = "";
result += "for(";
this->offset_48 += 4;
auto v3 = a3->offset_228;
if (v3->size() != 3)
{
throw "error : sys error for compile_for";
}
result += this->compile(v3->at(0));
result += ";";
this->offset_48++;
result += this->compile(v3->at(1));
result += ";";
this->offset_48++;
result += this->compile(v3->at(2));
result += 5580790;
this->offset_48++;
result += this->compile(a3->offset_216);
return result;
}
std::string NSCompileJs::compile_function(night::ns_node *a3)
{
return "";
std::string result = "";
// TODO...
return result;
}
std::string NSCompileJs::compile_if(night::ns_node *a3)
{
return "";
std::string result = "";
result += "if ";
this->offset_48 += 3;
result += this->compile(a3->offset_204);
result += this->compile(a3->offset_208);
result += a3->offset_108;
this->offset_48 += a3->offset_108.length();
if (a3->offset_212)
{
std::string v5 = " else ";
result += v5;
this->offset_48 += v5.length();
result += this->compile(a3->offset_212);
}
return result;
}
std::string NSCompileJs::compile_k_v(night::ns_node * a3)
{
@ -136,6 +185,7 @@ namespace night
}
std::string NSCompileJs::compile_obj_property(night::ns_node *)
{
// TODO...
return "";
}
std::string NSCompileJs::compile_obj_self_op(night::ns_node *a3)
@ -158,18 +208,56 @@ namespace night
}
std::string NSCompileJs::compile_op_self(night::ns_node *a3)
{
this->compile(a3->offset_192);
for (auto i = a3->offset_196->begin(); i != a3->offset_196->end(); i++)
std::string result = "";
result += a3->offset_156;
this->offset_48 += a3->offset_156.length();
result += this->compile(a3->offset_192);
return result;
}
std::string NSCompileJs::compile_switch(night::ns_node *a3)
{
this->compile(*i);
// TODO...
std::string result = "";
result += "switch(";
this->offset_48 += 7;
result += this->compile(a3->offset_204);
result += "){";
this->offset_48 += 2;
auto v232 = a3->offset_232;
for (int i = 0; i < v232->size(); i++)
{
result += "case ";
this->offset_48 += 5;
result += this->compile(v232->at(i));
result.append(":");
this->offset_48++;
auto v6 = a3->offset_236->at(i);
for (int j = 0; j < v6->size(); j++)
{
auto v8 = v6->at(j);
result += this->compile(v8);
result += ";";
this->offset_48++;
}
}
return "";
}
std::string NSCompileJs::compile_switch(night::ns_node *)
// 240
for (int i = 0; i < a3->offset_240->size(); i++)
{
return "";
if (!i)
{
result += "default:";
this->offset_48 += 8;
}
auto v10 = a3->offset_240->at(i);
result += this->compile(v10);
result.append(";");
this->offset_48++;
}
result += "}";
this->offset_48++;
return result;
}
std::string NSCompileJs::compile_ternary(night::ns_node *a3)
{
@ -181,9 +269,41 @@ namespace night
result += this->compile(a3->offset_184);
return result;
}
std::string NSCompileJs::compile_var(night::ns_node *)
std::string NSCompileJs::compile_var(night::ns_node *a3)
{
return "";
std::string result = "";
if (a3->offset_56)
{
result = "var ";
}
this->offset_48 += result.length();
std::string v11 = a3->offset_60.substr(0, 3);
bool v6 = false;
if (
v11 != night::nsv_
&& "return" != a3->offset_60
&& "delete" != a3->offset_60
)
{
v6 = "void" != a3->offset_60;
}
if (v6)
{
throw "error : sys error for compile_var `" + a3->offset_60 + "`";
}
night::ns_sourcemap _v11;
_v11.offset_0 = a3->offset_24;
_v11.offset_24 = a3->offset_48;
_v11.offset_28 = a3->offset_52;
_v11.offset_32 = a3->offset_60;
_v11.offset_56 = a3->offset_48;
_v11.offset_60 = a3->offset_48;
this->offset_36.push_back(_v11);
this->offset_48 += a3->offset_60.length();
result += a3->offset_60;
return result;
}
std::string NSCompileJs::compile_while(night::ns_node * a3)
{
@ -395,7 +515,7 @@ namespace night
printf("ast :%s\n", ret.data());
}
std::string v9 = this->compile(v5);
a3 = v9;
a3.assign(v9);
return this->offset_0;
}

View File

@ -51,10 +51,12 @@ namespace night
if (v4)
{
delete v4;
v3->offset_24_vec = nullptr;
}
if (v3->offset_24_node)
{
delete v3->offset_24_node;
v3->offset_24_node = nullptr;
}
}
if (v3->offset_0 == night::std_v_v_n)
@ -63,10 +65,12 @@ namespace night
if (v4)
{
delete v4;
v3->offset_24_vec = nullptr;
}
if (v3->offset_24_node)
{
delete v3->offset_24_node;
v3->offset_24_node = nullptr;
}
}

View File

@ -6,8 +6,12 @@ namespace night
NSStream::NSStream(/* args */)
{
}
NSStream::NSStream(std::string const&,std::string const&,uint)
NSStream::NSStream(std::string const& a2, std::string const& a3, uint a4)
{
this->offset_0.assign(a2);
this->offset_24.assign(a3);
this->offset_52 = a4;
this->offset_56 = 1;
}
NSStream::~NSStream()

View File

@ -28,20 +28,20 @@ namespace night
if (this->offset_12.begin() == this->offset_12.end())
{
auto v14 = this->read_while(night::NSToken::tk_is_whitespace, 0);
bool isEnd = this->offset_4.eof();
bool isEnd = this->offset_4->eof();
if (!isEnd)
{
this->skip_comment(v14);
}
if ( isEnd
|| (this->offset_4.eof())
|| (this->offset_4->eof())
)
{
v7 = 0;
}
else
{
auto v13 = this->offset_4.peek();
auto v13 = this->offset_4->peek();
if (v13.data == '"' || v13.data == '\'')
{
v7 = this->read_string(v13.data, v14);
@ -59,17 +59,17 @@ namespace night
std::string msg = "Unexpected token `";
msg.append(std::string(1, v13.data));
msg.append("`");
this->offset_4.err(msg, 0, 0, false);
this->offset_4->err(msg, 0, 0, false);
}
std::string v15;
auto v17 = this->read_while(night::NSToken::tk_is_valid_op_str, (void *)&v15);
auto v7 = this->offset_0.gen_son(night::NS_TYPE_OP);
auto v7 = this->offset_0->gen_son(night::NS_TYPE_OP);
}
else
{
auto v7 = this->offset_0.gen_son(night::NS_TYPE_PUNC);
auto v19 = this->offset_4.next();
auto v7 = this->offset_0->gen_son(night::NS_TYPE_PUNC);
auto v19 = this->offset_4->next();
std::string v15(1, v19.data);
v7->offset_60 = v15;
}
@ -129,40 +129,40 @@ namespace night
void NSToken::read_comment_method_2()
{
this->read_while(night::NSToken::tk_is_comment2, &this->offset_4);
this->offset_4.next();
this->offset_4->next();
}
void NSToken::skip_comment(std::string &a2)
{
while (true)
{
if (this->offset_4.eof())
if (this->offset_4->eof())
{
break;
}
auto v5 = this->offset_4.peek();
auto v5 = this->offset_4->peek();
if (v5.data != '/')
{
break;
}
if (this->offset_4.eof_2())
if (this->offset_4->eof_2())
{
break;
}
v5 = this->offset_4.peek_2();
v5 = this->offset_4->peek_2();
if (v5.data == '/')
{
v5 = this->offset_4.next();
v5 = this->offset_4.next();
v5 = this->offset_4->next();
v5 = this->offset_4->next();
this->read_comment_method_1();
}
else
{
v5 = this->offset_4.peek_2();
v5 = this->offset_4->peek_2();
if (v5.data == '*')
return;
v5 = this->offset_4.next();
v5 = this->offset_4.next();
v5 = this->offset_4->next();
v5 = this->offset_4->next();
this->read_comment_method_2();
}
a2 = this->read_while(night::NSToken::tk_is_whitespace, 0);
@ -173,22 +173,22 @@ namespace night
night::ns_node * NSToken::read_string(char a2, std::string const& a3)
{
auto v12 = this->offset_4.next();
auto v12 = this->offset_4->next();
std::string v10 = "";
char v4;
for (int i = 0; ; i = v4)
{
v4 = this->offset_4.eof();
v4 = this->offset_4->eof();
if (v4)
{
break;
}
auto v9 = this->offset_4.eof();
auto v9 = this->offset_4->eof();
if ( v9 == '\n')
{
if (!i)
{
this->offset_4.err("Unexpected `\\n`", 0, 0, false);
this->offset_4->err("Unexpected `\\n`", 0, 0, false);
}
v10.push_back('\n');
}
@ -210,7 +210,7 @@ namespace night
v10.push_back(v9);
}
}
auto son = this->offset_0.gen_son(night::NS_TYPE_STR);
auto son = this->offset_0->gen_son(night::NS_TYPE_STR);
son->offset_60 = WXML::Rewrite::ToStringCode(v10);
son->offset_108.replace(0, son->offset_108.length(), 1, a2);
@ -223,15 +223,15 @@ namespace night
{
int v8;
auto v9 = this->read_while(night::NSToken::rw_cb_number, &v8);
auto v13 = this->offset_4.peek();
auto v13 = this->offset_4->peek();
if (night::NSToken::tk_is_var_start(v13.data, nullptr))
{
std::string msg = "Unexpected token `";
msg.append(std::string(1, v13.data));
msg.append("`");
this->offset_4.err(msg, 0, 0, false);
this->offset_4->err(msg, 0, 0, false);
}
auto son = this->offset_0.gen_son(night::NS_TYPE_NUM);
auto son = this->offset_0->gen_son(night::NS_TYPE_NUM);
son->offset_60 = v9;
son->offset_84 = a2;
return son;
@ -240,14 +240,14 @@ namespace night
std::string NSToken::read_while(bool (*a3)(char,void *), void *a4)
{
std::string result = "";
while (!this->offset_4.eof())
while (!this->offset_4->eof())
{
auto v6 = this->offset_4.peek();
auto v6 = this->offset_4->peek();
if (!a3(v6.data, a4))
{
break;
}
v6 = this->offset_4.next();
v6 = this->offset_4->next();
result.push_back(v6.data);
}
return result;
@ -255,7 +255,7 @@ namespace night
night::ns_node *NSToken::read_var(std::string const & a2)
{
auto v12 = this->offset_4.peek();
auto v12 = this->offset_4->peek();
auto v13 = this->read_while(night::NSToken::tk_is_var, 0);
std::string v16 = " " + v13 + " ";
int pos = night::NS_BUILTIN_TYPE.find(v16, 0);
@ -268,7 +268,7 @@ namespace night
{
v4 = night::NS_TYPE_VAR;
}
son = this->offset_0.gen_son(v4);
son = this->offset_0->gen_son(v4);
if (v6 == -1)
{
v16 = night::nsv_ + v13;
@ -289,7 +289,7 @@ namespace night
}
else
{
son = this->offset_0.gen_son(night::NS_TYPE_B_TYPE);
son = this->offset_0->gen_son(night::NS_TYPE_B_TYPE);
son->offset_60 = v13;
son->offset_84 = a2;
}
@ -298,7 +298,7 @@ namespace night
void NSToken::err(std::string const& a2, int a3, int a4, bool a5)
{
this->offset_4.err(a2, a3, a4, a5);
this->offset_4->err(a2, a3, a4, a5);
}
bool NSToken::rw_cb_number(char ch, void *t)
{
@ -376,7 +376,7 @@ namespace night
}
bool NSToken::tk_is_var_start(char ch, void * t)
{
uint8_t v1 = ch - 'A';
uint8_t v1 = (ch & 0xFFFFFFDF) - 'A';
return (v1 <= 0x19u) | (ch == '_');
}
}

View File

@ -28,14 +28,15 @@ namespace night
/**
* todo...
*/
bool path_combine(std::string const& a1, std::string const& a2, std::string& a3)
int path_combine(std::string const& a1, std::string const& a2, std::string& a3)
{
std::string v11;
MMBizWxaAppComm::PathCombine(a1, a2, v11);
int code = 0;
if (v11.length() > 3)
{
std::string v14 = v11.substr(v11.length() - 3);
int code = v14 == ".wxs";
code = v14 == ".wxs";
if (code)
{
code = 2;
@ -43,16 +44,10 @@ namespace night
else
{
std::string v3 = WXML::Rewrite::ToStringCode(v11);
if (v3 == "")
{
}
else
{
}
a3 = v3;
}
}
return code;
}
} // namespace str
} // namespace night

View File

@ -15295,9 +15295,9 @@ int __usercall night::NSToken::tk_is_var_start@<eax>(int a1@<eax>)
{
unsigned int v1; // edx
v1 = (a1 & 0xFFFFFFDF) - 65;
v1 = (a1 & 0xFFFFFFDF) - 65; // 'A'
LOBYTE(v1) = (unsigned __int8)v1 <= 0x19u;
LOBYTE(a1) = (_BYTE)a1 == 95;
LOBYTE(a1) = (_BYTE)a1 == 95; // '_'
return v1 | a1;
}
@ -15443,18 +15443,21 @@ void __thiscall night::NSStream::NSStream(_DWORD *this, int a2, int a3, int a4)
{
int v4; // [esp+14h] [ebp-44h]
*this = this + 2; // this->offset_0
this[1] = 0;
*this = this + 2;
*((_BYTE *)this + 8) = 0;
v4 = (int)(this + 6);
this[6] = this + 8; // this->offset_24
this[7] = 0;
this[6] = this + 8;
*((_BYTE *)this + 32) = 0;
std::string::_M_assign((int)this, a2);
std::string::_M_assign(v4, a3);
this[12] = 0;
this[14] = 1;
this[13] = a4;
this[12] = 0; // this->offset_48
this[14] = 1; // this->offset_56
this[13] = a4; // this->offset_52
}
//----- (0040EB14) --------------------------------------------------------
@ -15900,35 +15903,35 @@ _DWORD *__thiscall night::NSGod::gen_son(void *this, int a2)
*((_BYTE *)v3 + 8) = 0;
v6[0] = (int)v3;
std::string::_M_assign((int)v3, a2);
v4 = operator new(0xF8u);
v4 = operator new(0xF8u); // 248
*v4 = v4 + 2; // std::string offset_0
v4[1] = 0;
*((_BYTE *)v4 + 8) = 0;
v4[6] = v4 + 8; // std::string offset_24
v4[7] = 0;
*((_BYTE *)v4 + 32) = 0;
v4[15] = v4 + 17; // std::string offset_60
v4[16] = 0;
*((_BYTE *)v4 + 68) = 0;
v4[21] = v4 + 23; // std::string offset_84
v4[22] = 0;
*((_BYTE *)v4 + 92) = 0;
v4[27] = v4 + 29; // std::string offset_108
v4[28] = 0;
*((_BYTE *)v4 + 116) = 0;
v4[33] = v4 + 35; // std::string offset_132
v4[34] = 0;
*((_BYTE *)v4 + 140) = 0;
v4[39] = v4 + 41; // std::string offset_156
v4[40] = 0;
*((_BYTE *)v4 + 8) = 0;
*((_BYTE *)v4 + 32) = 0;
*((_BYTE *)v4 + 68) = 0;
*((_BYTE *)v4 + 92) = 0;
*((_BYTE *)v4 + 116) = 0;
*((_BYTE *)v4 + 140) = 0;
*((_BYTE *)v4 + 164) = 0;
v4[13] = 0;
v4[12] = 0;
*((_BYTE *)v4 + 200) = 0;
@ -15948,7 +15951,7 @@ _DWORD *__thiscall night::NSGod::gen_son(void *this, int a2)
v4[57] = 0;
v4[49] = 0;
v4[59] = 0;
v4[56] = 0;
v4[56] = 0; // offset_224
std::string::_M_assign((int)v4, a2);
*(_DWORD *)(v6[0] + 24) = v4;
std::vector<night::NSGod::GodsSon *>::push_back((int)this, v6);
@ -16071,10 +16074,12 @@ int __thiscall night::NSGod::gen_girl(void *this, int a2)
int v7; // edx
_DWORD *v9; // [esp+1Ch] [ebp-Ch] BYREF
v3 = operator new(0x1Cu); // 0x1C -> 28
v3 = operator new(0x1Cu); // 0x1C -> 28 night::NSGod::GodsSon
*v3 = v3 + 2; // v3.offset_8 缓冲区
v3[1] = 0; // v3.offset_4 长度
*((_BYTE *)v3 + 8) = 0; // 缓冲区第一个字节是0
v9 = v3;
// v3是一个std::string
std::string::_M_assign((int)v3, a2);
@ -16723,7 +16728,7 @@ LABEL_50:
*((_DWORD *)lpuexcpt + 12) = v24[12];
*((_DWORD *)lpuexcpt + 13) = v24[13];
std::string::_M_assign((int)lpuexcpt + 60, (int)v43);
goto LABEL_51;
goto LABEL_51; // 销毁数据返回lpt
}
if ( std::operator==<char>("return", (int)v43)
|| std::operator==<char>("delete", (int)v43)
@ -16745,6 +16750,7 @@ LABEL_50:
std::string::_M_assign((int)(v21 + 6), (int)(v24 + 6));
v21[12] = v24[12];
v21[13] = v24[13];
lpuexcptc = (struct _Unwind_Exception *)a1[6];
std::string::basic_string((char *)v45, (int)&night::std_v_v_n);
v25 = night::NSGod::gen_girl(lpuexcptc, (int)v45);
@ -16776,7 +16782,7 @@ LABEL_50:
std::string::_M_dispose(v45);
}
std::vector<std::vector*<night::ns_node *,std::allocator<night::ns_node>>>::push_back(v25, v44);
goto LABEL_51;
goto LABEL_51; // 销毁数据返回lpt
}
if ( std::operator==<char>("typeof", (int)v43) )
{
@ -16798,7 +16804,7 @@ LABEL_50:
std::string::basic_string(v45, v9);
night::NSToken::err(v29, (int)v45, v19, v20, 1);
}
goto LABEL_51;
goto LABEL_51; // 销毁数据返回lpt
}
if ( std::operator==<char>("this", (int)v43) )
goto LABEL_30;
@ -16871,7 +16877,7 @@ LABEL_31:
v12 = night::NSASTParse::ast_obj_op(a1, (int)lpuexcpt);
LABEL_36:
lpuexcpt = (struct _Unwind_Exception *)night::NSASTParse::make_call_or_just_expression(a1, v12);
goto LABEL_51;
goto LABEL_51; // 销毁数据返回lpt
}
if ( std::operator==<char>(".", v26) )
{
@ -18575,6 +18581,7 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::top_down(int *a1)
std::string::basic_string((char *)v17, (int)&night::NS_TYPE_PROG);
lpuexcptf = (struct _Unwind_Exception *)night::NSGod::gen_son(lpuexcpte, (int)v17);
std::string::_M_dispose(v17);
// offset_
*((_DWORD *)lpuexcptf + 57) = v6;
std::string::operator=((unsigned int *)lpuexcptf + 27, (char *)&byte_551F04);
return lpuexcptf;
@ -18687,6 +18694,7 @@ unsigned __int8 **__fastcall night::NSASTParse::ast_require(int *a1)
std::string::_M_dispose((void **)v26);
v4 = v22;
v22[57] = (unsigned __int8 *)v17;
// offset_108
std::string::operator=((unsigned int *)v4 + 27, (char *)&byte_551F04);
v5 = night::NSToken::peek(a1[7]);
@ -19234,16 +19242,16 @@ char *__thiscall night::NSCompileJs::compile_var[abi:cxx11](char *this, int a2,
struct _Unwind_Exception *lpuexcpta; // [esp+18h] [ebp-B0h]
void *v9[6]; // [esp+50h] [ebp-78h] BYREF
void *v10[6]; // [esp+68h] [ebp-60h] BYREF
int v11[2]; // [esp+80h] [ebp-48h] BYREF
int v11[2]; // [esp+80h] [ebp-48h] BYREF v11.offset_0
char v12; // [esp+88h] [ebp-40h] BYREF
int v13; // [esp+98h] [ebp-30h]
int v14; // [esp+9Ch] [ebp-2Ch]
int v15[2]; // [esp+A0h] [ebp-28h] BYREF
int v13; // [esp+98h] [ebp-30h] v11.offset_24
int v14; // [esp+9Ch] [ebp-2Ch] v11.offset_28
int v15[2]; // [esp+A0h] [ebp-28h] BYREF v11.offset_32
char v16; // [esp+A8h] [ebp-20h] BYREF
int v17; // [esp+B8h] [ebp-10h]
int v18; // [esp+BCh] [ebp-Ch]
int v17; // [esp+B8h] [ebp-10h] v11.offset_56
int v18; // [esp+BCh] [ebp-Ch] v11.offset_60
std::string::basic_string(v9, (char *)&byte_551F04);
std::string::basic_string(v9, (char *)&byte_551F04); // "\0"
if ( *(_BYTE *)(a3 + 56) )
std::string::operator=((unsigned int *)v9, "var ");
*(_DWORD *)(a2 + 48) += v9[1];
@ -19273,12 +19281,12 @@ char *__thiscall night::NSCompileJs::compile_var[abi:cxx11](char *this, int a2,
(struct type_info *)&`typeinfo for std::string,
(void (__cdecl *)(void *))std::string::~string);
}
v12 = 0;
v11[0] = (int)&v12;
v15[0] = (int)&v16;
v11[1] = 0;
v12 = 0;
v13 = 0;
v14 = 0;
v15[0] = (int)&v16;
v15[1] = 0;
v16 = 0;
v17 = 0;
@ -19795,8 +19803,8 @@ _DWORD *__thiscall night::NSCompileJs::compile_if[abi:cxx11](_DWORD *this, int a
void *v5[6]; // [esp+50h] [ebp-38h] BYREF
void *v6[8]; // [esp+68h] [ebp-20h] BYREF
this[1] = 0;
*this = this + 2;
this[1] = 0;
*((_BYTE *)this + 8) = 0;
std::string::operator+=("if ");
*(_DWORD *)(a2 + 48) += 3;
@ -19808,7 +19816,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_if[abi:cxx11](_DWORD *this, int a
std::string::_M_dispose(v6);
std::string::operator+=(a3 + 27);
*(_DWORD *)(a2 + 48) += a3[28];
if ( a3[53] )
if ( a3[53] ) // a3.offset_212
{
std::string::basic_string(v5, " else ");
std::string::operator+=(v5);
@ -19840,9 +19848,9 @@ _DWORD *__thiscall night::NSCompileJs::compile_for[abi:cxx11](_DWORD *this, int
void *v15[6]; // [esp+80h] [ebp-38h] BYREF
void *v16[8]; // [esp+98h] [ebp-20h] BYREF
v13 = 0;
v12[0] = &v13;
v12[1] = 0;
v13 = 0;
std::string::basic_string(v14, "for(");
std::string::operator+=(v14);
*(_DWORD *)(a2 + 48) += v14[1];
@ -19865,6 +19873,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_for[abi:cxx11](_DWORD *this, int
std::string::_M_dispose(v16);
std::string::_M_dispose(v15);
++*(_DWORD *)(a2 + 48);
v6 = (_DWORD *)std::vector<night::ns_node *>::at(*(_DWORD **)(a3 + 228), 1u);
night::NSCompileJs::compile[abi:cxx11](a2, *v6);
v7 = std::string::append(v15, ";");
@ -20264,8 +20273,8 @@ _DWORD *__thiscall night::NSCompileJs::compile_op_self[abi:cxx11](_DWORD *this,
{
void *v5[8]; // [esp+58h] [ebp-20h] BYREF
this[1] = 0;
*this = this + 2;
this[1] = 0;
*((_BYTE *)this + 8) = 0;
std::string::operator+=(a3 + 156);
*(_DWORD *)(a2 + 48) += *(_DWORD *)(a3 + 160);
@ -20481,9 +20490,11 @@ _DWORD *__thiscall night::NSCompileJs::compile_prog[abi:cxx11](_DWORD *this, int
if ( !v10 )
std::string::operator=((unsigned int *)&v9, ";");
lpuexcpt = 0;
*this = this + 2;
this[1] = 0;
*((_BYTE *)this + 8) = 0;
while ( 1 )
{
v4 = *(_DWORD **)(a3 + 228);
@ -20597,27 +20608,27 @@ int __cdecl night::compile_ns(int a1, int a2, int a3, int a4, unsigned int *a5,
void *v26[6]; // [esp+104h] [ebp-114h] BYREF
int v27[7]; // [esp+11Ch] [ebp-FCh] BYREF
int v28[5]; // [esp+138h] [ebp-E0h] BYREF
void *v29[2]; // [esp+14Ch] [ebp-CCh] BYREF
void *v29[2]; // [esp+14Ch] [ebp-CCh] BYREF offset_0
char v30; // [esp+154h] [ebp-C4h] BYREF
void **v31; // [esp+164h] [ebp-B4h]
int v32; // [esp+168h] [ebp-B0h]
int v33; // [esp+16Ch] [ebp-ACh]
int v34; // [esp+170h] [ebp-A8h]
int v35; // [esp+174h] [ebp-A4h]
int v36; // [esp+178h] [ebp-A0h]
int v37; // [esp+17Ch] [ebp-9Ch]
void **v31; // [esp+164h] [ebp-B4h] offset_24
int v32; // [esp+168h] [ebp-B0h] offset_28
int v33; // [esp+16Ch] [ebp-ACh] offset_32
int v34; // [esp+170h] [ebp-A8h] offset_36
int v35; // [esp+174h] [ebp-A4h] offset_40
int v36; // [esp+178h] [ebp-A0h] offset_44
int v37; // [esp+17Ch] [ebp-9Ch] offset_48
void *v38[15]; // [esp+180h] [ebp-98h] BYREF
void *v39[23]; // [esp+1BCh] [ebp-5Ch] BYREF
std::string::operator=(a5, (char *)&byte_551F04); // "\0"
memset(v17, 0, sizeof(v17));
night::NSStream::NSStream(v38, a1, a3, a4);
v28[2] = (int)v28;
v28[3] = (int)v28;
v27[1] = (int)v38;
v27[0] = (int)v17;
v27[1] = (int)v38;
v28[0] = 0;
v28[1] = 0;
v28[2] = (int)v28;
v28[3] = (int)v28;
v28[4] = 0;
memset(&v27[2], 0, 16);
std::string::basic_string((char *)v29, a1);
@ -20627,15 +20638,17 @@ int __cdecl night::compile_ns(int a1, int a2, int a3, int a4, unsigned int *a5,
v29[1] = 0; // v29.offset_4
v30 = 0; // v29.offset_8
v31 = v39; // v29.offset_24 = v39
v32 = 0; // v29.offset_16
v33 = 0; // v29.offset_20
v34 = 0; // v29.offset_24
v35 = 0; // v29.offset_28
v36 = 0; // v29.offset_32
v37 = 1; // v29.offset_36
v32 = 0; // v29.offset_28
v33 = 0; // v29.offset_32
v34 = 0; // v29.offset_36
v35 = 0; // v29.offset_40
v36 = 0; // v29.offset_44
v37 = 1; // v29.offset_48
v19[0] = &v20;
v19[1] = 0;
v20 = 0;
memset(v18, 0, sizeof(v18));
night::NSCompileJs::compile_once((char *)v21, (int)v29, (unsigned int *)v19, (int)v18, a6);
night::NSGod::hamlet(v17);
@ -21657,7 +21670,9 @@ int __cdecl night::str::path_combine(_DWORD *a1, _DWORD *a2, int a3)
char *v11; // [esp+58h] [ebp-50h] BYREF
unsigned int v12; // [esp+5Ch] [ebp-4Ch]
char v13; // [esp+60h] [ebp-48h] BYREF
void *v14[6]; // [esp+70h] [ebp-38h] BYREF
void *Src; // [esp+88h] [ebp-20h] BYREF
size_t Size; // [esp+8Ch] [ebp-1Ch]
int v17[5]; // [esp+90h] [ebp-18h] BYREF
@ -21683,7 +21698,7 @@ int __cdecl night::str::path_combine(_DWORD *a1, _DWORD *a2, int a3)
WXML::Rewrite::ToStringCode((int)&Src, (int *)&v11);
v3 = Src;
v4 = *(_BYTE **)a3;
if ( Src == v17 )
if ( Src == v17 )// 使用缓冲区
{
if ( Size )
std::string::_S_copy(v4, (unsigned __int8 *)Src, Size);
@ -21694,7 +21709,7 @@ int __cdecl night::str::path_combine(_DWORD *a1, _DWORD *a2, int a3)
}
else
{
if ( v4 == (_BYTE *)(a3 + 8) )
if ( v4 == (_BYTE *)(a3 + 8) ) // v4使用缓冲区
v4 = 0;
else
v9 = *(_DWORD *)(a3 + 8);
@ -53884,9 +53899,9 @@ void __thiscall WXML::EXPRLib::Terminal::~Terminal(void **ecx0, WXML::EXPRLib::T
void __thiscall night::NSASTParse::NSASTParse(int this, int a2, int a3, int a4)
{
std::string::basic_string((char *)this, a2);
*(_DWORD *)(this + 44) = this + 52;
*(_DWORD *)(this + 48) = 0;
*(_BYTE *)(this + 52) = 0;
*(_DWORD *)(this + 44) = this + 52;
*(_DWORD *)(this + 32) = 0;
*(_DWORD *)(this + 28) = a3;