diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a4591b..f47b130 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ add_executable(wcc src/night/ns_stream.cpp src/night/ns_token.cpp src/night/ns_god/ns_god.cpp + src/night/str/str.cpp src/wxml/expr_lib/base.cpp src/wxml/expr_lib/bnf.cpp src/wxml/expr_lib/common.cpp diff --git a/src/include/night.h b/src/include/night.h index 555b7ce..26efdab 100644 --- a/src/include/night.h +++ b/src/include/night.h @@ -36,27 +36,27 @@ 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; + extern std::string nsv_; + extern std::string nst_; + + extern std::string NS_BUILTIN_SPACE; + extern std::string NS_BUILTIN_PUNC; + extern std::string NS_BUILTIN_OP; + extern std::string NS_BUILTIN_ALL_OP; + extern std::string NS_BUILTIN_TYPE; + extern std::string NS_BUILTIN_KW; + extern std::string NS_BUILTIN_OP_SELF; + int compile_ns(std::string const&,std::string const&,std::string const&,uint,std::string&,bool); void compile_ns_with_sourcemap(std::string const&,std::string const&,std::string const&,std::string const&,uint,std::string&,std::string&); void readfile(char const*, std::string &); void writefile(char const*, std::string &); - class NSGod - { - private: - /* data */ - public: - NSGod(/* args */); - ~NSGod(); - void gen_girl(std::string); - void gen_son(std::string); - void hamlet(void); - }; - class ns_node { private: @@ -64,48 +64,143 @@ namespace night public: std::string offset_0; std::string offset_24; + int offset_48 = 0; + int offset_52 = 0; + int offset_56 = 0; 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 offset_196; - std::vector offset_228; + night::ns_node * offset_180 = nullptr; + night::ns_node * offset_184 = nullptr; + night::ns_node * offset_188 = nullptr; + night::ns_node * offset_192 = nullptr; + std::vector* 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; + + /** + * 分析内存,两层vector + */ + std::vector*>* offset_224 = nullptr; + + std::vector* offset_228 = nullptr; + std::vector* offset_232 = nullptr; + std::vector*>* offset_236 = nullptr; + std::vector* offset_240 = nullptr; + std::vector* offset_244 = nullptr; ns_node(/* args */); ~ns_node(); std::string debug_no_space(void); }; + + // class GodsSon + // { + // private: + // /* data */ + // public: + // std::string offset_0; + + // }; + + class NSGod + { + private: + /* data */ + public: + struct GodsSon { + std::string offset_0; + union Offset24 + { + /* data */ + std::vector* vec = nullptr; + std::vector*>* vecVec; + night::ns_node * node; + }; + Offset24 offset_24; + + // std::vector* offset_24; + + }; + std::vector offset_0; + NSGod(/* args */); + ~NSGod(); + GodsSon::Offset24 gen_girl(std::string a2); + night::ns_node* gen_son(std::string); + void hamlet(void); + }; + + struct PeekData + { + char data; + int offset_4; + int offset_8; + }; + + class NSStream + { + private: + /* data */ + public: + std::string offset_0; + std::string offset_24 = ""; + int offset_48 = 0; + int offset_52 = 0; // 当前行数 + int offset_56 = 0; // 当前行第几个字符位置 + 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); + PeekData next(void); + PeekData peek(void); + PeekData peek_2(void); + }; + class NSToken { private: /* data */ public: + NSGod* offset_0 = nullptr; + NSStream * offset_4 = nullptr; + night::ns_node* offset_8 = nullptr; + std::vector offset_12; + std::map offset_24; + NSToken(/* args */); ~NSToken(); bool eof(void); - void err(std::string const&,int,int,bool); + void err(std::string const&, int, int, bool); void get_tokens_for_sourcemap(std::map &, std::map &); - void next(void); + 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); - void read_number(std::string const&); - void read_string(char,std::string const&); - void read_var(std::string const&); + night::ns_node * read_next(void); + night::ns_node * read_number(std::string const&); + night::ns_node * read_string(char, std::string const&); + night::ns_node * read_var(std::string const&); std::string read_while(bool (*)(char,void *),void *); - void rw_cb_number(char,void *); + static bool rw_cb_number(char,void *); void skip_comment(std::string &); - void tk_is_comment2(char,void *); - void tk_is_not_line_break(char,void *); - void tk_is_valid_op_str(char,void *); - void tk_is_var(char,void *); - void tk_is_var_start(char,void *); - void tk_is_whitespace(char,void *); + static bool tk_is_comment2(char,void *); + static bool tk_is_not_line_break(char,void *); + static bool tk_is_valid_op_str(char,void *); + static bool tk_is_var(char,void *); + static bool tk_is_var_start(char,void *); + static bool tk_is_whitespace(char,void *); }; class NSASTParse @@ -113,64 +208,65 @@ namespace night private: /* data */ std::string offset_0; - night::NSGod * offset_24; - night::NSToken * offset_28; - int offset_36; - int offset_40; + night::NSGod * offset_24 = nullptr; + night::NSToken * offset_28 = nullptr; + int offset_32 = 0; + int offset_36 = 0; + int offset_40 = 0; std::string offset_44; - int offset_52; + std::string offset_60; public: 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); - void 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); - void end_line(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); + 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); + bool 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) */ - void 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 *); - void make_list_by_parser( + night::ns_node * is_punctuation(std::string const&); + 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 *); + std::vector* make_list_by_parser( std::string const&, std::string const&, std::string const&, @@ -179,16 +275,28 @@ namespace night int, std::string ); - void top_down(void); + night::ns_node* top_down(void); }; class ns_sourcemap { private: /* data */ + /* + 大小:64byte + */ public: std::string offset_0; + int offset_24; + int offset_28; + std::string offset_32; + int offset_56; + int offset_60; ns_sourcemap(/* args */); + ns_sourcemap(ns_sourcemap &&); + ns_sourcemap(ns_sourcemap const&); + ns_sourcemap& operator=(ns_sourcemap const&); + ns_sourcemap& operator=(ns_sourcemap &&); ~ns_sourcemap(); }; @@ -196,10 +304,10 @@ namespace night { private: /* data */ - night::NSASTParse * offset_24; - std::vector * offset_28; public: std::string offset_0; + night::NSASTParse * offset_24 = nullptr; + std::vector * offset_28 = nullptr; std::vector offset_36; int offset_48; NSCompileJs(/* args */); @@ -216,7 +324,7 @@ namespace night std::string compile_obj_dot(night::ns_node *); std::string compile_obj_property(night::ns_node *); std::string compile_obj_self_op(night::ns_node *); - void compile_once(std::string &, std::vector *, bool); + std::string compile_once(std::string &, std::vector *, bool); std::string compile_op_self(night::ns_node *); std::string compile_prog(night::ns_node *); std::string compile_prog_no_sem(night::ns_node *); @@ -225,31 +333,11 @@ namespace night std::string compile_var(night::ns_node *); 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); - void path_combine( + std::string get_token(std::string const&, int); + int path_combine( std::string const&, std::string const&, std::string& diff --git a/src/night/night.cpp b/src/night/night.cpp index f8ca23a..356902a 100644 --- a/src/night/night.cpp +++ b/src/night/night.cpp @@ -2,39 +2,51 @@ namespace night { - std::string NS_TYPE_BOOL; - std::string NS_TYPE_VAR; - std::string NS_TYPE_NUM; - std::string NS_TYPE_B_TYPE; - std::string NS_TYPE_OP_SELF; - std::string NS_TYPE_BINARY; - std::string NS_TYPE_ASSIGN; - std::string NS_TYPE_TERNARY; - std::string NS_TYPE_OBJ_DOT; - std::string NS_TYPE_OBJ_PROPERTY; - std::string NS_TYPE_OBJ_SELF_OP; - std::string NS_TYPE_OBJ_BLOCK; - std::string NS_TYPE_BRACKET; - std::string NS_TYPE_CALL; - std::string NS_TYPE_KW; - std::string NS_TYPE_SKIP; - std::string NS_TYPE_STR; - std::string NS_TYPE_PUNC; - std::string NS_TYPE_FUNC; - std::string NS_TYPE_PROG; - std::string NS_TYPE_PROG_NO_SEM; - std::string NS_TYPE_PROG_NO_SEM_REQUIRE; - std::string NS_TYPE_ARRAY; - std::string NS_TYPE_SWITCH; - std::string NS_TYPE_DO_WHILE; - std::string NS_TYPE_WHILE; - std::string NS_TYPE_FOR; - std::string NS_TYPE_IF; - std::string NS_TYPE_K_V; + std::string NS_TYPE_BOOL = "bool"; + std::string NS_TYPE_VAR = "var"; + std::string NS_TYPE_NUM = "num"; + std::string NS_TYPE_B_TYPE = "builtin_type"; + std::string NS_TYPE_OP_SELF = "op_self"; + std::string NS_TYPE_BINARY = "binary"; + std::string NS_TYPE_ASSIGN = "assign"; + std::string NS_TYPE_TERNARY = "ternary"; + std::string NS_TYPE_OBJ_DOT = "obj_dot"; + std::string NS_TYPE_OBJ_PROPERTY = "obj_property"; + std::string NS_TYPE_OBJ_SELF_OP = "obj_self_op"; + std::string NS_TYPE_OBJ_BLOCK = "obj_block"; + std::string NS_TYPE_ARRAY = "array"; + std::string NS_TYPE_BRACKET = "bracket"; + std::string NS_TYPE_CALL = "call"; + std::string NS_TYPE_KW = "kw"; + std::string NS_TYPE_SKIP = "skip"; + std::string NS_TYPE_STR = "str"; + std::string NS_TYPE_PUNC = "punc"; + std::string NS_TYPE_FUNC = "function"; + std::string NS_TYPE_PROG = "prog"; + std::string NS_TYPE_PROG_NO_SEM = "prog_no_sem"; + std::string NS_TYPE_PROG_NO_SEM_REQUIRE = "prog_no_sem_require"; + std::string NS_TYPE_SWITCH = "switch"; + std::string NS_TYPE_DO_WHILE = "do_while"; + std::string NS_TYPE_WHILE = "while"; + std::string NS_TYPE_FOR = "for"; + std::string NS_TYPE_IF = "if"; + std::string NS_TYPE_K_V = "k-v"; + std::string NS_TYPE_OP = "op"; + std::string NS_BUILTIN_OP = "+-*/%=&^|<>~!?"; + std::string NS_BUILTIN_OP_SELF = "~!"; + std::string NS_BUILTIN_ALL_OP = " = ? + - * / % ++ -- + - ~ ! << >> >>> & ^ | < > <= >= == != === !== *= /= %= += -= <<= >>= >>>= &= ^= |= && || "; + std::string NS_BUILTIN_PUNC = ".,;(){}[]:"; + std::string NS_BUILTIN_SPACE = " \t\r\n"; + std::string NS_BUILTIN_TYPE = " Number Math Date "; + // keywords + std::string NS_BUILTIN_KW = " delete void typeof null undefined NaN Infinity var if else true false require this function arguments return for while do break continue switch case default "; - std::string std_v_n = ""; - std::string std_v_v_n = ""; + std::string std_v_n = "new std::vector"; + std::string std_v_v_n = "new std::vector*>"; + + std::string nsv_ = "nv_"; + std::string nst_ = "nt_"; int compile_ns( std::string const& a1, @@ -48,9 +60,37 @@ 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 v18; + cjs.offset_24 = &v39; + cjs.offset_48 = 1; + std::string v21 = cjs.compile_once(v19, &v18, a6); v17.hamlet(); + if (v21.length()) + { + a5.assign(v21); + return 121; + } + else + { + std::string v24 = ";return " + night::nsv_; + v24.append("module.").append(night::nsv_); + v24.append("exports;"); + std::string v25 = "function " + a2; + v25.append("(){"); + a5 = v25; + std::string v23 = "var " + night::nsv_; + v23.append("module={").append(night::nsv_); + v23.append("exports:{}};"); + a5.append(v23); + std::string v26 = v19 + v24; + a5.append(v26); + a5.append("}"); + } return 0; } diff --git a/src/night/ns_ast_parse.cpp b/src/night/ns_ast_parse.cpp index 25ad260..786ad8d 100644 --- a/src/night/ns_ast_parse.cpp +++ b/src/night/ns_ast_parse.cpp @@ -2,13 +2,12 @@ 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; @@ -16,26 +15,1493 @@ namespace night this->offset_36 = 0; this->offset_40 = 0; this->offset_44 = ""; - this->offset_52 = 0; } - + NSASTParse::~NSASTParse() { } - void NSASTParse::is_op_or_comma(std::string const&) + bool NSASTParse::is_op(std::string const &a2) { + 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; + } + else + { + 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_obj_block() + { + auto v13 = this->offset_24; + auto v12 = v13->gen_girl(night::std_v_n); + this->ignore_punc("{"); + + auto v25 = v13->gen_son(night::NS_TYPE_PUNC); + v25->offset_60 = "{"; + v12.vec->push_back(v25); + auto v15 = this->is_punctuation("}"); + + auto v1 = v15 == nullptr; + + LABEL_2: + if (v1) + { + while(true) + { + auto v2 = this->offset_28->next(); + if ( + !v2 + || night::NS_TYPE_VAR != v2->offset_0 + && night::NS_TYPE_STR != v2->offset_0 + ) + { + std::string msg = "Expected variable|string"; + this->offset_28->err(msg, 0, 0, false); + } + if (night::NS_TYPE_STR == v2->offset_0) + { + std::string v26 = night::nsv_ + v2->offset_60; + v2->offset_60 = v26; + } + this->ignore_punc(":"); + auto v10 = this->ast_expression_no_comma(); + v25 = this->offset_24->gen_son(night::NS_TYPE_K_V); + v25->offset_188 = v2; + v25->offset_192 = v10; + v12.vec->push_back(v25); + + auto v4 = this->offset_28->peek(); + if (!v4) + { + std::string msg = "Expected variable|string"; + this->offset_28->err(msg, 0, 0, false); + } + if ("}" == v4->offset_60) + { + break; + } + if ("," == v4->offset_60) + { + this->offset_28->next(); + auto v5 = this->offset_28->peek(); + if (!v5) + { + std::string msg = "Expected variable|string"; + this->offset_28->err(msg, 0, 0, false); + } + v1 = "}" != v5->offset_60; + goto LABEL_2; + } + } + } + + this->ignore_punc("}"); + + v25 = this->offset_24->gen_son(night::NS_TYPE_PUNC); + v25->offset_60 = "}"; + v12.vec->push_back(v25); + + v25 = this->offset_24->gen_son(night::NS_TYPE_OBJ_BLOCK); + v25->offset_228 = v12.vec; + v25->offset_108 = ""; + + auto v7 = this->offset_28->peek(); + if (!v7) + { + return this->make_call_or_just_expression(v25); + } + if ("[" != v7->offset_60) + { + if ("." == v7->offset_60) + { + auto v8 = this->ast_obj_dot(v25); + return this->make_call_or_just_expression(v8); + } + return this->make_call_or_just_expression(v25); + } + auto v8 = this->ast_obj_op(v25); + return this->make_call_or_just_expression(v8); + + // throw "not implement"; + } + night::ns_node *NSASTParse::ast_code_block() + { + auto lbp = this->make_list_by_parser("{", "}", ";", "ast_expression", true, -1, ""); + auto v10 = this->offset_24->gen_girl(night::std_v_n); + auto v15 = this->offset_24->gen_son(night::NS_TYPE_PUNC); + v15->offset_60 = "{"; + v10.vec->push_back(v15); + + if (lbp->begin() != lbp->end()) + { + v15 = this->offset_24->gen_son(night::NS_TYPE_PROG); + v15->offset_228 = lbp; + v15->offset_108 = ""; + v10.vec->push_back(v15); + } + v15 = this->offset_24->gen_son(night::NS_TYPE_PUNC); + v15->offset_60 = "}"; + v10.vec->push_back(v15); + + v15 = this->offset_24->gen_son(night::NS_TYPE_PROG_NO_SEM); + v15->offset_228 = v10.vec; + v15->offset_108 = ""; + + return this->make_call_or_just_expression(v15); + } + night::ns_node *NSASTParse::ast_new_array() + { + throw "not implement"; + } + + night::ns_node *NSASTParse::ast_obj_op_self(night::ns_node *a2) + { + auto v14 = this->offset_24; + auto v15 = v14->gen_son(night::NS_TYPE_OBJ_SELF_OP); + v15->offset_200 = a2 == nullptr; + v15->offset_156 = ""; + v15->offset_192 = 0; + auto v2 = this->offset_28->next(); + if (!v2) + { + std::string msg = "End of file"; + this->offset_28->err(msg, 0, 0, false); + } + auto v3 = v2->offset_60; + auto v7 = v2->offset_84; + if (a2) + { + v15->offset_192 = a2; + v15->offset_156.assign(v3); + v15->offset_84.assign(v7); + } + else + { + v15->offset_156.assign(v3); + v15->offset_84.assign(v7); + auto v12 = this->offset_28->peek(); + if (!v12) + { + std::string msg = "End of file"; + this->offset_28->err(msg, 0, 0, false); + } + if (night::NS_TYPE_VAR != v12->offset_0) + { + std::string msg = "Unexpected token `" + v12->offset_60 + "`"; + this->offset_28->err(msg, 0, 0, false); + } + auto v13 = this->ast_expression_no_comma(); + if (night::NS_TYPE_OBJ_SELF_OP == v13->offset_0) + { + auto v10 = this->offset_24->gen_son(night::NS_TYPE_OP); + v10->offset_60.assign(v13->offset_156); + v10->offset_84.assign(v13->offset_84); + this->offset_28->push(v10); + v15->offset_192 = v13->offset_192; + } + else + { + v15->offset_192 = v13; + } + } + return v15; + } + + night::ns_node *NSASTParse::ast_op_self() + { + throw "not implement"; + } + night::ns_node *NSASTParse::ast_if() + { + throw "not implement"; + } + night::ns_node *NSASTParse::ast_for() + { + throw "not implement"; + } + night::ns_node *NSASTParse::ast_while() + { + throw "not implement"; + } + night::ns_node *NSASTParse::ast_do_while() + { + throw "not implement"; + } + night::ns_node *NSASTParse::ast_switch() + { + throw "not implement"; + } + bool NSASTParse::is_obj_op_self(bool a3) + { + if (a3) + { + auto v3 = this->offset_28->peek(); + if (v3) + { + if (v3->offset_84.find('\n') != -1) + { + return 0; + } + } + } + bool result = true; + if (!this->is_op("++")) + { + result = this->is_op("--") != 0; + } + return result; + } + bool NSASTParse::is_op_self(bool a3) + { + auto v3 = this->offset_28->peek(); + if (!v3) + { + return false; + } + bool v6 = night::NS_TYPE_OP == v3->offset_0; + if (!v6) + { + return false; + } + if (v3->offset_60.find_first_not_of(night::NS_BUILTIN_OP_SELF) == -1) + { + return v6; + } + if (!a3 || night::NS_TYPE_OP != v3->offset_0) + { + return false; + } + if ("-" != v3->offset_60) + { + return "+" == v3->offset_60; + } + return v6; + } + // int ast_dispatch_i = 0; + night::ns_node *NSASTParse::ast_dispatch(bool a3) + { + // int inner_ast_dispatch_i = ++ast_dispatch_i; + // ast_dispatch - 0 + auto v42 = this->is_punctuation("("); + if (!v42) + { + auto v67 = this->offset_44; + this->offset_44 = ""; + 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 = false; + 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) + { + + } + 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); + } + + 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); + auto result = this->make_call_or_just_expression(v11); + return result; + } + } + 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; + night::ns_node * result = this->make_call_or_just_expression(v11); + return result; + + } + // 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 = "("; + v44.vec->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 = v3->offset_52; + int v30 = v3->offset_56; + std::string v81 = "Unexpected statement[" + v80->offset_0 + "]"; + this->offset_28->err(v81, v27, v30, 1); + } + } + v44.vec->push_back(v80); + this->ignore_punc(")"); // 参数待确认 + v79 = this->offset_24->gen_son(night::NS_TYPE_PUNC); + v79->offset_60 = ")"; + v44.vec->push_back(v79); + v79 = this->offset_24->gen_son(night::NS_TYPE_BRACKET); + v79->offset_228 = v44.vec; + 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 + auto result = this->make_call_or_just_expression(v79); + return result; } - void NSASTParse::is_punctuation(std::string const&) + std::vector* NSASTParse::make_list_by_parser( + std::string const& a2, + std::string const& a3, + std::string const& a4, + std::string const& a5, + bool a6, + int a7, + std::string a8 + ) { + auto v18 = this->offset_24->gen_girl(night::std_v_n); + this->ignore_punc(a2); + int v14 = 0; + for (int i = 1; !this->offset_28->eof() && ! this->is_punctuation(a3); i = 0) + { + if (!i) + { + if (a6) + { + this->ignore_punc_pass_sem(a4); + } + else + { + this->ignore_punc(a4); + } + v14++; + } + if (this->is_punctuation(a3)) + { + break; + } + if ("ast_expression_no_comma" == a5) + { + if ("ast_new_array" == a8) + { + if (this->is_punctuation(a4)) + { + auto v20 = this->offset_24->gen_son(night::NS_TYPE_SKIP); + v18.vec->push_back(v20); + continue; + } + } + auto v20 = this->ast_expression_no_comma(); + v18.vec->push_back(v20); + } + else if ("ast_expression" == a5) + { + auto v20 = this->ast_expression(); + v18.vec->push_back(v20); + } + else + { + if ("ast_varname" != a5) + { + v18.vec->push_back(nullptr); // TODO...待确认 + continue; + } + auto v20 = this->ast_varname(); + v18.vec->push_back(v20); + } + } + if (a7 != -1 && v14 != a7) + { + return 0; + } + this->ignore_punc(a3); + return v18.vec; + + } + + // int make_binary_or_just_value_i = 0; + night::ns_node *NSASTParse::make_binary_or_just_value(night::ns_node * a2, bool a3) + { + // int inner_make_binary_or_just_value_i = ++make_binary_or_just_value_i; + bool v21; + bool v18; + if (a3) + { + v21 = this->is_op(""); + v18 = a3; + } + else + { + v21 = this->is_op_or_comma(""); + 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 this->make_binary_or_just_value(v26, a3); + } + } + 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("(")) + { + a2 = this->ast_call(a2); + } + } + return a2; + } + // int ast_expression_i = 0; + night::ns_node *NSASTParse::ast_expression() + { + // int inner_ast_expression_i = ast_expression_i++; + auto v1 = this->ast_dispatch(false); + auto binary_or_just_value = this->make_binary_or_just_value(v1, false); + auto result = this->make_call_or_just_expression(binary_or_just_value); + return result; + } + night::ns_node *NSASTParse::ast_expression_no_binary() + { + auto v1 = this->ast_dispatch(false); + return this->make_call_or_just_expression(v1); + } + + night::ns_node *NSASTParse::ast_ternary_expression() + { + throw "not implement"; + } + + // int ast_obj_dot_i = 0; + night::ns_node *NSASTParse::ast_obj_dot(night::ns_node* a2) + { + // int inner_ast_obj_dot_i = ast_obj_dot_i++; + auto v11 = this->offset_24; + auto v9 = v11->gen_girl(night::std_v_n); + auto v10 = v11->gen_son(night::NS_TYPE_OBJ_DOT); + night::ns_node * v5 = nullptr; + + v10->offset_192 = a2; + v10->offset_196 = v9.vec; + + do + { + this->ignore_punc("."); + auto v2 = this->offset_28; + auto v3 = v2->offset_4; + auto v7 = v3->offset_52; + auto v8 = v3->offset_56; + + auto v13 = v2->peek(); + if (!v13) + { + std::string msg = "End of file"; + this->offset_28->err(msg, 0, 0, false); + } + if (night::NS_TYPE_VAR != v13->offset_0) + { + std::string msg = "Unexpected token `" + v13->offset_60 + "`"; + this->offset_28->err(msg, v7, v8, true); + } + auto v18 = this->ast_expression_no_comma(); + v9.vec->push_back(v18); + v5 = this->offset_28->peek(); + + } while (v5 && "." == v5->offset_60); + return v10; + } + + night::ns_node *NSASTParse::ast_obj_op(night::ns_node*) + { + throw "not implement"; + } + + night::ns_node *NSASTParse::ast_call(night::ns_node* a2) + { + auto v10 = this->offset_24->gen_girl(night::std_v_v_n); + auto v15 = this->offset_24->gen_son(night::NS_TYPE_CALL); + v15->offset_220 = a2; + v15->offset_224 = v10.vecVec; + + auto v8 = this->offset_28->peek(); + auto v7 = this->is_punctuation("("); + if (!v7) + { + this->offset_28->err("Unexpected token `" + v8->offset_60 + "`", 0, 0, false); + } + auto lbp = this->make_list_by_parser("(", ")", ",", "ast_expression_no_comma", false, -1, ""); + + std::vector * v19; + for (auto i = lbp; ; i = v19) + { + v10.vecVec->push_back(i); + if (!this->is_punctuation("(")) + { + break; + } + v19 = this->make_list_by_parser("(", ")", ",", "ast_expression_no_comma", false, -1, ""); + } + auto v4 = this->offset_28->peek(); + if (v4) + { + night::ns_node * v5; + if ("[" == v4->offset_60) + { + this->ast_obj_op(v15); + v5 = this->is_punctuation("("); + } + else + { + if ("." != v4->offset_60) + { + return v15; + } + v15 = this->ast_obj_dot(v15); + v5 = this->is_punctuation("("); + } + if (v5) + { + return this->ast_call(v15); + } + } + return v15; + } + night::ns_node *NSASTParse::ast_function() + { + auto god = this->offset_24; + auto son = god->gen_son(night::NS_TYPE_FUNC); + son->offset_0.assign(night::NS_TYPE_FUNC); + this->offset_28->next(); + auto v3 = this->offset_28->peek(); + + if (v3 && night::NS_TYPE_VAR == v3->offset_0) + { + son->offset_132.assign(v3->offset_60); + son->offset_24.assign(v3->offset_24); + son->offset_48 = v3->offset_48; + son->offset_52 = v3->offset_52; + this->offset_28->next(); + } + else + { + son->offset_132 = ""; + } + + son->offset_244 = this->make_list_by_parser("(", ")", ",", "ast_varname", false, -1, ""); + this->offset_32++; + son->offset_216 = this->ast_code_block(); + this->offset_32--; + return son; + } + night::ns_node *NSASTParse::ast_expression_no_comma() + { + auto v1 = this->ast_dispatch(false); + auto bojv = this->make_binary_or_just_value(v1, true); + return this->make_call_or_just_expression(bojv); + } + night::ns_node *NSASTParse::ast_var() + { + this->offset_28->next(); + auto v17 = this->offset_24; + auto v16 = v17->gen_girl(night::std_v_n); + + while (true) + { + auto v1 = this->offset_28; + auto v2 = v1->offset_4; + auto v9 = v2->offset_52; + auto v11 = v2->offset_56; + + auto v18 = v1->next(); + if (!v18) + { + std::string msg = "End of file"; + this->offset_28->err(msg, 0, 0, false); + } + if (night::NS_TYPE_VAR != v18->offset_0) + { + std::string msg = "Expected variable name"; + this->offset_28->err(msg, v9, v11, true); + } + v18->offset_56 = 1; + auto v3 = this->offset_28->peek(); + if (v3 && "=" == v3->offset_60) + { + auto v26 = this->make_binary_or_just_value(v18, true); + v16.vec->emplace_back(v26); + } + else + { + v16.vec->push_back(v18); + } + + auto v4 = this->offset_28; + auto v5 = v4->offset_4; + auto v10 = v5->offset_52; + auto v12 = v5->offset_56; + auto v14 = v4->peek(); + if (!v14) + { + break; + } + auto v19 = v14->offset_60; + if ( + ";" == v19 + || "," != v19 && v14->offset_84.find("\n") != -1 + ) + { + break; + } + if (this->offset_28->eof()) + { + std::string msg = "End of file"; + this->offset_28->err(msg, 0, 0, false); + } + auto v7 = "," != v19; + if (v7) + { + std::string msg = "Unexpected token `" + v19 + "`"; + this->offset_28->err(msg, v10, v12, true); + } + this->offset_28->next(); + } + auto son = this->offset_24->gen_son(night::NS_TYPE_PROG); + son->offset_228 = v16.vec; + son->offset_108 = ""; + return son; } - void NSASTParse::top_down() + night::ns_node *NSASTParse::ast_varname() { + auto v1 = this->offset_28->offset_4; + auto v4 = v1->offset_52; + auto v5 = v1->offset_56; + auto t = this->ast_expression_no_comma(); + if ( + (night::NS_TYPE_ASSIGN != t->offset_0 || night::NS_TYPE_VAR != t->offset_180->offset_0) + && night::NS_TYPE_VAR != t->offset_0 + ) + { + this->offset_28->err("Expected variable", v4, v5, true); + } + return t; + } + /** + * 未完成 + */ + 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); + night::ns_node * 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 * v44; + if (v5 && v5->offset_84.find('\n') == -1) + { + v44 = this->offset_24->gen_girl(night::std_v_n).vec; + auto v45 = this->ast_expression(); // TODO...待确认 + v44->emplace_back(v45); + } + else + { + v44 = this->offset_24->gen_girl(night::std_v_n).vec; + } + // v25->push_back(v44); + return lt; + } + if ("typeof" == v43) + { + auto son =this->offset_24->gen_son(night::NS_TYPE_OP_SELF); + son->offset_156 = v43 + " "; + auto v8 = this->ast_expression_no_binary(); + son->offset_192 = v8; + + if (!this->is_exp(v8)) + { + std::string msg = "Unexpected statement[" + v8->offset_0 + "]"; + this->offset_28->err(msg, v19, v20, true); + } + return son; + } + if ("this" == v43) + { + goto LABEL_30; + } + if ("arguments" != v43) + { + if (v43 != "break" && "continue" != v43) + { + std::string msg = "Unexpected token `" + v43 + "`"; + this->offset_28->err(msg, v19, v20, true); + } + if ( + !v43.compare("break") && this->offset_36 <= 0 + || !v43.compare("continue") && this->offset_40 <= 0 + ) + { + std::string msg = "Illegal " + v43 + " statement"; + this->offset_28->err(msg, v19, v20, true); + } + bool v18 = this->end_line(); + if (!v18) + { + if (!this->is_punctuation(";")) + { + v18 = this->is_punctuation("}") == nullptr; + } + if (v18) + { + std::string msg = "Unexpected token after `" + v43 + "`"; + this->offset_28->err(msg, v19, v20, true); + } + } + + 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 (this->offset_32 < 0) + { + std::string msg = "Illegal " + v43 + " statement"; + this->offset_28->err(msg, v19, v20, true); + } + LABEL_30: + v3 = this->offset_24->gen_son(night::NS_TYPE_KW); + LABEL_31: + auto lt = v3; + lt->offset_60.assign(v43); + lt->offset_24.assign(v24->offset_24); + lt->offset_48 = v24->offset_48; + lt->offset_52 = v24->offset_52; + auto v11 = this->offset_28->peek(); + if (v11) + { + auto v26 = v11->offset_60; + if ("[" == v26) + { + auto v12 = this->ast_obj_op(lt); + return this->make_call_or_just_expression(v12); + } + if ("." == v26) + { + auto v12 = this->ast_obj_dot(lt); + return this->make_call_or_just_expression(v12); + } + } + return lt; } + night::ns_node * 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 nullptr; + } + else + { + return nullptr; + } + } + return v2; + } + + 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 result = false; + if (a2->offset_0.length()) + { + std::string v5 = a2->offset_0; + if ( v5 != night::NS_TYPE_BOOL + && v5 != night::NS_TYPE_VAR + && v5 != night::NS_TYPE_NUM + && v5 != night::NS_TYPE_B_TYPE + && v5 != night::NS_TYPE_OP_SELF + && v5 != night::NS_TYPE_BINARY + && v5 != night::NS_TYPE_ASSIGN + && v5 != night::NS_TYPE_TERNARY + && v5 != night::NS_TYPE_OBJ_DOT + && v5 != night::NS_TYPE_OBJ_PROPERTY + && v5 != night::NS_TYPE_OBJ_SELF_OP + && v5 != night::NS_TYPE_OBJ_BLOCK + && v5 != night::NS_TYPE_BRACKET + && v5 != night::NS_TYPE_CALL ) + { + bool v2 = v5 == night::NS_TYPE_KW; + if (!v2) + { + return v2; + } + auto v3 = this->offset_60; + if ( + "null" != v3 + && "undefined" != v3 + && "NaN" != v3 + ) + { + v2 = "Infinity" == v3; + return v2; + } + } + return true; + } + return result; + } + + bool NSASTParse::is_exp(night::ns_node *a2) + { + bool result = false; + if (a2->offset_0.length()) + { + std::string v5 = a2->offset_0; + if ( v5 != night::NS_TYPE_BOOL + && v5 != night::NS_TYPE_VAR + && v5 != night::NS_TYPE_STR + && v5 != night::NS_TYPE_NUM + && v5 != night::NS_TYPE_B_TYPE + && v5 != night::NS_TYPE_OP_SELF + && v5 != night::NS_TYPE_BINARY + && v5 != night::NS_TYPE_ASSIGN + && v5 != night::NS_TYPE_TERNARY + && v5 != night::NS_TYPE_OBJ_DOT + && v5 != night::NS_TYPE_OBJ_PROPERTY + && v5 != night::NS_TYPE_OBJ_SELF_OP + && v5 != night::NS_TYPE_OBJ_BLOCK + && v5 != night::NS_TYPE_ARRAY + && v5 != night::NS_TYPE_BRACKET + && v5 != night::NS_TYPE_PROG_NO_SEM_REQUIRE + && v5 != night::NS_TYPE_FUNC + && v5 != night::NS_TYPE_CALL ) + { + bool v2 = v5 == night::NS_TYPE_KW; + if (!v2) + { + return v2; + } + auto v3 = a2->offset_60; + if ( + "null" != v3 + && "undefined" != v3 + && "NaN" != v3 + ) + { + v2 = "Infinity" == v3; + return v2; + } + } + return true; + } + return result; + } + + night::ns_node *NSASTParse::top_down() + { + auto v6 = this->offset_24->gen_girl(night::std_v_n); + while (!this->offset_28->eof()) + { + auto v16 = this->ast_expression(); + v6.vec->push_back(v16); + auto v7 = this->offset_28; + auto v1 = 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_node *v2 = v7->peek(); + if (v2) + { + if (";" != v2->offset_60 && v2->offset_84.find(10, 0) == -1) + { + this->offset_28->err("Expected LineFeed", v4, v5, true); + } + } + } + while (!this->offset_28->eof()) + { + if (!this->is_punctuation(";")) + { + break; + } + this->offset_28->next(); + } + } + auto son = this->offset_24->gen_son(night::NS_TYPE_PROG); + son->offset_228 = v6.vec; + son->offset_108 = ""; + + return son; + } + + bool NSASTParse::end_line(void) + { + auto v1 = this->offset_28->peek(); + bool v2 = true; + if (v1) + { + v2 = v1->offset_84.find("\n") + 1 != 0; + } + return v2; + } + 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.vec->push_back(v22); + + v22 = this->offset_24->gen_son(night::NS_TYPE_PUNC); + v22->offset_60 = "("; + v17.vec->push_back(v22); + this->offset_28->next(); + auto v2 = this->offset_28->offset_4; + 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) + { + this->offset_28->err("Expected string", v8, v9, true); + } + std::string v24; + if (night::str::path_combine(this->offset_0, v3->offset_60, v24)) + { + this->offset_28->err("Expected wxs file", v8, v9, true); + } + std::string v26 = "p_" + v24; + v3->offset_60 = v26; + v17.vec->push_back(v3); + + v22 = this->offset_24->gen_son(night::NS_TYPE_PUNC); + v22->offset_60 = ")\000{"; + v17.vec->push_back(v22); + + this->offset_28->next(); + auto v13 = this->offset_24; + v22 = v13->gen_son(night::NS_TYPE_PUNC); + v22->offset_60 = "("; + v17.vec->push_back(v22); + + auto v14 = this->offset_24; + v22 = v14->gen_son(night::NS_TYPE_PUNC); + v22->offset_60 = ")\000{"; + v17.vec->push_back(v22); + + auto v15 = this->offset_24; + v22 = v15->gen_son(night::NS_TYPE_PROG_NO_SEM_REQUIRE); + v22->offset_228 = v17.vec; + v22->offset_108 = ""; + + auto v5 = this->offset_28->peek(); + if (!v5) + return v22; + auto v18 = v5->offset_60; + if (v18 != "[") + { + if (v18 == ".") + { + auto v6 = this->ast_obj_dot(v22); + return make_call_or_just_expression(v6); + } + return v22; + } + auto v6 = this->ast_obj_op(v22); + return this->make_call_or_just_expression(v6); + } + + void NSASTParse::ignore_punc_pass_sem(std::string const& a2) + { + std::string v9; + int v6 = 0; + if (this->is_punctuation(a2)) + { + this->offset_28->next(); + } + else if (";" != a2) + { + auto v4 = this->offset_28->peek(); + if (v4) + { + auto v3 = v4->offset_60; + auto v11 = v3.substr(0, 3); + if (v3.length() > 3 && v11 == night::nsv_) + { + v11 = v3.substr(3); + v9 = v11; + } + else + { + v9.assign(v3); + } + v6 = v9.length(); + } + else + { + v6 = 0; + } + std::string msg = "Unexpected identifier `" + v9 + "`"; + this->offset_28->err(msg, 0, v6, false); + } + } + void NSASTParse::ignore_punc(std::string const& a2) + { + if (!this->is_punctuation(a2)) + { + auto node = this->offset_28->peek(); + std::string v11 = " "; + int code; + if (node) + { + std::string v6 = node->offset_60; + std::string v13 = v6.substr(0, 3); + if ( + node->offset_60.length() > 3 + && v13 == night::nsv_ + ) + { + v11 = v6.substr(3); + } + else + { + v11.assign(v6); + } + code = v11.length(); + } + else + { + code = 0; + } + std::string v13 = "Unexpected identifier `" + v11 + "`"; + this->offset_28->err(v13, 0, code, false); + } + this->offset_28->next(); + } } \ No newline at end of file diff --git a/src/night/ns_compile_js.cpp b/src/night/ns_compile_js.cpp index 2b5eb16..498a44f 100644 --- a/src/night/ns_compile_js.cpp +++ b/src/night/ns_compile_js.cpp @@ -17,86 +17,439 @@ namespace night } std::string NSCompileJs::compile_binary(night::ns_node *a3) { - this->compile(a3->offset_180); + std::string ret = this->compile(a3->offset_180); std::string v10 = " " + a3->offset_156; std::string v3 = v10.append(" "); - // this->offset_48 = - this->compile(a3->offset_184); - // v10 = v7 + v8; + this->offset_48 += v3.length(); + + std::string v7 = this->compile(a3->offset_184); std::string v4 = ""; - // v4 = v10.append(v9); + v4 = ret + v3 + v7; return v4; } std::string NSCompileJs::compile_call(night::ns_node *a3) { - return ""; + std::string str; + str = this->compile(a3->offset_220); + if ("return" == a3->offset_220->offset_60) + { + auto v3 = a3->offset_224; + for (int i = 0; ; i++) + { + if (i >= v3->size()) + break; + auto v4 = v3->at(i); + if (v4->begin() != v4->end()) + { + if ( + v4->size() != 1 + || (v4->at(0)->offset_0 != night::NS_TYPE_SKIP) + ) + { + str += "("; + + this->offset_48++; + for (int v19 = 0; v19 < v4->size(); v19++) + { + auto v9 = v4->at(v19); + str += this->compile(v9); + if (v19 + 1 != v4->size()) + { + str += ","; + this->offset_48++; + } + } + str += ")"; + this->offset_48++; + + } + } + } + + } + else + { + for (int i = 0; i < a3->offset_224->size(); i++) + { + str += "("; + this->offset_48++; + auto v12 = a3->offset_224->at(i); + for (int j = 0; j < v12->size(); j++) + { + str += this->compile(v12->at(j)); + if (j + 1 != v12->size()) + { + str += ","; + this->offset_48++; + } + } + str += ")"; + this->offset_48++; + } + + } + return str; } std::string NSCompileJs::compile_do_while(night::ns_node *a3) { - return ""; + std::string result = ""; + result += "do"; + this->offset_48 += 2; + result += this->compile(a3->offset_216); + + 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 += ")"; + this->offset_48++; + + result += this->compile(a3->offset_216); + + return result; } std::string NSCompileJs::compile_function(night::ns_node *a3) { - return ""; + // compile_function - 0 + std::string result = ""; + if (a3->offset_132.length()) + { + result += "function "; + this->offset_48 += 9; + + night::ns_sourcemap v43; + v43.offset_0.assign(a3->offset_24); + v43.offset_24 = a3->offset_48; + v43.offset_28 = a3->offset_52; + v43.offset_32.assign(a3->offset_132); + v43.offset_56 = a3->offset_48; + v43.offset_60 = this->offset_48; + + this->offset_36.push_back(v43); + result += a3->offset_132; + this->offset_48 += a3->offset_132.length(); + + } + else + { + result += "(function "; + this->offset_48 += 10; + } + // compile_function - 5 + result += "("; + this->offset_48++; + auto v4 = a3->offset_244; + bool v29 = false; + for (int i = 0; i < v4->size(); i++) + { + auto v5 = v4->at(i); + if (night::NS_TYPE_VAR == v5->offset_0) + { + result += v5->offset_60; + this->offset_48 += v5->offset_60.length(); + } + else + { + result += v5->offset_180->offset_60; + v29 = true; + this->offset_48 += v5->offset_180->offset_60.length(); + } + if (i + 1 != v4->size()) + { + result += ","; + this->offset_48++; + } + } + // compile_function - 10 + result += ")"; + this->offset_48++; + if (v29) + { + result += ")"; + this->offset_48++; + auto v10 = a3->offset_244; + for (int i = 0; i < v10->size(); i++) + { + auto cur = v10->at(i); + if (night::NS_TYPE_ASSIGN == cur->offset_0) + { + std::string v41 = cur->offset_180->offset_60; + v41.append("=undefined==="); + v41.append(v41); + v41.append("?"); + result += v41; + this->offset_48 += v41.length(); + + result += this->compile(cur->offset_184); + std::string v43 = ":" + cur->offset_180->offset_60; + v43.append(";"); + result += v43; + this->offset_48 += v43.length(); + } + } + + } + // compile_function - 15 + std::string v37 = this->compile(a3->offset_216); + std::string v38; + if (v29) + { + std::string v38; + if (v37.find("arguments") != -1) + { + std::string v41 = "arguments." + night::nsv_; + v41.append("length=arguments.length;"); + v38 = v41; + result += v38; + this->offset_48 += v38.length(); + } + result += v37.substr(1); + this->offset_48--; + for (int i = 0; i < this->offset_36.size(); i++) + { + auto v18 = this->offset_36[i]; + auto v27 = v38.length() + v18.offset_60 - 1; + v18.offset_60 = v27; + } + + goto LABEL_31; + } + // compile_function - 20 + if (v37.find("arguments") != -1) + { + std::string v41 = "{arguments." + night::nsv_; + v41.append("length=arguments.length;"); + v38 = v41; + result += v38; + this->offset_48 += v38.length(); + + result += v37.substr(1); + this->offset_48--; + for (int i = 0; i < this->offset_36.size(); i++) + { + auto v18 = this->offset_36[i]; + auto v27 = v38.length() + v18.offset_60 - 1; + v18.offset_60 = v27; + } + goto LABEL_31; + } + + // compile_function - 25 + result += v37; + LABEL_31: + if (!a3->offset_132.length()) + { + result += ")"; + this->offset_48++; + } + 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 *) + std::string NSCompileJs::compile_k_v(night::ns_node * a3) { - return ""; + std::string result = ""; + result += this->compile(a3->offset_188) + ":"; + this->offset_48++; + result += this->compile(a3->offset_192) + ","; + this->offset_48++; + return result; } - std::string NSCompileJs::compile_obj_dot(night::ns_node *) + std::string NSCompileJs::compile_obj_dot(night::ns_node * a3) { - return ""; + std::string result = ""; + result += this->compile(a3->offset_192); + for (int i = 0; i < a3->offset_196->size(); i++) + { + result += "."; + this->offset_48++; + auto v3 = a3->offset_196->at(i); + result += this->compile(v3); + } + + return result; } std::string NSCompileJs::compile_obj_property(night::ns_node *) { - return ""; + // TODO... + throw "not implement"; } - std::string NSCompileJs::compile_obj_self_op(night::ns_node *) + std::string NSCompileJs::compile_obj_self_op(night::ns_node *a3) { - return ""; + std::string result = ""; + if (a3->offset_200) + { + result += a3->offset_156; + this->offset_48 += a3->offset_156.length(); + result += this->compile(a3->offset_192); + } + else + { + std::string v7 = this->compile(a3->offset_192); + v7.append(a3->offset_156); + result += v7; + this->offset_48 += a3->offset_156.length(); + } + return result; } 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++) - { - this->compile(*i); - } - - return ""; + 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 *) + std::string NSCompileJs::compile_switch(night::ns_node *a3) { - return ""; + 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++; + } + } + + // 240 + for (int i = 0; i < a3->offset_240->size(); i++) + { + 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) { + std::string result = ""; std::string v6 = this->compile(a3->offset_180); v6.append(":"); - // += v7 + result += v6; this->offset_48++; - this->compile(a3->offset_184); - // += v7 - return ""; + 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 *) + std::string NSCompileJs::compile_while(night::ns_node * a3) { - return ""; + std::string result = ""; + std::string v5 = "while("; + result += v5; + this->offset_48 += v5.length(); + result += this->compile(a3->offset_204); + result += ")"; + this->offset_48++; + + result += this->compile(a3->offset_216); + return result; } std::string NSCompileJs::compile_prog(night::ns_node *a3) { + std::string result = ""; std::string v9 = a3->offset_108; if (v9.size() == 0) { @@ -104,38 +457,39 @@ 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); + result += this->compile(*i); v6++; - if (v6 != v4.size()) + if (v6 != v4->size()) { - // += + result += v9; this->offset_48 += v9.size(); } } - return ""; + return result; } std::string NSCompileJs::compile_prog_no_sem(night::ns_node *a3) { + std::string result = ""; if (night::NS_TYPE_OBJ_BLOCK == a3->offset_0) { - // += + result += "("; 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); - // += + result += this->compile(*i); + } if (night::NS_TYPE_OBJ_BLOCK == a3->offset_0) { - // += + result += ")"; this->offset_48++; } - return ""; + return result; } std::string NSCompileJs::compile(night::ns_node * a3) @@ -151,13 +505,25 @@ namespace night { if (v9 == night::NS_TYPE_BOOL) { - // TODO... - return ""; + night::ns_sourcemap v13; + v13.offset_0.assign(a3->offset_24); + v13.offset_32.assign(a3->offset_60); + v13.offset_24 = a3->offset_48; + v13.offset_28 = a3->offset_52; + v13.offset_56 = a3->offset_48; + v13.offset_60 = a3->offset_48; + + this->offset_36.push_back(v13); + std::string v10 = a3->offset_60; + this->offset_48 += v10.length(); + return v10; } if (v9 == night::NS_TYPE_STR) { - // TODO... - return ""; + std::string v13 = a3->offset_108 + a3->offset_60; + v13.append(a3->offset_108); + this->offset_48 += v13.length(); + return v13; } if (v9 != night::NS_TYPE_B_TYPE && v9 != night::NS_TYPE_PUNC) { @@ -267,19 +633,19 @@ namespace night return ""; } - void NSCompileJs::compile_once(std::string &a3, std::vector *a4, bool a5) + std::string NSCompileJs::compile_once(std::string &a3, std::vector *a4, bool a5) { this->offset_28 = a4; a3 = ""; - this->offset_24->top_down(); - night::ns_node v5; + night::ns_node* v5 = this->offset_24->top_down(); if (a5) { - std::string ret = v5.debug_no_space(); + std::string ret = v5->debug_no_space(); printf("ast :%s\n", ret.data()); } - std::string v9 = this->compile(&v5); - a3 = v9; + std::string v9 = this->compile(v5); + a3.assign(v9); + return this->offset_0; } } \ No newline at end of file diff --git a/src/night/ns_god/ns_god.cpp b/src/night/ns_god/ns_god.cpp index 1610821..f656861 100644 --- a/src/night/ns_god/ns_god.cpp +++ b/src/night/ns_god/ns_god.cpp @@ -10,25 +10,74 @@ namespace night { } - void NSGod::gen_girl(std::string a2) + // std::vector*>* + night::NSGod::GodsSon::Offset24 NSGod::gen_girl(std::string a2) { + night::NSGod::GodsSon* node = new night::NSGod::GodsSon(); + + node->offset_0.assign(a2); if (night::std_v_n == a2) { - + node->offset_24.vec = new std::vector(); } if (night::std_v_v_n == a2) { - + node->offset_24.vecVec = new std::vector*>(); } + this->offset_0.push_back(node); + // return node->offset_24_vec; // 审查内存,是一层vector + return node->offset_24; } - void NSGod::gen_son(std::string) + night::ns_node* NSGod::gen_son(std::string a2) { + night::NSGod::GodsSon *v6 = new night::NSGod::GodsSon(); + v6->offset_0.assign(a2); + night::ns_node *v4 = new night::ns_node(); + v4->offset_0.assign(a2); + v6->offset_24.node = v4; + this->offset_0.push_back(v6); + + return v4; } 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.vec; + 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) + { + auto v4 = v3->offset_24.vec; + if (v4) + { + delete v4; + v3->offset_24.vec = nullptr; + } + if (v3->offset_24.node) + { + delete v3->offset_24.node; + v3->offset_24.node = nullptr; + } + } + delete v3; + } + } } // namespace night diff --git a/src/night/ns_node.cpp b/src/night/ns_node.cpp index 13e379b..ae32cc9 100644 --- a/src/night/ns_node.cpp +++ b/src/night/ns_node.cpp @@ -13,7 +13,7 @@ namespace night std::string ns_node::debug_no_space() { - return ""; + throw "not implement"; } } \ No newline at end of file diff --git a/src/night/ns_sourcemap.cpp b/src/night/ns_sourcemap.cpp index fbf29c4..c7432d8 100644 --- a/src/night/ns_sourcemap.cpp +++ b/src/night/ns_sourcemap.cpp @@ -6,6 +6,48 @@ namespace night ns_sourcemap::ns_sourcemap(/* args */) { } + + ns_sourcemap::ns_sourcemap(ns_sourcemap && src): + offset_0(src.offset_0), + offset_24(src.offset_24), + offset_28(src.offset_28), + offset_32(src.offset_32), + offset_56(src.offset_56), + offset_60(src.offset_60) + { + } + + ns_sourcemap::ns_sourcemap(ns_sourcemap const& src): + offset_0(src.offset_0), + offset_24(src.offset_24), + offset_28(src.offset_28), + offset_32(src.offset_32), + offset_56(src.offset_56), + offset_60(src.offset_60) + { + } + + ns_sourcemap& ns_sourcemap::operator=(ns_sourcemap const& src) + { + this->offset_0 = src.offset_0; + this->offset_24 = src.offset_24; + this->offset_28 = src.offset_28; + this->offset_32 = src.offset_32; + this->offset_56 = src.offset_56; + this->offset_60 = src.offset_60; + return *this; + } + + ns_sourcemap& ns_sourcemap::operator=(ns_sourcemap && src) + { + this->offset_0 = src.offset_0; + this->offset_24 = src.offset_24; + this->offset_28 = src.offset_28; + this->offset_32 = src.offset_32; + this->offset_56 = src.offset_56; + this->offset_60 = src.offset_60; + return *this; + } ns_sourcemap::~ns_sourcemap() { diff --git a/src/night/ns_stream.cpp b/src/night/ns_stream.cpp index d6249c4..546d7aa 100644 --- a/src/night/ns_stream.cpp +++ b/src/night/ns_stream.cpp @@ -6,40 +6,129 @@ 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() { } - void NSStream::peek(void) + PeekData NSStream::peek(void) { + PeekData ret; if (this->offset_48 < this->offset_24.length()) { char v3 = this->offset_24.at(this->offset_48); + ret.data = v3; + ret.offset_4 = this->offset_52; + ret.offset_8 = this->offset_56; } else { - + ret.data = 0; + ret.offset_4 = 0; + ret.offset_8 = 0; } + return ret; } - void NSStream::peek_2(void) + + bool NSStream::eof(void) { + return this->peek().data == 0; + } + + PeekData NSStream::peek_2(void) + { + PeekData ret; if (this->offset_48 + 1 < this->offset_24.length()) { char v3 = this->offset_24.at(this->offset_48 + 1); + int v4 = this->offset_52; + int v5 = this->offset_56 + 1; if (v3 == '\n') { - this->offset_52++; - this->offset_56 = 1; + v4++; + v5 = 1; } + ret.data = v3; + ret.offset_4 = v4; + ret.offset_8 = v5; } else { - + ret.data = 0; + ret.offset_4 = 0; + ret.offset_8 = 0; } + return ret; + } + + bool NSStream::eof_2(void) + { + return this->peek_2().data == 0; + } + + PeekData NSStream::next(void) + { + PeekData ret; + if (this->offset_48 < this->offset_24.length()) + { + char v7 = this->offset_24.at(this->offset_48); + this->offset_48++; + int v5 = this->offset_52; + int v6 = this->offset_56; + if (v7 == 10) // \n + { + this->offset_56 = 1; + this->offset_52++; + } + else + { + this->offset_56++; + } + ret.data = v7; + ret.offset_4 = v5; + ret.offset_8 = v6; + } + else + { + ret.data = 0; + ret.offset_4 = 0; + ret.offset_8 = 0; + } + return ret; + } + + 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; } } \ No newline at end of file diff --git a/src/night/ns_token.cpp b/src/night/ns_token.cpp index 0ccf49d..595107b 100644 --- a/src/night/ns_token.cpp +++ b/src/night/ns_token.cpp @@ -1,4 +1,5 @@ #include "../include/night.h" +#include "../include/wxml.h" namespace night { @@ -9,12 +10,374 @@ namespace night NSToken::~NSToken() { } - void NSToken::peek(void) - { + night::ns_node* NSToken::peek(void) + { + auto result = this->offset_8; + if (!result) + { + result = this->read_next(); + this->offset_8 = result; + } + return result; } - void NSToken::read_next(void) - { + night::ns_node* NSToken::read_next(void) + { + night::ns_node* v7 = nullptr; + 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(); + if (!isEnd) + { + this->skip_comment(v14); + } + if ( isEnd + || (this->offset_4->eof()) + ) + { + v7 = 0; + } + else + { + auto v13 = this->offset_4->peek(); + if (v13.data == '"' || v13.data == '\'') + { + v7 = this->read_string(v13.data, v14); + } + else if ((uint8_t)(v13.data - '0') > 9) + { + if (!night::NSToken::tk_is_var_start(v13.data, 0)) + { + int pos = night::NS_BUILTIN_PUNC.find(v13.data, 0); + if (pos == -1) + { + int pos2 = night::NS_BUILTIN_OP.find(v13.data, 0); + if (pos2 == -1) + { + std::string msg = "Unexpected token `"; + msg.append(std::string(1, v13.data)); + msg.append("`"); + 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); + v7 = this->offset_0->gen_son(night::NS_TYPE_OP); + v7->offset_60.assign(v17); + v7->offset_84.assign(v14); + } + else + { + 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; + v7->offset_84 = v14; + } + // goto LABEL_19; + } + else + { + v7 = this->read_var(v14); + } + } + else + { + v7 = this->read_number(v14); + } + + } + return v7; + } + auto ret = this->offset_12.back(); + this->offset_12.pop_back(); + return ret; + } + + night::ns_node* NSToken::next(void) + { + auto result = this->offset_8; + this->offset_8 = nullptr; + if (!result) + { + return this->read_next(); + } + return result; + } + + bool NSToken::eof(void) + { + return this->peek() == 0; + } + + void NSToken::push(night::ns_node* a2) + { + if (this->offset_8) + { + this->offset_12.push_back(this->offset_8); + this->offset_8 = nullptr; + } + if (a2) + { + this->offset_12.push_back(a2); + } + } + + void NSToken::read_comment_method_1() + { + this->read_while(night::NSToken::tk_is_not_line_break, 0); + } + void NSToken::read_comment_method_2() + { + this->read_while(night::NSToken::tk_is_comment2, this->offset_4); + this->offset_4->next(); + } + + void NSToken::skip_comment(std::string &a2) + { + while (true) + { + if (this->offset_4->eof()) + { + break; + } + auto v5 = this->offset_4->peek(); + if (v5.data != '/') + { + break; + } + if (this->offset_4->eof_2()) + { + break; + } + v5 = this->offset_4->peek_2(); + if (v5.data == '/') + { + v5 = this->offset_4->next(); + v5 = this->offset_4->next(); + this->read_comment_method_1(); + } + else + { + v5 = this->offset_4->peek_2(); + if (v5.data != '*') + return; + 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); + + } + + } + + night::ns_node * NSToken::read_string(char a2, std::string const& a3) + { + auto v12 = this->offset_4->next(); + std::string v10 = ""; + char v4; + for (int i = 0; ; i = v4) + { + v4 = this->offset_4->eof(); + if (v4) + { + break; + } + auto v9 = this->offset_4->next(); + if ( v9.data == '\n') + { + if (!i) + { + this->offset_4->err("Unexpected `\\n`", 0, 0, false); + } + v10.push_back('\n'); + } + else + { + if (!i) + { + if (v9.data == '\\') + { + v4 = 1; + v10.push_back('\\'); + continue; + } + if (v9.data == a2) + { + break; + } + } + v10.push_back(v9.data); + } + } + 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); + son->offset_84.assign(a3); + return son; + } + + night::ns_node * NSToken::read_number(std::string const& a2) + { + int v8; + auto v9 = this->read_while(night::NSToken::rw_cb_number, &v8); + 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); + } + auto son = this->offset_0->gen_son(night::NS_TYPE_NUM); + son->offset_60 = v9; + son->offset_84 = a2; + return son; + } + + std::string NSToken::read_while(bool (*a3)(char,void *), void *a4) + { + std::string result = ""; + while (!this->offset_4->eof()) + { + auto v6 = this->offset_4->peek(); + if (!a3(v6.data, a4)) + { + break; + } + v6 = this->offset_4->next(); + result.push_back(v6.data); + } + return result; + } + + night::ns_node *NSToken::read_var(std::string const & a2) + { + 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); + night::ns_node *son = nullptr; + if (pos == -1) + { + int v6 = night::NS_BUILTIN_KW.find(v16, 0); + auto v4 = night::NS_TYPE_KW; + if (v6 == -1) + { + v4 = night::NS_TYPE_VAR; + } + son = this->offset_0->gen_son(v4); + if (v6 == -1) + { + v16 = night::nsv_ + v13; + } + else + { + v16 = v13; + } + son->offset_60 = v16; + son->offset_24.assign(v13); + son->offset_84 = a2; + son->offset_48 = v12.offset_4; + son->offset_52 = v12.offset_8; + if (!this->offset_24[v13]) + { + this->offset_24[v13] = this->offset_24.size(); + } + } + else + { + son = this->offset_0->gen_son(night::NS_TYPE_B_TYPE); + son->offset_60 = v13; + son->offset_84 = a2; + } + return son; + } + + void NSToken::err(std::string const& a2, int a3, int a4, bool a5) + { + this->offset_4->err(a2, a3, a4, a5); + } + bool NSToken::rw_cb_number(char ch, void *t) + { + int *a2 = (int *)t; + if(ch != '.') + { + return ch - '0' <= 9u; + } + bool result = false; + if (!*a2) + { + *a2 = 1; + return true; + } + return result; + } + + bool NSToken::tk_is_whitespace(char ch, void *) + { + auto v1 = night::NS_BUILTIN_SPACE.find(ch, 0); + return v1 != -1; + } + bool NSToken::tk_is_not_line_break(char ch, void *) + { + return ch != 10; + } + bool NSToken::tk_is_valid_op_str(char ch, void *t) + { + std::string * a2 = (std::string *)t; + std::string v6; + v6.assign(*a2); + v6.replace(v6.length(), 0, 1, ch); + bool result = false; + if ( + night::NS_BUILTIN_OP.find(ch, 0) == -1 + || ( + night::NS_BUILTIN_ALL_OP.find(v6, 0) == -1 + ) + ) + { + result = false; + } + else + { + a2->assign(v6); + result = true; + } + return result; + } + bool NSToken::tk_is_comment2(char ch, void * t) + { + night::NSStream *a2 = (night::NSStream *)t; + auto v3 = a2->peek(); + if (v3.data != '*') + { + return 1; + } + v3 = a2->peek_2(); + if (v3.data != '/') + { + return 1; + } + a2->next(); + return 0; + } + bool NSToken::tk_is_var(char ch, void * t) + { + bool result = night::NSToken::tk_is_var_start(ch, t); + if (!result) + { + uint8_t v4 = ch - '0'; + return (ch == '_') | (v4 <= 9u); + } + return result; + } + bool NSToken::tk_is_var_start(char ch, void * t) + { + uint8_t v1 = (ch & 0xFFFFFFDF) - 'A'; + return (v1 <= 0x19u) | (ch == '_'); } } \ No newline at end of file diff --git a/src/night/str/str.cpp b/src/night/str/str.cpp index 33ff79f..3e14aa4 100644 --- a/src/night/str/str.cpp +++ b/src/night/str/str.cpp @@ -1,16 +1,53 @@ #include "../../include/night.h" +#include "../../include/wxa.h" +#include "../../include/wxml.h" + namespace night { namespace str { - void get_token(std::string const&, int) + std::string get_token(std::string const& a2, int a3) { - + std::string result; + char v3; + while (a3 < a2.length()) + { + v3 = a2[a3]; + if ((v3 & 0xdf) - 65 > 0x19u && v3 != '_' && v3 - '0' > 9u) + { + break; + } + ++a3; + result.push_back(v3); + } + return result; + } - void path_combine(std::string const&, std::string const&, std::string&) - { + /** + * todo... + */ + 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); + code = v14 == ".wxs"; + if (code) + { + code = 2; + } + else + { + std::string v3 = WXML::Rewrite::ToStringCode(v11); + a3 = v3; + } + } + return code; } } // namespace str } // namespace night diff --git a/src/wxml/compiler.cpp b/src/wxml/compiler.cpp index a5e0bb0..4f2f702 100644 --- a/src/wxml/compiler.cpp +++ b/src/wxml/compiler.cpp @@ -832,10 +832,6 @@ namespace WXML{ std::string data = ""); - /* - ......... - */ // DealWxsTag - 5 for (int i = 1; i < a2.offset_8; i++) { @@ -1053,7 +1049,7 @@ namespace WXML{ a2.insert({a3, a2.size()}); } auto v5 = a2[a3]; - sprintf(&result[0], "np_%d", v5); + result = "np_" + std::to_string(v5); return result; } } // namespace Compiler diff --git a/test/wcc.disassembly.cpp b/test/wcc.disassembly.cpp index 2c27746..e9397d6 100644 --- a/test/wcc.disassembly.cpp +++ b/test/wcc.disassembly.cpp @@ -15295,9 +15295,9 @@ int __usercall night::NSToken::tk_is_var_start@(int a1@) { 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) -------------------------------------------------------- @@ -15482,8 +15485,8 @@ _DWORD *__thiscall night::NSStream::next(_DWORD *ecx0, night::NSStream *this) ++*((_DWORD *)this + 14); } *(_BYTE *)ecx0 = v7; - ecx0[2] = v6; ecx0[1] = v5; + ecx0[2] = v6; } else { @@ -15624,7 +15627,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; @@ -15845,13 +15848,17 @@ unsigned int __fastcall night::NSGod::hamlet(_DWORD *a1) for ( i = 0; ; ++i ) { + // this->offset_0.size() result = (a1[1] - *a1) >> 2; if ( i >= result ) break; + // v3 = this->offset_0[i] v3 = *(_DWORD *)(*a1 + 4 * i); std::string::basic_string((char *)v7, v3); + // v3->offset_0 == night::std_v_n if ( std::operator==((int)v7, (int)&night::std_v_n) ) { + // v3->offset_24 v4 = *(void ***)(v3 + 24); LABEL_6: if ( !v4 ) @@ -15896,28 +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 = v4 + 2; - v4[6] = v4 + 8; - v4[15] = v4 + 17; - v4[21] = v4 + 23; - v4[27] = v4 + 29; - v4[33] = v4 + 35; - v4[39] = v4 + 41; + 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 + 164) = 0; + v4[13] = 0; v4[12] = 0; *((_BYTE *)v4 + 200) = 0; @@ -15937,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::push_back((int)this, v6); @@ -15958,16 +15972,16 @@ struct _Unwind_Exception *__thiscall night::NSToken::read_string(night::NSStream void *v12[8]; // [esp+78h] [ebp-20h] BYREF night::NSStream::next(v12, this[1]); - v11 = 0; - v10[0] = &v11; + v10[0] = &v11; // std::string v10[1] = 0; + v11 = 0; for ( i = 0; ; i = v4 ) { v4 = night::NSStream::eof(this[1]); if ( v4 ) break; night::NSStream::next(v9, this[1]); - if ( LOBYTE(v9[0]) == 10 ) + if ( LOBYTE(v9[0]) == '\n'/*10*/ ) { if ( !i ) { @@ -15980,7 +15994,7 @@ struct _Unwind_Exception *__thiscall night::NSToken::read_string(night::NSStream { if ( !i ) { - if ( LOBYTE(v9[0]) == 92 ) + if ( LOBYTE(v9[0]) == '\\'/*92*/ ) { v4 = 1; std::string::push_back(v10, 92); @@ -16060,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); @@ -16086,6 +16102,7 @@ int __thiscall night::NSGod::gen_girl(void *this, int a2) *(_DWORD *)(v7 + 24) = v6; } std::vector::push_back((int)this, &v9); + // v9->offset_24 return v9[6]; } @@ -16153,6 +16170,7 @@ struct _Unwind_Exception *__thiscall night::NSToken::read_var(int this, int a2) std::operator+((char *)v16, (int)&night::nsv_, (int)v13); else std::string::basic_string((char *)v16, (int)v13); + std::string::operator=((unsigned __int8 **)lpuexcpt + 15, (int)v16); std::string::_M_dispose(v16); std::string::_M_assign((int)lpuexcpt + 24, (int)v13); @@ -16217,7 +16235,7 @@ unsigned __int8 **__fastcall night::NSToken::read_next(int a1) { night::NSStream::peek(v13, *(night::NSStream **)(a1 + 4)); v8 = v13[0]; - if ( LOBYTE(v13[0]) == 34 || LOBYTE(v13[0]) == 39 ) + if ( LOBYTE(v13[0]) == '"'/*34*/ || LOBYTE(v13[0]) == '\''/*39*/ ) { string = night::NSToken::read_string((night::NSStream **)a1, v13[0], (int)v14); } @@ -16245,7 +16263,7 @@ unsigned __int8 **__fastcall night::NSToken::read_next(int a1) std::string::basic_string(v19, v3); night::NSStream::err(lpuexcptb, (int)v19, 0, 0, 0); } - v15[0] = (int)v16; + v15[0] = (int)v16; // STD::STRING v15[1] = 0; v16[0] = 0; night::NSToken::read_while[abi:cxx11]( @@ -16271,8 +16289,10 @@ unsigned __int8 **__fastcall night::NSToken::read_next(int a1) night::NSStream::next(v19, *(night::NSStream **)(a1 + 4)); v15[0] = (int)v16; std::string::_M_construct(v15, 1u, (char)v19[0]); + // v7->offset_60 std::string::operator=(v7 + 15, (int)v15); std::string::_M_dispose((void **)v15); + // v7->offset_84 std::string::_M_assign((int)(v7 + 21), (int)v14); } goto LABEL_19; @@ -16285,7 +16305,7 @@ unsigned __int8 **__fastcall night::NSToken::read_next(int a1) } v7 = (unsigned __int8 **)string; } -LABEL_19: + LABEL_19: std::string::_M_dispose(v14); return v7; } @@ -16710,7 +16730,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==("return", (int)v43) || std::operator==("delete", (int)v43) @@ -16732,6 +16752,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); @@ -16740,7 +16761,9 @@ LABEL_50: std::string::basic_string((char *)v45, (int)&night::NS_TYPE_CALL); lpuexcpt = (struct _Unwind_Exception *)night::NSGod::gen_son(lpuexcptd, (int)v45); std::string::_M_dispose(v45); + // offset_220 *((_DWORD *)lpuexcpt + 55) = v21; + // offset_224 *((_DWORD *)lpuexcpt + 56) = v25; v5 = night::NSToken::peek(a1[7]); if ( v5 && std::string::find((int *)v5 + 21, 10, 0) == (char *)-1 ) @@ -16763,7 +16786,7 @@ LABEL_50: std::string::_M_dispose(v45); } std::vector>>::push_back(v25, v44); - goto LABEL_51; + goto LABEL_51; // 销毁数据,返回lpt } if ( std::operator==("typeof", (int)v43) ) { @@ -16776,6 +16799,7 @@ LABEL_50: std::string::operator=((unsigned __int8 **)lpuexcpt + 39, (int)v45); std::string::_M_dispose(v45); v8 = night::NSASTParse::ast_expression_no_binary(a1); + // lpuexcpt->offset_192 *((_DWORD *)lpuexcpt + 48) = v8; if ( !night::NSASTParse::is_exp((int)v8) ) { @@ -16785,7 +16809,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==("this", (int)v43) ) goto LABEL_30; @@ -16858,7 +16882,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==(".", v26) ) { @@ -16953,7 +16977,8 @@ _DWORD *__userpurge night::NSASTParse::ast_dispatch@(_DWORD *a1@, 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 ) @@ -16997,9 +17022,9 @@ _DWORD *__userpurge night::NSASTParse::ast_dispatch@(_DWORD *a1@, 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!=("op not=", (int)v67) ) { @@ -17034,7 +17059,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 ) @@ -17069,15 +17094,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 { @@ -17120,7 +17145,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; @@ -17215,12 +17240,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 ) @@ -17253,7 +17278,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 ) @@ -17279,7 +17304,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; } @@ -17317,11 +17342,11 @@ LABEL_114: { if ( std::operator==(".", 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; } @@ -17333,7 +17358,7 @@ LABEL_99: goto LABEL_99; if ( std::operator==(".", v40) ) { -LABEL_111: + LABEL_111: v11 = night::NSASTParse::ast_obj_dot(a1, (int)v59); goto LABEL_113; } @@ -17345,10 +17370,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); @@ -17364,6 +17391,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]; @@ -17384,7 +17412,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::push_back(v44, (char **)v79); v36 = (void *)a1[6]; std::string::basic_string((char *)v82, (int)&night::NS_TYPE_BRACKET); @@ -17394,6 +17422,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); @@ -17408,6 +17438,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 @@ -17467,7 +17499,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; } @@ -17532,7 +17564,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==("/", (int)(v26 + 39)) || std::operator==("/=", (int)(v26 + 39))) @@ -17619,8 +17651,9 @@ _DWORD *__thiscall night::NSASTParse::ast_obj_op_self(_DWORD *this, int a2) v15 = night::NSGod::gen_son(v14, (int)v21); std::string::_M_dispose(v21); *((_BYTE *)v15 + 200) = a2 == 0; - v11 = (int)(v15 + 39); + v11 = (int)(v15 + 39);// offset_156 std::string::operator=(v15 + 39, (char *)&byte_551F04); + // v15.offset_192 v15[48] = 0; v2 = night::NSToken::next(this[7]); if ( !v2 ) @@ -17664,6 +17697,7 @@ _DWORD *__thiscall night::NSASTParse::ast_obj_op_self(_DWORD *this, int a2) std::string::basic_string((char *)v21, (int)&night::NS_TYPE_OP); v10 = night::NSGod::gen_son(v9, (int)v21); std::string::_M_dispose(v21); + // v10->offset_60 v13->offset_156 std::string::_M_assign((int)(v10 + 15), v13 + 156); std::string::_M_assign((int)(v10 + 21), v13 + 84); night::NSToken::push(this[7], (int)v10); @@ -17705,6 +17739,7 @@ _DWORD *__thiscall night::NSASTParse::ast_obj_dot(int *this, int a2) std::string::basic_string((char *)v18, (int)&night::NS_TYPE_OBJ_DOT); v10 = night::NSGod::gen_son(v12, (int)v18); std::string::_M_dispose(v18); + v10[48] = a2; v10[49] = v9; do @@ -17954,10 +17989,11 @@ _DWORD *__thiscall night::NSASTParse::ast_call(int *this, int a2) std::string::_M_dispose(v22); std::string::_M_dispose((void **)v23); std::string::_M_dispose(v24); + for ( i = &list_by_parser; ; i = &v19 ) { std::vector>>::push_back(v10, i); - std::string::basic_string(v24, (char *)asc_5527F4); + std::string::basic_string(v24, (char *)asc_5527F4); // '(' v9 = night::NSASTParse::is_punctuation(this, (int)v24); std::string::_M_dispose(v24); if ( !v9 ) @@ -17981,7 +18017,7 @@ _DWORD *__thiscall night::NSASTParse::ast_call(int *this, int a2) if ( std::operator==("[", (int)(v4 + 15)) ) { v15 = night::NSASTParse::ast_obj_op(this, (int)v15); - std::string::basic_string(v24, (char *)asc_5527F4); + std::string::basic_string(v24, (char *)asc_5527F4); // "(" v5 = night::NSASTParse::is_punctuation(this, (int)v24); } else @@ -17989,7 +18025,7 @@ _DWORD *__thiscall night::NSASTParse::ast_call(int *this, int a2) if ( !std::operator==(".", v11) ) return v15; v15 = (_DWORD *)night::NSASTParse::ast_obj_dot(v15); - std::string::basic_string(v24, (char *)asc_5527F4); + std::string::basic_string(v24, (char *)asc_5527F4); // "(" v5 = night::NSASTParse::is_punctuation(this, (int)v24); } v12 = (int)v5; @@ -18492,15 +18528,18 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::top_down(int *a1) struct _Unwind_Exception *v16; // [esp+64h] [ebp-24h] BYREF void *v17[8]; // [esp+68h] [ebp-20h] BYREF + // this->offset_24 lpuexcptb = (struct _Unwind_Exception *)a1[6]; std::string::basic_string((char *)v17, (int)&night::std_v_n); v6 = (void **)night::NSGod::gen_girl(lpuexcptb, (int)v17); std::string::_M_dispose(v17); + // this->offset_28 while ( !night::NSToken::eof(a1[7]) ) { v16 = (struct _Unwind_Exception *)night::NSASTParse::ast_expression(a1); std::vector::push_back(v6, (char **)&v16); v7 = a1[7]; + // int v7 v1 = *(_DWORD *)(v7 + 4); v5 = *(_DWORD *)(v1 + 56); v4 = *(_DWORD *)(v1 + 52); @@ -18526,6 +18565,7 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::top_down(int *a1) lpuexcpta = (struct _Unwind_Exception *)v2; if ( v2 ) { + // v2->offset_60 if ( (unsigned __int8)std::operator!=(";", (int)(v2 + 15)) && std::string::find((int *)lpuexcpta + 21, 10, 0) == (char *)-1 ) { @@ -18545,10 +18585,12 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::top_down(int *a1) night::NSToken::next(a1[7]); } } + // this->offset_24 lpuexcpte = (struct _Unwind_Exception *)a1[6]; 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_228 *((_DWORD *)lpuexcptf + 57) = v6; std::string::operator=((unsigned int *)lpuexcptf + 27, (char *)&byte_551F04); return lpuexcptf; @@ -18582,19 +18624,24 @@ unsigned __int8 **__fastcall night::NSASTParse::ast_require(int *a1) char v25; // [esp+78h] [ebp-30h] BYREF int v26[8]; // [esp+88h] [ebp-20h] BYREF + // this->offset_24 v16 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::std_v_n); v17 = (void **)night::NSGod::gen_girl(v16, (int)v26); std::string::_M_dispose((void **)v26); + // this->offset_28 v22 = night::NSToken::next(a1[7]); std::operator+((char *)v26, (int)&night::nsv_, (int)(v22 + 15)); std::string::operator=(v22 + 15, (int)v26); std::string::_M_dispose((void **)v26); std::vector::push_back(v17, (char **)&v22); + + // this->offset_24 v10 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_PUNC); v22 = (unsigned __int8 **)night::NSGod::gen_son(v10, (int)v26); std::string::_M_dispose((void **)v26); + // "(\000)\000{" std::string::operator=((unsigned int *)v22 + 15, (char *)asc_5527F4); std::vector::push_back(v17, (char **)&v22); night::NSToken::next(a1[7]); @@ -18605,6 +18652,7 @@ unsigned __int8 **__fastcall night::NSASTParse::ast_require(int *a1) v3 = (char *)night::NSToken::next(v1); v11 = v3; v23 = (unsigned __int8 **)v3; + if ( !v3 || (unsigned __int8)std::operator!=((int)&night::NS_TYPE_STR, (int)v3) ) { lpuexcpta = (struct _Unwind_Exception *)a1[7]; @@ -18612,7 +18660,7 @@ unsigned __int8 **__fastcall night::NSASTParse::ast_require(int *a1) night::NSToken::err((int)lpuexcpta, (int)v26, v8, v9, 1); } v24[1] = 0; - v24[0] = (int)&v25; + v24[0] = (int)&v25; // std::string v25 = 0; if ( night::str::path_combine(a1, (_DWORD *)v11 + 15, (int)v24) ) { @@ -18623,14 +18671,17 @@ unsigned __int8 **__fastcall night::NSASTParse::ast_require(int *a1) std::operator+((int)v26, "p_", (int)v24); std::string::operator=(v23 + 15, (int)v26); std::string::_M_dispose((void **)v26); + // v23 -> v3 std::vector::push_back(v17, (char **)&v23); std::string::_M_dispose((void **)v24); + v12 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_PUNC); v22 = (unsigned __int8 **)night::NSGod::gen_son(v12, (int)v26); std::string::_M_dispose((void **)v26); std::string::operator=((unsigned int *)v22 + 15, (char *)&asc_5527F4[2]); std::vector::push_back(v17, (char **)&v22); + night::NSToken::next(a1[7]); v13 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_PUNC); @@ -18638,19 +18689,23 @@ unsigned __int8 **__fastcall night::NSASTParse::ast_require(int *a1) std::string::_M_dispose((void **)v26); std::string::operator=((unsigned int *)v22 + 15, (char *)asc_5527F4); std::vector::push_back(v17, (char **)&v22); + v14 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_PUNC); v22 = (unsigned __int8 **)night::NSGod::gen_son(v14, (int)v26); std::string::_M_dispose((void **)v26); std::string::operator=((unsigned int *)v22 + 15, (char *)&asc_5527F4[2]); std::vector::push_back(v17, (char **)&v22); + v15 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_PROG_NO_SEM_REQUIRE); v22 = (unsigned __int8 **)night::NSGod::gen_son(v15, (int)v26); 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]); if ( !v5 ) return v22; @@ -18724,6 +18779,7 @@ _DWORD *__fastcall night::NSASTParse::ast_code_block(int *a1) std::string::_M_dispose(v16); std::string::operator=((unsigned int *)v15[0] + 15, "}"); std::vector::push_back(v10, (char **)v15); + v8 = (void *)a1[6]; std::string::basic_string((char *)v16, (int)&night::NS_TYPE_PROG_NO_SEM); v15[0] = night::NSGod::gen_son(v8, (int)v16); @@ -18747,11 +18803,14 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::ast_function(int *a1) void *v10[6]; // [esp+C0h] [ebp-38h] BYREF void *v11[8]; // [esp+D8h] [ebp-20h] BYREF + // god lpuexcpta = (struct _Unwind_Exception *)a1[6]; std::string::basic_string((char *)v11, (int)&night::NS_TYPE_FUNC); + // son lpuexcpt = (struct _Unwind_Exception *)night::NSGod::gen_son(lpuexcpta, (int)v11); std::string::_M_dispose(v11); std::string::_M_assign((int)lpuexcpt, (int)&night::NS_TYPE_FUNC); + night::NSToken::next(a1[7]); v3 = night::NSToken::peek(a1[7]); v2 = (unsigned int *)((char *)lpuexcpt + 132); @@ -18770,8 +18829,8 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::ast_function(int *a1) std::string::basic_string(v11, (char *)&byte_551F04); std::string::basic_string(v10, "ast_varname"); std::string::basic_string(v9, ","); - std::string::basic_string(v8, (char *)&asc_5527F4[2]); - std::string::basic_string(v7, (char *)asc_5527F4); + std::string::basic_string(v8, (char *)&asc_5527F4[2]); // ')' + std::string::basic_string(v7, (char *)asc_5527F4); // '(' *((_DWORD *)lpuexcpt + 61) = night::NSASTParse::make_list_by_parser( a1, (int)v7, @@ -18970,15 +19029,17 @@ _DWORD *__fastcall night::NSASTParse::ast_obj_block(int *a1) std::string::basic_string((char *)v26, (int)&night::std_v_n); v12 = (void **)night::NSGod::gen_girl(v13, (int)v26); std::string::_M_dispose(v26); - std::string::basic_string(v26, (char *)&asc_5527F4[4]); + std::string::basic_string(v26, (char *)&asc_5527F4[4]); // '{' night::NSASTParse::ignore_punc(a1, (int)v26); std::string::_M_dispose(v26); + v14 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_PUNC); v25 = (char *)night::NSGod::gen_son(v14, (int)v26); std::string::_M_dispose(v26); std::string::operator=((unsigned int *)v25 + 15, (char *)&asc_5527F4[4]); std::vector::push_back(v12, &v25); + std::string::basic_string(v26, "}"); v15 = night::NSASTParse::is_punctuation(a1, (int)v26); std::string::_M_dispose(v26); @@ -19007,6 +19068,7 @@ LABEL_2: std::string::basic_string(v26, ":"); night::NSASTParse::ignore_punc(a1, (int)v26); std::string::_M_dispose(v26); + v10 = night::NSASTParse::ast_expression_no_comma(a1); v11 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_K_V); @@ -19041,15 +19103,18 @@ LABEL_2: } } } + std::string::basic_string(v26, "}"); night::NSASTParse::ignore_punc(a1, (int)v26); std::string::_M_dispose(v26); + v18 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_PUNC); v25 = (char *)night::NSGod::gen_son(v18, (int)v26); std::string::_M_dispose(v26); std::string::operator=((unsigned int *)v25 + 15, "}"); std::vector::push_back(v12, &v25); + v19 = (void *)a1[6]; std::string::basic_string((char *)v26, (int)&night::NS_TYPE_OBJ_BLOCK); v25 = (char *)night::NSGod::gen_son(v19, (int)v26); @@ -19126,6 +19191,7 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::ast_var(_DWORD *a1) std::string::basic_string(v26, "Expected variable name"); night::NSToken::err(v13, (int)v26, v9, v11, 1); } + // offset_56 v18[56] = 1; v3 = night::NSToken::peek(v13); if ( v3 && std::operator==("=", (int)(v3 + 15)) ) @@ -19137,6 +19203,7 @@ struct _Unwind_Exception *__fastcall night::NSASTParse::ast_var(_DWORD *a1) { std::vector::push_back(v16, &v24); } + v4 = a1[7]; v5 = *(_DWORD *)(v4 + 4); v10 = *(_DWORD *)(v5 + 52); @@ -19196,16 +19263,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 - 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 v11[2]; // [esp+80h] [ebp-48h] BYREF v11.offset_0 + char v12; // [esp+88h] [ebp-40h] 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]; @@ -19232,15 +19299,15 @@ char *__thiscall night::NSCompileJs::compile_var[abi:cxx11](char *this, int a2, std::string::basic_string(lpuexcpta, v10); __cxa_throw( lpuexcpta, - (struct type_info *)&`typeinfo for'std::string, + (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; @@ -19304,33 +19371,40 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, char v40; // [esp+B8h] [ebp-70h] BYREF int v41; // [esp+C8h] [ebp-60h] BYREF int v42; // [esp+CCh] [ebp-5Ch] - int v43; // [esp+E0h] [ebp-48h] BYREF - int v44; // [esp+E4h] [ebp-44h] + int v43; // [esp+E0h] [ebp-48h] BYREF v43.offset_0 + int v44; // [esp+E4h] [ebp-44h] char v45; // [esp+E8h] [ebp-40h] BYREF - int v46; // [esp+F8h] [ebp-30h] + int v46; // [esp+F8h] [ebp-30h] v43.offset_24 int v47; // [esp+FCh] [ebp-2Ch] int v48[2]; // [esp+100h] [ebp-28h] BYREF char v49; // [esp+108h] [ebp-20h] BYREF - int v50; // [esp+118h] [ebp-10h] + int v50; // [esp+118h] [ebp-10h] v43.offset_56 int v51; // [esp+11Ch] [ebp-Ch] - this[1] = 0; + // compile_function - 0 *this = this + 2; + this[1] = 0; *((_BYTE *)this + 8) = 0; + + // a3->offset_136 v25 = a3[34]; if ( v25 ) { std::string::basic_string((void **)&v41, "function "); std::string::operator+=(&v41); - v44 = 0; *(_DWORD *)(a2 + 48) += v42; + v43 = (int)&v45; - v48[0] = (int)&v49; + v44 = 0; v45 = 0; + v46 = 0; v47 = 0; + + v48[0] = (int)&v49; v48[1] = 0; v49 = 0; + v50 = 0; v51 = 0; std::string::_M_assign((int)&v43, (int)(a3 + 6)); @@ -19339,6 +19413,8 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, std::string::_M_assign((int)v48, (int)(a3 + 33)); v50 = a3[12]; v51 = *(_DWORD *)(a2 + 48); + + // this->ofsset_36.push_back(v43) std::vector::push_back((night::ns_sourcemap **)(a2 + 36), (night::ns_sourcemap *)&v43); std::string::operator+=(a3 + 33); *(_DWORD *)(a2 + 48) += a3[34]; @@ -19352,13 +19428,15 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, v3 = &v43; *(_DWORD *)(a2 + 48) += v44; } + // compile_function - 5 std::string::_M_dispose((void **)v3); - std::string::operator+=(asc_5527F4); + std::string::operator+=(asc_5527F4); // "(\000)\000{" lpuexcpt = 0; ++*(_DWORD *)(a2 + 48); v29 = 0; while ( 1 ) { + // a3->offset_244 v4 = (_DWORD *)a3[61]; if ( lpuexcpt >= (v4[1] - *v4) >> 2 ) break; @@ -19391,6 +19469,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, lpuexcpt = v26; } } + // compile_function - 10 std::string::operator+=(5580790); ++*(_DWORD *)(a2 + 48); if ( v29 ) @@ -19406,9 +19485,11 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, v34[1] = 0; v34[0] = &v35; v35 = 0; + // cur v11 = (int *)std::vector::at(v10, lpuexcpta); if ( std::operator==((int)&night::NS_TYPE_ASSIGN, *v11) ) { + // cur v12 = std::vector::at((_DWORD *)a3[61], lpuexcpta); std::string::basic_string((char *)v36, *(_DWORD *)(*(_DWORD *)v12 + 180) + 60); std::string::basic_string((char *)&v41, (int)v36); @@ -19421,6 +19502,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, std::string::_M_dispose((void **)&v41); std::string::operator+=(v37); *(_DWORD *)(a2 + 48) += v37[1]; + v15 = std::vector::at((_DWORD *)a3[61], lpuexcpta); night::NSCompileJs::compile[abi:cxx11](a2, *(_DWORD *)(*(_DWORD *)v15 + 184)); std::string::operator+=(&v38); @@ -19430,6 +19512,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, std::string::_M_dispose((void **)&v43); std::string::operator+=(&v41); *(_DWORD *)(a2 + 48) += v42; + std::string::_M_dispose((void **)&v41); std::string::_M_dispose((void **)&v38); std::string::_M_dispose(v37); @@ -19439,6 +19522,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, ++lpuexcpta; } } + // compile_function - 15 lpuexcptb = (*(_DWORD *)(a2 + 40) - *(_DWORD *)(a2 + 36)) >> 6; night::NSCompileJs::compile[abi:cxx11](a2, a3[54]); if ( v29 ) @@ -19461,6 +19545,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, std::string::operator+=(&v43); std::string::_M_dispose((void **)&v43); --*(_DWORD *)(a2 + 48); + // int a2 while ( lpuexcptb < (*(_DWORD *)(a2 + 40) - *(_DWORD *)(a2 + 36)) >> 6 ) { v18 = std::vector::at((int *)(a2 + 36), lpuexcptb); @@ -19469,8 +19554,9 @@ _DWORD *__thiscall night::NSCompileJs::compile_function[abi:cxx11](_DWORD *this, *(_DWORD *)(v19 + 60) = v27; } v20 = (int *)&v38; - goto LABEL_29; + goto LABEL_29; // 销毁v20 -> LABEL_31 } + // compile_function - 20 if ( std::string::find((int *)v37, "arguments", 0) != -1 ) { std::operator+((int)&v43, "{arguments.", (int)&night::nsv_); @@ -19495,6 +19581,7 @@ LABEL_29: std::string::_M_dispose((void **)v20); goto LABEL_31; } + // compile_function - 25 std::string::operator+=(v37); LABEL_31: if ( !v25 ) @@ -19520,16 +19607,16 @@ void **__thiscall night::NSCompileJs::compile[abi:cxx11](void **this, int a2, _D char *v10; // [esp+68h] [ebp-60h] BYREF int v11; // [esp+6Ch] [ebp-5Ch] char v12; // [esp+70h] [ebp-58h] BYREF - char *v13; // [esp+80h] [ebp-48h] BYREF + char *v13; // [esp+80h] [ebp-48h] BYREF v13.offset_0 std::string int v14; // [esp+84h] [ebp-44h] char v15[16]; // [esp+88h] [ebp-40h] BYREF - int v16; // [esp+98h] [ebp-30h] - int v17; // [esp+9Ch] [ebp-2Ch] - char *v18; // [esp+A0h] [ebp-28h] BYREF + int v16; // [esp+98h] [ebp-30h] v13.offset_24 + int v17; // [esp+9Ch] [ebp-2Ch] v13.offset_28 + char *v18; // [esp+A0h] [ebp-28h] BYREF v13.offset_32 std::string int v19; // [esp+A4h] [ebp-24h] char v20[16]; // [esp+A8h] [ebp-20h] BYREF - int v21; // [esp+B8h] [ebp-10h] - int v22; // [esp+BCh] [ebp-Ch] + int v21; // [esp+B8h] [ebp-10h] v13.offset_56 + int v22; // [esp+BCh] [ebp-Ch] v13.offset_60 if ( !*(_DWORD *)(a2 + 4) ) { @@ -19545,19 +19632,22 @@ void **__thiscall night::NSCompileJs::compile[abi:cxx11](void **this, int a2, _D { if ( std::operator==((int)&night::NS_TYPE_BOOL, (int)v9) ) { - v15[0] = 0; - v13 = v15; - v18 = v20; + v13 = v15; // v13.offset_0 v14 = 0; + v15[0] = 0; + v18 = v20; v16 = 0; v17 = 0; v19 = 0; v20[0] = 0; v21 = 0; v22 = 0; + // a3 + 6 -> a3.offset_24 std::string::_M_assign((int)&v13, (int)(a3 + 6)); + // v16 -> v13.offset_24 v16 = a3[12]; v17 = a3[13]; + // a3 + 15 -> a3.offset_60 std::string::_M_assign((int)&v18, (int)(a3 + 15)); v21 = a3[12]; v22 = *(_DWORD *)(a2 + 48); @@ -19571,6 +19661,7 @@ void **__thiscall night::NSCompileJs::compile[abi:cxx11](void **this, int a2, _D } if ( std::operator==((int)&night::NS_TYPE_STR, (int)v9) ) { + // a3.offset_108 std::operator+((char *)&v13, (int)(a3 + 27), (int)(a3 + 15)); v3 = std::string::append(&v13, (int)(a3 + 27)); std::string::basic_string(&v10, v3); @@ -19725,9 +19816,9 @@ int __thiscall night::NSCompileJs::compile_k_v[abi:cxx11](int this, int a2, int void *v7[6]; // [esp+50h] [ebp-38h] BYREF void *v8[8]; // [esp+68h] [ebp-20h] BYREF - *(_BYTE *)(this + 8) = 0; *(_DWORD *)this = this + 8; *(_DWORD *)(this + 4) = 0; + *(_BYTE *)(this + 8) = 0; night::NSCompileJs::compile[abi:cxx11](a2, *(_DWORD *)(a3 + 188)); v3 = std::string::append(v7, ":"); std::string::basic_string(v8, v3); @@ -19753,8 +19844,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; @@ -19766,7 +19857,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); @@ -19798,9 +19889,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]; @@ -19812,7 +19903,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_for[abi:cxx11](_DWORD *this, int std::string::basic_string(lpuexcpta, v16); __cxa_throw( lpuexcpta, - (struct type_info *)&`typeinfo for'std::string, + (struct type_info *)&`typeinfo for std::string, (void (__cdecl *)(void *))std::string::~string); } v4 = (_DWORD *)std::vector::at(v3, 0); @@ -19823,6 +19914,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::at(*(_DWORD **)(a3 + 228), 1u); night::NSCompileJs::compile[abi:cxx11](a2, *v6); v7 = std::string::append(v15, ";"); @@ -19856,9 +19948,10 @@ _DWORD *__thiscall night::NSCompileJs::compile_while[abi:cxx11](_DWORD *this, in 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::basic_string(v5, "while("); std::string::operator+=(v5); *(_DWORD *)(a2 + 48) += v5[1]; @@ -19884,9 +19977,10 @@ _DWORD *__thiscall night::NSCompileJs::compile_do_while[abi:cxx11](_DWORD *this, void *v6[6]; // [esp+70h] [ebp-38h] BYREF void *v7[8]; // [esp+88h] [ebp-20h] BYREF - this[1] = 0; *this = this + 2; + this[1] = 0; *((_BYTE *)this + 8) = 0; + std::string::basic_string(v5, "do"); std::string::operator+=(v5); *(_DWORD *)(a2 + 48) += v5[1]; @@ -20016,9 +20110,9 @@ _BYTE *__thiscall night::NSCompileJs::compile_obj_self_op[abi:cxx11](_BYTE *this void *v7[6]; // [esp+50h] [ebp-38h] BYREF void *v8[8]; // [esp+68h] [ebp-20h] BYREF - this[8] = 0; *(_DWORD *)this = this + 8; *((_DWORD *)this + 1) = 0; + this[8] = 0; lpuexcpt = (struct _Unwind_Exception *)(a3 + 156); if ( *(_BYTE *)(a3 + 200) ) { @@ -20220,8 +20314,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); @@ -20240,9 +20334,9 @@ _BYTE *__thiscall night::NSCompileJs::compile_ternary[abi:cxx11](_BYTE *this, in void *v6[6]; // [esp+50h] [ebp-38h] BYREF void *v7[8]; // [esp+68h] [ebp-20h] BYREF - this[8] = 0; *(_DWORD *)this = this + 8; *((_DWORD *)this + 1) = 0; + this[8] = 0; night::NSCompileJs::compile[abi:cxx11](a2, *(_DWORD *)(a3 + 180)); v3 = std::string::append(v6, ":"); std::string::basic_string(v7, v3); @@ -20275,6 +20369,7 @@ _DWORD *__thiscall night::NSCompileJs::compile_binary[abi:cxx11](_DWORD *this, i std::string::basic_string(v8, v3); std::string::_M_dispose((void **)v10); *(_DWORD *)(a2 + 48) += v8[1]; + night::NSCompileJs::compile[abi:cxx11](a2, *(_DWORD *)(a3 + 184)); std::operator+((char *)v10, (int)v7, (int)v8); v4 = std::string::append(v10, (int)v9); @@ -20318,9 +20413,9 @@ int __thiscall night::NSCompileJs::compile_call[abi:cxx11](int this, int a2, int unsigned int lpuexcpta; // [esp+24h] [ebp-64h] void *v24[8]; // [esp+68h] [ebp-20h] BYREF - *(_BYTE *)(this + 8) = 0; - *(_DWORD *)this = this + 8; + *(_DWORD *)this = this + 8; // std::string *(_DWORD *)(this + 4) = 0; + *(_BYTE *)(this + 8) = 0; night::NSCompileJs::compile[abi:cxx11](a2, *(_DWORD *)(a3 + 220)); std::string::operator=((unsigned __int8 **)this, (int)v24); std::string::_M_dispose(v24); @@ -20344,16 +20439,18 @@ int __thiscall night::NSCompileJs::compile_call[abi:cxx11](int this, int a2, int v7 = (int *)std::vector::at(*v6, 0), !std::operator==((int)&night::NS_TYPE_SKIP, *v7)) ) { - std::string::operator+=(asc_5527F4); + std::string::operator+=(asc_5527F4); // "(\000)\000{" v19 = 0; ++*(_DWORD *)(a2 + 48); while ( 1 ) { + // v4 v11 = std::vector>>::at( *(_DWORD **)(a3 + 224), lpuexcpt); if ( v19 >= (*(_DWORD *)(*(_DWORD *)v11 + 4) - **(_DWORD **)v11) >> 2 ) break; + // v4 v8 = (_DWORD **)std::vector>>::at( *(_DWORD **)(a3 + 224), lpuexcpt); @@ -20362,6 +20459,7 @@ int __thiscall night::NSCompileJs::compile_call[abi:cxx11](int this, int a2, int std::string::operator+=(v24); std::string::_M_dispose(v24); v17 = v19 + 1; + // v4 v10 = std::vector>>::at( *(_DWORD **)(a3 + 224), lpuexcpt); @@ -20372,7 +20470,7 @@ int __thiscall night::NSCompileJs::compile_call[abi:cxx11](int this, int a2, int ++*(_DWORD *)(a2 + 48); v19 = v17; } - } + } // end while std::string::operator+=(5580790); ++*(_DWORD *)(a2 + 48); } @@ -20383,7 +20481,7 @@ int __thiscall night::NSCompileJs::compile_call[abi:cxx11](int this, int a2, int { for ( i = 0; i < (*(_DWORD *)(*(_DWORD *)(a3 + 224) + 4) - **(_DWORD **)(a3 + 224)) >> 2; ++i ) { - std::string::operator+=(asc_5527F4); + std::string::operator+=(asc_5527F4); // "(\000)\000{" lpuexcpta = 0; ++*(_DWORD *)(a2 + 48); while ( 1 ) @@ -20407,7 +20505,7 @@ int __thiscall night::NSCompileJs::compile_call[abi:cxx11](int this, int a2, int ++*(_DWORD *)(a2 + 48); lpuexcpta = v18; } - } + } // end while std::string::operator+=(5580790); ++*(_DWORD *)(a2 + 48); } @@ -20433,9 +20531,11 @@ _DWORD *__thiscall night::NSCompileJs::compile_prog[abi:cxx11](_DWORD *this, int if ( !v10 ) std::string::operator=((unsigned int *)&v9, ";"); lpuexcpt = 0; - this[1] = 0; + *this = this + 2; + this[1] = 0; *((_BYTE *)this + 8) = 0; + while ( 1 ) { v4 = *(_DWORD **)(a3 + 228); @@ -20468,8 +20568,8 @@ _DWORD *__thiscall night::NSCompileJs::compile_prog_no_sem[abi:cxx11](_DWORD *th unsigned int lpuexcpt; // [esp+14h] [ebp-64h] void *v8[8]; // [esp+58h] [ebp-20h] BYREF - this[1] = 0; *this = this + 2; + this[1] = 0; *((_BYTE *)this + 8) = 0; if ( std::operator==((int)&night::NS_TYPE_OBJ_BLOCK, a3) ) { @@ -20549,45 +20649,47 @@ 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); night::NSASTParse::NSASTParse((int)v39, (int)v29, (int)v27, (int)v17); std::string::_M_dispose(v29); - v29[1] = 0; - v29[0] = &v30; - v31 = v39; + v29[0] = &v30; // v29.offset_0 std::string缓冲区 + v29[1] = 0; // v29.offset_4 + v30 = 0; // v29.offset_8 + v31 = v39; // v29.offset_24 = v39 + 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; - v30 = 0; - v34 = 0; - v35 = 0; - v36 = 0; - v32 = 0; - v33 = 0; - v37 = 1; 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); @@ -21609,13 +21711,15 @@ 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 v12 = 0; - v11 = &v13; + v11 = &v13; // std::string 00(v11) 00 00 00, 00(v12) 00 00 00, 00(v13) 00 00 00 v13 = 0; lpuexcpt = MMBizWxaAppComm::PathCombine(a1, a2, (unsigned int *)&v11); if ( !lpuexcpt ) @@ -21635,7 +21739,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); @@ -21646,7 +21750,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); @@ -21680,7 +21784,7 @@ int __cdecl night::str::get_token(int a1, _DWORD *a2, unsigned int a3) { char v3; // al - *(_DWORD *)(a1 + 4) = 0; + *(_DWORD *)(a1 + 4) = 0; // std::string *(_DWORD *)a1 = a1 + 8; *(_BYTE *)(a1 + 8) = 0; while ( a3 < a2[1] ) @@ -53836,9 +53940,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; @@ -53889,7 +53993,7 @@ bool __cdecl night::NSToken::rw_cb_number(night::NSToken *this, _BYTE *a2) { bool result; // al - if ( (_BYTE)this != 46 ) + if ( (_BYTE)this != '.'/*46*/ ) return (unsigned __int8)((_BYTE)this - 48) <= 9u; result = 0; if ( !*a2 ) @@ -53908,10 +54012,10 @@ char __cdecl night::NSToken::tk_is_comment2(night::NSToken *this, night::NSStrea int v5[4]; // [esp+34h] [ebp-14h] BYREF night::NSStream::peek(v3, a2); - if ( LOBYTE(v3[0]) != 42 ) + if ( LOBYTE(v3[0]) != '*'/*42*/ ) return 1; night::NSStream::peek_2(v4, a2); - if ( LOBYTE(v4[0]) != 47 ) + if ( LOBYTE(v4[0]) != '/'/*47*/ ) return 1; night::NSStream::next(v5, a2); return 0;