feat: 添加一些方法

This commit is contained in:
msojocs 2023-07-20 19:07:07 +08:00
parent a94787ce7e
commit e00c6e85de
7 changed files with 759 additions and 162 deletions

View File

@ -36,6 +36,7 @@ namespace night
extern std::string NS_TYPE_FOR;
extern std::string NS_TYPE_IF;
extern std::string NS_TYPE_K_V;
extern std::string NS_TYPE_OP;
extern std::string std_v_n;
extern std::string std_v_v_n;
@ -58,12 +59,13 @@ namespace night
std::string offset_60;
std::string offset_84;
std::string offset_108;
std::string offset_132;
std::string offset_156;
night::ns_node * offset_180;
night::ns_node * offset_184;
night::ns_node * offset_192;
std::vector<night::ns_node *> offset_196;
std::vector<night::ns_node *> offset_228;
std::vector<night::ns_node *>* offset_196;
std::vector<night::ns_node *>* offset_228;
ns_node(/* args */);
~ns_node();
std::string debug_no_space(void);
@ -74,20 +76,46 @@ namespace night
private:
/* data */
public:
std::vector<night::ns_node *> offset_0;
struct GodsSon {
std::string offset_0;
std::vector<night::ns_node *>* offset_24;
};
std::vector<night::NSGod::GodsSon *> offset_0;
NSGod(/* args */);
~NSGod();
std::vector<night::ns_node *> gen_girl(std::string a2);
std::vector<night::ns_node *>* gen_girl(std::string a2);
night::ns_node* gen_son(std::string);
void hamlet(void);
};
class NSStream
{
private:
/* data */
std::string offset_24;
int offset_48 = 0;
public:
std::string offset_0;
int offset_52 = 0; // 当前行数
int offset_56 = 0; // 当前行第几个字符位置
NSStream(/* args */);
NSStream(std::string const&,std::string const&,uint);
~NSStream();
void eof(void);
void eof_2(void);
void err(std::string const&,int,int,bool);
void next(void);
void peek(void);
void peek_2(void);
};
class NSToken
{
private:
/* data */
public:
int offset_4;
NSStream offset_4; // 不是int
night::ns_node* offset_8;
NSToken(/* args */);
~NSToken();
bool eof(void);
@ -95,11 +123,11 @@ namespace night
void get_tokens_for_sourcemap(std::map<std::string, uint> &, std::map<uint,std::string> &);
night::ns_node* next(void);
void pass(void);
void peek(void);
night::ns_node* peek(void);
void push(night::ns_node *);
void read_comment_method_1(void);
void read_comment_method_2(void);
void read_next(void);
night::ns_node* read_next(void);
void read_number(std::string const&);
void read_string(char, std::string const&);
void read_var(std::string const&);
@ -129,53 +157,53 @@ namespace night
NSASTParse(/* args */);
NSASTParse(std::string, night::NSToken *, night::NSGod *);
~NSASTParse();
void ast_call(night::ns_node *);
void ast_code_block(void);
void ast_dispatch(bool);
void ast_do_while(void);
night::ns_node * ast_call(night::ns_node *);
night::ns_node * ast_code_block(void);
night::ns_node * ast_dispatch(bool);
night::ns_node * ast_do_while(void);
night::ns_node * ast_expression(void);
void ast_expression_no_binary(void);
void ast_expression_no_comma(void);
void ast_for(void);
void ast_function(void);
void ast_if(void);
void ast_new_array(void);
void ast_obj_block(void);
void ast_obj_dot(night::ns_node *);
void ast_obj_op(night::ns_node *);
void ast_obj_op_self(night::ns_node *);
void ast_op_self(void);
void ast_require(void);
void ast_switch(void);
void ast_ternary_expression(void);
void ast_trans_kw(void);
void ast_var(void);
void ast_varname(void);
void ast_while(void);
night::ns_node * ast_expression_no_binary(void);
night::ns_node * ast_expression_no_comma(void);
night::ns_node * ast_for(void);
night::ns_node * ast_function(void);
night::ns_node * ast_if(void);
night::ns_node * ast_new_array(void);
night::ns_node * ast_obj_block(void);
night::ns_node * ast_obj_dot(night::ns_node *);
night::ns_node * ast_obj_op(night::ns_node *);
night::ns_node * ast_obj_op_self(night::ns_node *);
night::ns_node * ast_op_self(void);
night::ns_node * ast_require(void);
night::ns_node * ast_switch(void);
night::ns_node * ast_ternary_expression(void);
night::ns_node * ast_trans_kw(void);
night::ns_node * ast_var(void);
night::ns_node * ast_varname(void);
night::ns_node * ast_while(void);
void end_line(void);
void ignore_buildin_kw(std::string const&);
void ignore_op(std::string const&);
void ignore_punc(std::string const&);
void ignore_punc_pass_sem(std::string const&);
void is_buildin_keywords(std::string const&);
void is_exp(night::ns_node *);
void is_obj_op_self(bool);
void is_op(std::string const&);
bool is_buildin_keywords(std::string const&);
bool is_exp(night::ns_node *);
bool is_obj_op_self(bool);
bool is_op(std::string const&);
/**
* op操作符 comma逗号
*/
void is_op_or_comma(std::string const&);
bool is_op_or_comma(std::string const&);
void is_op_self(bool);
bool is_op_self(bool);
/**
* punctuation
*/
bool is_punctuation(std::string const&);
void is_save_for_division(night::ns_node *);
void make_binary_or_just_value(night::ns_node *,bool);
void make_call_or_just_expression(night::ns_node *);
bool is_save_for_division(night::ns_node *);
night::ns_node * make_binary_or_just_value(night::ns_node *,bool);
night::ns_node * make_call_or_just_expression(night::ns_node *);
void make_list_by_parser(
std::string const&,
std::string const&,
@ -232,26 +260,6 @@ namespace night
std::string compile_while(night::ns_node *);
};
class NSStream
{
private:
/* data */
std::string offset_24;
int offset_48 = 0;
int offset_52 = 0; // 当前行数
int offset_56 = 0; // 当前行第几个字符位置
public:
NSStream(/* args */);
NSStream(std::string const&,std::string const&,uint);
~NSStream();
void eof(void);
void eof_2(void);
void err(std::string const&,int,int,bool);
void next(void);
void peek(void);
void peek_2(void);
};
namespace str
{
void get_token(std::string const&, int);

View File

@ -3,12 +3,11 @@
namespace night
{
NSASTParse::NSASTParse(/* args */)
{
}
NSASTParse::NSASTParse(std::string a2, night::NSToken * a3, night::NSGod * a4)
NSASTParse::NSASTParse(std::string a2, night::NSToken *a3, night::NSGod *a4)
{
this->offset_0 = a2;
this->offset_24 = a4;
@ -23,92 +22,597 @@ namespace night
{
}
void NSASTParse::is_op(std::string const& a2)
bool NSASTParse::is_op(std::string const &a2)
{
// std::string v2 = this->offset_28->peek();
// if (v2.length())
// {
// if (night::NS_TYPE_OP == v2)
// {
// if (a2.length() && a2 != v2->offset_60)
// return 0;
// }
// else
// {
// return 0;
// }
// }
auto v2 = this->offset_28->peek();
if (v2)
{
if (night::NS_TYPE_OP == v2->offset_0)
{
if (a2.length() && a2 != v2->offset_60)
return 0;
}
void NSASTParse::is_op_or_comma(std::string const&)
else
{
// bool result = this->is_punctuation(",");
// if (!result)
// {
// return this->is_op(result);
// }
return 0;
}
}
return true;
}
bool NSASTParse::is_op_or_comma(std::string const &a2)
{
bool result = this->is_punctuation(",");
if (!result)
{
return this->is_op(a2);
}
return result;
}
night::ns_node * NSASTParse::ast_expression()
night::ns_node *NSASTParse::ast_obj_block()
{
}
night::ns_node *NSASTParse::ast_code_block()
{
}
night::ns_node *NSASTParse::ast_new_array()
{
}
night::ns_node *NSASTParse::ast_obj_op_self(night::ns_node *)
{
}
night::ns_node *NSASTParse::ast_op_self()
{
}
night::ns_node *NSASTParse::ast_if()
{
}
night::ns_node *NSASTParse::ast_for()
{
}
night::ns_node *NSASTParse::ast_while()
{
}
night::ns_node *NSASTParse::ast_do_while()
{
}
night::ns_node *NSASTParse::ast_switch()
{
}
bool NSASTParse::is_obj_op_self(bool)
{
}
bool NSASTParse::is_op_self(bool)
{
}
night::ns_node *NSASTParse::ast_dispatch(bool a3)
{
// ast_dispatch - 0
auto v42 = this->is_punctuation("(\000)\000{");
if (!v42)
{
auto v67 = this->offset_44;
this->offset_44 = "";
const char asc_5527F4[] = "(\000)\000{";
auto v45 = this->is_punctuation("[");
if (v45)
{
auto v28 = this->offset_28->next();
auto v37 = this->offset_28->next();
auto v31 = this->offset_28->next();
int v46 = 0;
if (v37)
{
if (night::NS_TYPE_VAR == v37->offset_0 || (v46 = night::NS_TYPE_STR == v37->offset_0))
{
v46 = 0;
if (v31)
{
v46 = night::NS_TYPE_PUNC == v31->offset_0;
if (v46)
{
v46 = ":" == v31->offset_60;
}
}
}
if (night::NS_TYPE_PUNC == v37->offset_0)
{
if ("}" == v37->offset_0)
{
v46 = true;
}
}
}
this->offset_28->push(v31);
this->offset_28->push(v37);
this->offset_28->push(v28);
if (v46)
{
auto v11 = this->ast_obj_block();
LABEL_113:
auto v65 = this->make_call_or_just_expression(v11);
return v65;
}
if (!v67.length() || "op not=" != v67)
{
auto v11 = this->ast_code_block();
return this->make_call_or_just_expression(v11);
}
}
auto v47 = this->is_punctuation("[");
if (v47)
{
auto v11 = this->ast_new_array();
return this->make_call_or_just_expression(v11);
}
if (this->is_obj_op_self(false))
{
auto v11 = this->ast_obj_op_self(0);
return this->make_call_or_just_expression(v11);
}
if (this->is_op_self(false))
{
auto v11 = this->ast_op_self();
return this->make_call_or_just_expression(v11);
}
bool is_op_self = false;
if (this->is_buildin_keywords("if"))
{
auto v11 = this->ast_if();
return this->make_call_or_just_expression(v11);
}
if (this->is_buildin_keywords("for"))
{
auto v11 = this->ast_for();
return this->make_call_or_just_expression(v11);
}
if (this->is_buildin_keywords("while"))
{
auto v11 = this->ast_while();
return this->make_call_or_just_expression(v11);
}
if (this->is_buildin_keywords("do"))
{
auto v11 = this->ast_do_while();
return this->make_call_or_just_expression(v11);
}
if (this->is_buildin_keywords("switch"))
{
auto v11 = this->ast_switch();
return this->make_call_or_just_expression(v11);
}
bool v21 = false;
if (this->is_buildin_keywords("true"))
{
}
else
{
if (this->is_buildin_keywords("false"))
{
}
else
{
if (this->is_buildin_keywords("null"))
{
}
else
{
if (this->is_buildin_keywords("undefined"))
{
}
else
{
if (this->is_buildin_keywords("NaN"))
{
}
else
{
if (this->is_buildin_keywords("Infinity"))
{
}
else
{
if (this->is_buildin_keywords("return"))
{
}
else
{
if (this->is_buildin_keywords("delete"))
{
}
else
{
if (this->is_buildin_keywords("void"))
{
}
else
{
if (!this->is_buildin_keywords("typeof"))
{
if (!this->is_buildin_keywords("this"))
{
v21 = true;
if (!this->is_buildin_keywords("arguments"))
{
v21 = true;
if (!this->is_buildin_keywords("break"))
{
v21 = this->is_buildin_keywords("continue") != 0;
}
}
}
else
{
is_op_self = true;
}
}
}
}
}
}
}
}
}
}
} // end check for "true"
v21 = true;
if (v21)
{
auto v11 = this->ast_trans_kw();
return this->make_call_or_just_expression(v11);
}
if (this->is_buildin_keywords("require"))
{
auto v11 = this->ast_require();
return this->make_call_or_just_expression(v11);
}
if (this->is_buildin_keywords("var"))
{
auto v11 = this->ast_var();
return this->make_call_or_just_expression(v11);
}
if (this->is_buildin_keywords("function"))
{
auto v11 = this->ast_function();
return this->make_call_or_just_expression(v11);
}
if (this->is_punctuation(";"))
{
auto v12 = this->offset_24->gen_son(night::NS_TYPE_SKIP);
return this->make_call_or_just_expression(v12);
}
auto v59 = this->offset_28->next();
if (!v59)
{
this->offset_28->err("End of file", 0, 0, false);
}
if (
night::NS_TYPE_VAR != v59->offset_0
&& night::NS_TYPE_NUM != v59->offset_0
&& night::NS_TYPE_STR != v59->offset_0
)
{
auto v39 = v59->offset_60;
if (night::NS_TYPE_B_TYPE != v59->offset_0)
{
}
bool NSASTParse::is_punctuation(std::string const&)
if (
"Number" != v39
&& "Math" != v39
&& "Date" != v39
)
{
auto v11 = v59;
return this->make_call_or_just_expression(v11);
}
auto v14 = this->offset_28->peek();
if (!v14)
{
auto v11 = v59;
return this->make_call_or_just_expression(v11);
}
auto v41 = v14->offset_60;
if ("[" != v41)
{
if ("." == v41)
{
auto v11 = this->ast_obj_dot(v59);
return this->make_call_or_just_expression(v11);
}
auto v11 = v59;
return this->make_call_or_just_expression(v11);
}
auto v11 = this->ast_obj_op(v59);
return this->make_call_or_just_expression(v11);
}
night::ns_node* NSASTParse::top_down()
auto v13 = this->offset_28->peek();
if (v13)
{
auto v40 = v13->offset_60;
if ("[" == v40)
{
auto v11 = this->ast_obj_op(v59);
return this->make_call_or_just_expression(v11);
}
if ("." == v40)
{
auto v11 = this->ast_obj_dot(v59);
return this->make_call_or_just_expression(v11);
}
}
if (this->is_obj_op_self(true))
{
auto v11 = this->ast_obj_op_self(v59);
return this->make_call_or_just_expression(v11);
}
auto v11 = v59;
return this->make_call_or_just_expression(v11);
}
// ast_dispatch - 5
auto v43 = this->offset_24;
auto v44 = v43->gen_girl(night::std_v_n);
auto v79 = v43->gen_son(night::NS_TYPE_PUNC);
v79->offset_60 = "(\000)\000{";
v44->push_back(v79);
this->offset_28->next();
auto v80 = this->ast_expression(); // 待确认
// ast_dispatch - 10
if (!this->is_exp(v80))
{
if (night::NS_TYPE_ASSIGN != v80->offset_0)
{
auto v3 = this->offset_28->offset_4;
auto v61 = this->offset_28;
int v27;
int v30;
std::string v81 = "Unexpected statement[" + v80->offset_0 + "]";
this->offset_28->err(v81, v27, v30, 1);
}
}
v44->push_back(v80);
this->ignore_punc(")\000{"); // 参数待确认
v79 = this->offset_24->gen_son(night::NS_TYPE_PUNC);
v79->offset_60 = ")\000{";
v44->push_back(v79);
v79 = this->offset_24->gen_son(night::NS_TYPE_BRACKET);
v79->offset_228 = v44;
v79->offset_108 = "";
auto v6 = this->offset_28->peek();
// ast_dispatch - 15
if (v6)
{
auto v64 = v6->offset_60;
if ("[" == v64)
{
auto v7 = this->ast_obj_op(v79);
return this->make_call_or_just_expression(v7);
}
if ("." == v64)
{
auto v7 = this->ast_obj_dot(v79);
return this->make_call_or_just_expression(v7);
}
}
// ast_dispatch - 20
return this->make_call_or_just_expression(v79);
}
night::ns_node *NSASTParse::make_binary_or_just_value(night::ns_node * a2, bool a3)
{
bool v21;
bool v18;
if (a3)
{
v21 = this->is_op("\0");
v18 = a3;
}
else
{
v21 = this->is_op_or_comma("\0");
v18 = false;
}
if (
v21
&& !this->is_op_self(false)
&& !this->is_obj_op_self(false)
&&this->is_exp(a2)
)
{
auto v3 = this->offset_28->next();
auto v4 = this->offset_28->offset_4;
int v15 = v4.offset_52;
int v16 = v4.offset_56;
if ("?" == v3->offset_60)
{
auto v19 = this->ast_ternary_expression();
if (!this->is_exp(v19))
{
this->offset_28->err("Expected exp", v15, v16, 1);
}
auto v24 = this->offset_24->gen_son(night::NS_TYPE_BINARY);
v24->offset_156.assign(v3->offset_60);
v24->offset_180 = a2;
v24->offset_184 = v19;
return this->make_binary_or_just_value(v24, a3);
}
else
{
bool v6 = "=" == v3->offset_60;
std::string v8 = "=";
if (!v6)
{
v8 = "op not=";
}
this->offset_44 = v8;
auto v9 = this->ast_dispatch(0);
auto bojv = this->make_binary_or_just_value(v9, a3);
if (!this->is_exp(bojv))
{
this->offset_28->err("Expected exp", v15, v16, 1);
}
night::ns_node *v26 = nullptr;
if (!v6)
{
v26 = this->offset_24->gen_son(night::NS_TYPE_BINARY);
}
else
{
v26 = this->offset_24->gen_son(night::NS_TYPE_ASSIGN);
}
v26->offset_156.assign(v3->offset_60);
v26->offset_180 = a2;
v26->offset_184 = bojv;
if (
("/" == v26->offset_156 || "/=" == v26->offset_156)
&& (!this->is_save_for_division(a2) || !this->is_save_for_division(bojv))
)
{
this->offset_28->err("Expected exp", v15, v16, 1);
}
}
}
return a2;
}
night::ns_node *NSASTParse::make_call_or_just_expression(night::ns_node * a2)
{
if (
night::NS_TYPE_PROG != a2->offset_0
&& night::NS_TYPE_B_TYPE != a2->offset_0
&& night::NS_TYPE_KW != a2->offset_0
&& night::NS_TYPE_FUNC != a2->offset_0
|| a2->offset_132 == ""
)
{
if (this->is_punctuation("(\000)\000{"))
{
a2 = this->ast_call(a2);
}
}
return a2;
}
night::ns_node *NSASTParse::ast_expression()
{
auto v1 = this->ast_dispatch(false);
auto binary_or_just_value = this->make_binary_or_just_value(v1, false);
return this->make_call_or_just_expression(binary_or_just_value);
}
night::ns_node *NSASTParse::ast_ternary_expression()
{
}
night::ns_node *NSASTParse::ast_obj_dot(night::ns_node*)
{
}
night::ns_node *NSASTParse::ast_obj_op(night::ns_node*)
{
}
night::ns_node *NSASTParse::ast_call(night::ns_node*)
{
}
night::ns_node *NSASTParse::ast_function()
{
}
night::ns_node *NSASTParse::ast_var()
{
}
night::ns_node *NSASTParse::ast_trans_kw()
{
}
bool NSASTParse::is_punctuation(std::string const &a2)
{
auto v2 = this->offset_28->peek();
if (v2)
{
if (night::NS_TYPE_PUNC == v2->offset_0)
{
if (a2 != v2->offset_60)
return 0;
}
else
{
return 0;
}
}
return true;
}
bool NSASTParse::is_buildin_keywords(std::string const &a2)
{
auto v2 = this->offset_28->peek();
if (v2)
{
if (night::NS_TYPE_KW == v2->offset_0)
{
if (a2 != v2->offset_60)
return false;
}
else
{
return false;
}
}
return true;
}
bool NSASTParse::is_save_for_division(night::ns_node *a2)
{
}
bool NSASTParse::is_exp(night::ns_node *a2)
{
}
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);
v6->push_back(v16);
auto v7 = this->offset_28;
// v7->offset_4;
// 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)
// {
// if (";" != v2->offset_60 && v2->offset_84.find(10, 0) == -1)
// {
// // this->offset_28->err("Expected LineFeed", , , true);
// }
// }
night::ns_node *v2 = v7->peek();
if (v2)
{
if (";" != v2->offset_60 && v2->offset_84.find(10, 0) == -1)
{
// this->offset_28->err("Expected LineFeed", , , true);
}
}
}
while (!this->offset_28->eof())
{
if(!this->is_punctuation(";"))
if (!this->is_punctuation(";"))
{
break;
}
this->offset_28->next();
}
}
auto son = this->offset_24->gen_son(night::NS_TYPE_PROG);
son->offset_108 = "";
@ -116,17 +620,22 @@ namespace night
return son;
}
void NSASTParse::ast_require()
night::ns_node *NSASTParse::ast_require()
{
auto v17 = this->offset_24->gen_girl(night::std_v_n);
auto v22 = this->offset_28->next();
v22->offset_60 = night::nsv_ + v22->offset_60;
v17.push_back(v22);
v17->push_back(v22);
v22 = this->offset_24->gen_son(night::NS_TYPE_PUNC);
v22->offset_60 = "(\000)\000{";
v17.push_back(v22);
v17->push_back(v22);
this->offset_28->next();
auto v3 = this->offset_28->next();
}
void NSASTParse::ignore_punc(std::string const&)
{
}
}

