fix: 处理乱码

This commit is contained in:
msojocs 2023-07-29 16:30:48 +08:00
parent cbd33f5375
commit 5cff0a5da3
3 changed files with 28 additions and 17 deletions

View File

@ -295,8 +295,10 @@ namespace night
} }
return v6; return v6;
} }
int ast_dispatch_i = 0;
night::ns_node *NSASTParse::ast_dispatch(bool a3) night::ns_node *NSASTParse::ast_dispatch(bool a3)
{ {
int inner_ast_dispatch_i = ++ast_dispatch_i;
// ast_dispatch - 0 // ast_dispatch - 0
auto v42 = this->is_punctuation("("); auto v42 = this->is_punctuation("(");
if (!v42) if (!v42)
@ -560,7 +562,8 @@ namespace night
if ("." == v40) if ("." == v40)
{ {
auto v11 = this->ast_obj_dot(v59); auto v11 = this->ast_obj_dot(v59);
return this->make_call_or_just_expression(v11); auto result = this->make_call_or_just_expression(v11);
return result;
} }
} }
if (this->is_obj_op_self(true)) if (this->is_obj_op_self(true))
@ -569,7 +572,8 @@ namespace night
return this->make_call_or_just_expression(v11); return this->make_call_or_just_expression(v11);
} }
auto v11 = v59; auto v11 = v59;
return this->make_call_or_just_expression(v11); night::ns_node * result = this->make_call_or_just_expression(v11);
return result;
} }
// ast_dispatch - 5 // ast_dispatch - 5
@ -619,7 +623,8 @@ namespace night
} }
} }
// ast_dispatch - 20 // ast_dispatch - 20
return this->make_call_or_just_expression(v79); auto result = this->make_call_or_just_expression(v79);
return result;
} }
std::vector<night::ns_node *>* NSASTParse::make_list_by_parser( std::vector<night::ns_node *>* NSASTParse::make_list_by_parser(
@ -692,8 +697,10 @@ namespace night
} }
int make_binary_or_just_value_i = 0;
night::ns_node *NSASTParse::make_binary_or_just_value(night::ns_node * a2, bool a3) 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 v21;
bool v18; bool v18;
if (a3) if (a3)
@ -765,6 +772,7 @@ namespace night
{ {
this->offset_28->err("Expected exp", v15, v16, 1); this->offset_28->err("Expected exp", v15, v16, 1);
} }
return this->make_binary_or_just_value(v26, a3);
} }
} }
return a2; return a2;
@ -787,9 +795,10 @@ namespace night
} }
return a2; return a2;
} }
int ast_expression_i = 0;
night::ns_node *NSASTParse::ast_expression() night::ns_node *NSASTParse::ast_expression()
{ {
ast_expression_i++;
auto v1 = this->ast_dispatch(false); auto v1 = this->ast_dispatch(false);
auto binary_or_just_value = this->make_binary_or_just_value(v1, 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); auto result = this->make_call_or_just_expression(binary_or_just_value);
@ -806,8 +815,10 @@ namespace night
throw "not implement"; throw "not implement";
} }
int ast_obj_dot_i = 0;
night::ns_node *NSASTParse::ast_obj_dot(night::ns_node* a2) night::ns_node *NSASTParse::ast_obj_dot(night::ns_node* a2)
{ {
ast_obj_dot_i++;
auto v11 = this->offset_24; auto v11 = this->offset_24;
auto v9 = v11->gen_girl(night::std_v_n); auto v9 = v11->gen_girl(night::std_v_n);
auto v10 = v11->gen_son(night::NS_TYPE_OBJ_DOT); auto v10 = v11->gen_son(night::NS_TYPE_OBJ_DOT);

View File

@ -17,15 +17,14 @@ namespace night
} }
std::string NSCompileJs::compile_binary(night::ns_node *a3) 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 v10 = " " + a3->offset_156;
std::string v3 = v10.append(" "); std::string v3 = v10.append(" ");
this->offset_48 += v3.length(); this->offset_48 += v3.length();
std::string v7 = this->compile(a3->offset_184); std::string v7 = this->compile(a3->offset_184);
std::string v4 = ""; std::string v4 = "";
v4 = v7 + v3; v4 = ret + v3 + v7;
// v4.append(v9);
return v4; return v4;
} }
std::string NSCompileJs::compile_call(night::ns_node *a3) std::string NSCompileJs::compile_call(night::ns_node *a3)
@ -60,7 +59,7 @@ namespace night
this->offset_48++; this->offset_48++;
} }
} }
str += 5580790; // TODO...待确认 str += ")"; // TODO...待确认
this->offset_48++; this->offset_48++;
} }
@ -84,7 +83,7 @@ namespace night
this->offset_48++; this->offset_48++;
} }
} }
str += 5580790; str += ")";
this->offset_48++; this->offset_48++;
} }
@ -127,7 +126,7 @@ namespace night
this->offset_48++; this->offset_48++;
result += this->compile(v3->at(2)); result += this->compile(v3->at(2));
result += 5580790; result += ")";
this->offset_48++; this->offset_48++;
result += this->compile(a3->offset_216); result += this->compile(a3->offset_216);
@ -187,11 +186,12 @@ namespace night
} }
} }
// compile_function - 10 // compile_function - 10
result += 5580790; result += ")";
// "(function (nv_evt,nv_instanc"
this->offset_48++; this->offset_48++;
if (v29) if (v29)
{ {
result += 5580792; result += ")";
this->offset_48++; this->offset_48++;
auto v10 = a3->offset_244; auto v10 = a3->offset_244;
for (int i = 0; i < v10->size(); i++) for (int i = 0; i < v10->size(); i++)
@ -265,7 +265,7 @@ namespace night
LABEL_31: LABEL_31:
if (!a3->offset_132.length()) if (!a3->offset_132.length())
{ {
result += 5580790; result += ")";
this->offset_48++; this->offset_48++;
} }
return result; return result;
@ -442,7 +442,7 @@ namespace night
result += v5; result += v5;
this->offset_48 += v5.length(); this->offset_48 += v5.length();
result += this->compile(a3->offset_204); result += this->compile(a3->offset_204);
result += 5580790; result += ")";
this->offset_48++; this->offset_48++;
result += this->compile(a3->offset_216); result += this->compile(a3->offset_216);
@ -487,7 +487,7 @@ namespace night
} }
if (night::NS_TYPE_OBJ_BLOCK == a3->offset_0) if (night::NS_TYPE_OBJ_BLOCK == a3->offset_0)
{ {
result += 5580790; result += ")";
this->offset_48++; this->offset_48++;
} }
return result; return result;

View File

@ -13,7 +13,7 @@ namespace night
std::string ns_node::debug_no_space() std::string ns_node::debug_no_space()
{ {
return ""; throw "not implement";
} }
} }