View File

@ -66,7 +66,7 @@ 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++)
for (auto i = a3->offset_196->begin(); i != a3->offset_196->end(); i++)
{
this->compile(*i);
}
@ -104,11 +104,11 @@ namespace night
}
auto v4 = a3->offset_228;
int v6 = 0;
for (auto i = v4.begin(); i != v4.end(); i++)
for (auto i = v4->begin(); i != v4->end(); i++)
{
this->compile(*i);
v6++;
if (v6 != v4.size())
if (v6 != v4->size())
{
// +=
this->offset_48 += v9.size();
@ -125,7 +125,7 @@ namespace night
// +=
this->offset_48++;
}
for (auto i = a3->offset_228.begin(); i != a3->offset_228.end(); i++)
for (auto i = a3->offset_228->begin(); i != a3->offset_228->end(); i++)
{
this->compile(*i);
// +=

View File

@ -10,8 +10,10 @@ namespace night
{
}
std::vector<night::ns_node *> NSGod::gen_girl(std::string a2)
std::vector<night::ns_node *>* NSGod::gen_girl(std::string a2)
{
night::NSGod::GodsSon* node = new night::NSGod::GodsSon();
if (night::std_v_n == a2)
{
@ -20,7 +22,8 @@ namespace night
{
}
this->offset_0.push_back(node);
return node->offset_24;
}
night::ns_node* NSGod::gen_son(std::string)
@ -30,6 +33,28 @@ namespace night
void NSGod::hamlet(void)
{
for (int i = 0; i < this->offset_0.size(); i++)
{
auto v3 = this->offset_0[i];
if (v3->offset_0 == night::std_v_n)
{
auto v4 = v3->offset_24;
if (v4)
{
delete v4;
}
}
if (v3->offset_0 == night::std_v_v_n)
{
auto v4 = v3->offset_24;
if (v4)
{
delete v4;
}
}
delete v3;
}
}
} // namespace night

View File

@ -41,5 +41,31 @@ namespace night
}
}
void NSStream::err(std::string const& a2, int a3, int a4, bool a5)
{
std::string v10;
std::string v13 = this->offset_0;
v13.append(":");
v10 += v13;
std::string v12;
if (a5)
{
v12 = std::to_string(a3);
v12.append(":");
v10 += v12;
v12 = std::to_string(a4);
}
else
{
v12 = std::to_string(this->offset_52 + a3);
v12.append(":");
v10 += v12;
v12 = std::to_string(this->offset_56 + a4);
}
v12.append(":");
v10 += v12;
v10 += a2;
throw v10;
}
}

View File

@ -9,23 +9,43 @@ namespace night
NSToken::~NSToken()
{
}
void NSToken::peek(void)
night::ns_node* NSToken::peek(void)
{
// this->offset_8;
auto result = this->offset_8;
if (!result)
{
result = this->read_next();
this->offset_8 = result;
}
void NSToken::read_next(void)
return result;
}
night::ns_node* NSToken::read_next(void)
{
}
night::ns_node* NSToken::next(void)
{
auto result = this->offset_8;
this->offset_8 = 0;
if (!result)
{
return this->read_next();
}
return result;
}
bool NSToken::eof(void)
{
// return this->peek() == 0;
return this->peek() == 0;
}
void NSToken::push(night::ns_node*)
{
}
void NSToken::err(std::string const& a2, int a3, int a4, bool a5)
{
this->offset_4.err(a2, a3, a4, a5);
}
}

View File

@ -15624,7 +15624,7 @@ void __thiscall __noreturn night::NSStream::err(_DWORD *this, int a2, unsigned i
std::string::operator+=(a2);
lpuexcpta = (struct _Unwind_Exception *)__cxa_allocate_exception(0x18u);
std::string::basic_string(lpuexcpta, v10);
__cxa_throw(lpuexcpta, (struct type_info *)&`typeinfo for'std::string, (void (__cdecl *)(void *))std::string::~string);
__cxa_throw(lpuexcpta, (struct type_info *)&`typeinfo for std::string, (void (__cdecl *)(void *))std::string::~string);
}
// 40E4F8: using guessed type _DWORD __stdcall std::string::operator+=(_DWORD);
// 55BB98: using guessed type int *`typeinfo for'std::string;
@ -16090,6 +16090,7 @@ int __thiscall night::NSGod::gen_girl(void *this, int a2)
*(_DWORD *)(v7 + 24) = v6;
}
std::vector<night::NSGod::GodsSon *>::push_back((int)this, &v9);
// v9->offset_24
return v9[6];
}
@ -16957,7 +16958,8 @@ _DWORD *__userpurge night::NSASTParse::ast_dispatch@<eax>(_DWORD *a1@<ecx>, nigh
int v81[6]; // [esp+1B0h] [ebp-38h] BYREF
void *v82[8]; // [esp+1C8h] [ebp-20h] BYREF
std::string::basic_string(v82, (char *)asc_5527F4);
// ast_dispatch - 0
std::string::basic_string(v82, (char *)asc_5527F4); // "(\000)\000{"
v42 = night::NSASTParse::is_punctuation(a1, (int)v82);
std::string::_M_dispose(v82);
if ( !v42 )
@ -17001,9 +17003,9 @@ _DWORD *__userpurge night::NSASTParse::ast_dispatch@<eax>(_DWORD *a1@<ecx>, nigh
if ( v46 )
{
v11 = night::NSASTParse::ast_obj_block(a1);
LABEL_113:
LABEL_113:
v65 = night::NSASTParse::make_call_or_just_expression(a1, v11);
goto LABEL_114;
goto LABEL_114; // 销毁v67, 返回v65
}
if ( !v68 || (unsigned __int8)std::operator!=<char>("op not=", (int)v67) )
{
@ -17038,7 +17040,7 @@ LABEL_113:
v11 = night::NSASTParse::ast_if(a1);
goto LABEL_113;
}
std::string::basic_string(v82, (char *)off_552210);
std::string::basic_string(v82, (char *)off_552210); // for
v49 = night::NSASTParse::is_buildin_keywords(a1, (int)v82);
std::string::_M_dispose(v82);
if ( v49 )
@ -17073,15 +17075,15 @@ LABEL_113:
std::string::basic_string(v69, "true");
if ( night::NSASTParse::is_buildin_keywords(a1, (int)v69) )
{
v38 = 0;
v53 = 0;
v26 = 0;
v29 = 0;
v32 = 0;
v23 = 0;
v22 = 0;
v25 = 0;
v24 = 0;
v38 = 0; // 销毁字符串
v53 = 0; // 销毁字符串
v26 = 0; // 销毁字符串
v29 = 0; // 销毁字符串
v32 = 0; // 销毁字符串
v23 = 0; // 销毁字符串
v22 = 0; // 销毁字符串
v25 = 0; // 销毁字符串
v24 = 0; // 销毁字符串
}
else
{
@ -17124,7 +17126,7 @@ LABEL_113:
}
else
{
std::string::basic_string(v73, (char *)off_552620);
std::string::basic_string(v73, (char *)off_552620); // NaN
if ( night::NSASTParse::is_buildin_keywords(a1, (int)v73) )
{
v38 = 0;
@ -17219,12 +17221,12 @@ LABEL_113:
}
v25 = 1;
}
v24 = 1;
}
v24 = 1; // 用于销毁字符串
} // end check for "true"
v21 = 1;
if ( !is_op_self )
if ( !is_op_self )// true 与 false 都是执行 label_62
{
LABEL_62:
LABEL_62:
if ( v38 )
std::string::_M_dispose(v78);
if ( v53 )
@ -17257,7 +17259,7 @@ LABEL_62:
v11 = night::NSASTParse::ast_require(a1);
goto LABEL_113;
}
std::string::basic_string(v82, (char *)off_551FFE);
std::string::basic_string(v82, (char *)off_551FFE); // var
v55 = night::NSASTParse::is_buildin_keywords(a1, (int)v82);
std::string::_M_dispose(v82);
if ( v55 )
@ -17283,7 +17285,7 @@ LABEL_62:
v12 = night::NSGod::gen_son(v58, (int)v82);
v65 = night::NSASTParse::make_call_or_just_expression(a1, v12);
std::string::_M_dispose(v82);
LABEL_114:
LABEL_114: // 销毁v67, 返回v65
std::string::_M_dispose((void **)v67);
return v65;
}
@ -17321,11 +17323,11 @@ LABEL_114:
{
if ( std::operator==<char>(".", v41) )
goto LABEL_111;
LABEL_112:
LABEL_112:
v11 = v59;
goto LABEL_113;
}
LABEL_99:
LABEL_99:
v11 = night::NSASTParse::ast_obj_op(a1, (int)v59);
goto LABEL_113;
}
@ -17337,7 +17339,7 @@ LABEL_99:
goto LABEL_99;
if ( std::operator==<char>(".", v40) )
{
LABEL_111:
LABEL_111:
v11 = night::NSASTParse::ast_obj_dot(a1, (int)v59);
goto LABEL_113;
}
@ -17349,10 +17351,12 @@ LABEL_111:
}
goto LABEL_112;
}
LABEL_61:
LABEL_61:
std::string::_M_dispose(v79);
goto LABEL_62;
}
// ast_dispatch - 5
v43 = (void *)a1[6];
std::string::basic_string((char *)v82, (int)&night::std_v_n);
v44 = (void **)night::NSGod::gen_girl(v43, (int)v82);
@ -17368,6 +17372,7 @@ LABEL_61:
v27 = *(_DWORD *)(v3 + 52);
v30 = *(_DWORD *)(v3 + 56);
v80[0] = (void *)night::NSASTParse::ast_expression((night::NSASTParse *)v17);
// ast_dispatch - 10
if ( !night::NSASTParse::is_exp((int)v80[0]) )
{
v34 = v80[0];
@ -17388,7 +17393,7 @@ LABEL_61:
std::string::basic_string((char *)v82, (int)&night::NS_TYPE_PUNC);
v79[0] = night::NSGod::gen_son(v35, (int)v82);
std::string::_M_dispose(v82);
std::string::operator=((unsigned int *)v79[0] + 15, (char *)&asc_5527F4[2]);
std::string::operator=((unsigned int *)v79[0] + 15, (char *)&asc_5527F4[2]); // ")\000{" ?
std::vector<night::ns_node *>::push_back(v44, (char **)v79);
v36 = (void *)a1[6];
std::string::basic_string((char *)v82, (int)&night::NS_TYPE_BRACKET);
@ -17398,6 +17403,8 @@ LABEL_61:
*((_DWORD *)v79[0] + 57) = v44;
std::string::operator=(v5 + 27, (char *)&byte_551F04);
v6 = night::NSToken::peek(a1[7]);
// ast_dispatch - 15
if ( v6 )
{
v64 = (int)(v6 + 15);
@ -17412,6 +17419,8 @@ LABEL_61:
return night::NSASTParse::make_call_or_just_expression(a1, v7);
}
}
// ast_dispatch - 20
return night::NSASTParse::make_call_or_just_expression(a1, (_DWORD *)v79[0]);
}
// 4127DA: variable 'v18' is possibly undefined
@ -17471,7 +17480,7 @@ int __thiscall night::NSASTParse::make_binary_or_just_value(_DWORD *this, int a2
if ( a3 )
{
std::string::basic_string(v31, (char *)&byte_551F04);
std::string::basic_string(v31, (char *)&byte_551F04); // '\0'
v21 = night::NSASTParse::is_op(this, (int)v31);
v18 = a3;
}
@ -17536,7 +17545,7 @@ int __thiscall night::NSASTParse::make_binary_or_just_value(_DWORD *this, int a2
std::string::basic_string((char *)v32, (int)v10);
v26 = night::NSGod::gen_son(v20, (int)v32);
std::string::_M_dispose(v32);
std::string::_M_assign((int)(v26 + 39), v22);
std::string::_M_assign((int)(v26 + 39), v22); // v3->offset_60
v26[45] = a2;
v26[46] = binary_or_just_value;
if ( (std::operator==<char>("/", (int)(v26 + 39)) || std::operator==<char>("/=", (int)(v26 + 39)))