mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
feat: 补充一些方法
This commit is contained in:
parent
a070b1f532
commit
77c78f4fe8
@ -44,6 +44,8 @@ namespace night
|
|||||||
extern std::string nsv_;
|
extern std::string nsv_;
|
||||||
extern std::string nst_;
|
extern std::string nst_;
|
||||||
|
|
||||||
|
extern std::string NS_BUILTIN_SPACE;
|
||||||
|
|
||||||
int compile_ns(std::string const&,std::string const&,std::string const&,uint,std::string&,bool);
|
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 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 readfile(char const*, std::string &);
|
||||||
@ -61,11 +63,11 @@ namespace night
|
|||||||
std::string offset_108;
|
std::string offset_108;
|
||||||
std::string offset_132;
|
std::string offset_132;
|
||||||
std::string offset_156;
|
std::string offset_156;
|
||||||
night::ns_node * offset_180;
|
night::ns_node * offset_180 = nullptr;
|
||||||
night::ns_node * offset_184;
|
night::ns_node * offset_184 = nullptr;
|
||||||
night::ns_node * offset_192;
|
night::ns_node * offset_192 = nullptr;
|
||||||
std::vector<night::ns_node *>* offset_196;
|
std::vector<night::ns_node *>* offset_196 = nullptr;
|
||||||
std::vector<night::ns_node *>* offset_228;
|
std::vector<night::ns_node *>* offset_228 = nullptr;
|
||||||
ns_node(/* args */);
|
ns_node(/* args */);
|
||||||
~ns_node();
|
~ns_node();
|
||||||
std::string debug_no_space(void);
|
std::string debug_no_space(void);
|
||||||
@ -78,7 +80,15 @@ namespace night
|
|||||||
public:
|
public:
|
||||||
struct GodsSon {
|
struct GodsSon {
|
||||||
std::string offset_0;
|
std::string offset_0;
|
||||||
std::vector<night::ns_node *>* offset_24;
|
union
|
||||||
|
{
|
||||||
|
/* data */
|
||||||
|
std::vector<night::ns_node *>* offset_24_vec = nullptr;
|
||||||
|
night::ns_node * offset_24_node;
|
||||||
|
};
|
||||||
|
|
||||||
|
// std::vector<night::ns_node *>* offset_24;
|
||||||
|
|
||||||
};
|
};
|
||||||
std::vector<night::NSGod::GodsSon *> offset_0;
|
std::vector<night::NSGod::GodsSon *> offset_0;
|
||||||
NSGod(/* args */);
|
NSGod(/* args */);
|
||||||
@ -101,12 +111,12 @@ namespace night
|
|||||||
NSStream(/* args */);
|
NSStream(/* args */);
|
||||||
NSStream(std::string const&,std::string const&,uint);
|
NSStream(std::string const&,std::string const&,uint);
|
||||||
~NSStream();
|
~NSStream();
|
||||||
void eof(void);
|
bool eof(void);
|
||||||
void eof_2(void);
|
bool eof_2(void);
|
||||||
void err(std::string const&,int,int,bool);
|
void err(std::string const&,int,int,bool);
|
||||||
void next(void);
|
char next(void);
|
||||||
void peek(void);
|
char peek(void);
|
||||||
void peek_2(void);
|
char peek_2(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class NSToken
|
class NSToken
|
||||||
@ -114,8 +124,11 @@ namespace night
|
|||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
public:
|
public:
|
||||||
|
NSGod offset_0;
|
||||||
NSStream offset_4; // 不是int
|
NSStream offset_4; // 不是int
|
||||||
night::ns_node* offset_8;
|
night::ns_node* offset_8 = nullptr;
|
||||||
|
std::vector<night::ns_node *> offset_12;
|
||||||
|
|
||||||
NSToken(/* args */);
|
NSToken(/* args */);
|
||||||
~NSToken();
|
~NSToken();
|
||||||
bool eof(void);
|
bool eof(void);
|
||||||
@ -129,17 +142,17 @@ namespace night
|
|||||||
void read_comment_method_2(void);
|
void read_comment_method_2(void);
|
||||||
night::ns_node* read_next(void);
|
night::ns_node* read_next(void);
|
||||||
void read_number(std::string const&);
|
void read_number(std::string const&);
|
||||||
void read_string(char, std::string const&);
|
night::ns_node * read_string(char, std::string const&);
|
||||||
void read_var(std::string const&);
|
void read_var(std::string const&);
|
||||||
std::string read_while(bool (*)(char,void *),void *);
|
std::string read_while(bool (*)(char,void *),void *);
|
||||||
void rw_cb_number(char,void *);
|
void rw_cb_number(char,void *);
|
||||||
void skip_comment(std::string &);
|
void skip_comment(std::string &);
|
||||||
void tk_is_comment2(char,void *);
|
static bool tk_is_comment2(char,void *);
|
||||||
void tk_is_not_line_break(char,void *);
|
static bool tk_is_not_line_break(char,void *);
|
||||||
void tk_is_valid_op_str(char,void *);
|
bool tk_is_valid_op_str(char,void *);
|
||||||
void tk_is_var(char,void *);
|
bool tk_is_var(char,void *);
|
||||||
void tk_is_var_start(char,void *);
|
void tk_is_var_start(char,void *);
|
||||||
void tk_is_whitespace(char,void *);
|
static bool tk_is_whitespace(char,void *);
|
||||||
};
|
};
|
||||||
|
|
||||||
class NSASTParse
|
class NSASTParse
|
||||||
@ -147,8 +160,8 @@ namespace night
|
|||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
std::string offset_0;
|
std::string offset_0;
|
||||||
night::NSGod * offset_24;
|
night::NSGod * offset_24 = nullptr;
|
||||||
night::NSToken * offset_28;
|
night::NSToken * offset_28 = nullptr;
|
||||||
int offset_36;
|
int offset_36;
|
||||||
int offset_40;
|
int offset_40;
|
||||||
std::string offset_44;
|
std::string offset_44;
|
||||||
@ -230,10 +243,10 @@ namespace night
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
night::NSASTParse * offset_24;
|
|
||||||
std::vector<std::string> * offset_28;
|
|
||||||
public:
|
public:
|
||||||
std::string offset_0;
|
std::string offset_0;
|
||||||
|
night::NSASTParse * offset_24 = nullptr;
|
||||||
|
std::vector<std::string> * offset_28 = nullptr;
|
||||||
std::vector<night::ns_sourcemap> offset_36;
|
std::vector<night::ns_sourcemap> offset_36;
|
||||||
int offset_48;
|
int offset_48;
|
||||||
NSCompileJs(/* args */);
|
NSCompileJs(/* args */);
|
||||||
@ -262,7 +275,7 @@ namespace night
|
|||||||
|
|
||||||
namespace str
|
namespace str
|
||||||
{
|
{
|
||||||
void get_token(std::string const&, int);
|
std::string get_token(std::string const&, int);
|
||||||
bool path_combine(
|
bool path_combine(
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
|
@ -37,6 +37,7 @@ namespace night
|
|||||||
std::string NS_BUILTIN_OP_SELF = "~!";
|
std::string NS_BUILTIN_OP_SELF = "~!";
|
||||||
std::string NS_BUILTIN_ALL_OP = " = ? + - * / % ++ -- + - ~ ! << >> >>> & ^ | < > <= >= == != === !== *= /= %= += -= <<= >>= >>>= &= ^= |= && || ";
|
std::string NS_BUILTIN_ALL_OP = " = ? + - * / % ++ -- + - ~ ! << >> >>> & ^ | < > <= >= == != === !== *= /= %= += -= <<= >>= >>>= &= ^= |= && || ";
|
||||||
std::string NS_BUILTIN_PUNC = ".,;(){}[]:";
|
std::string NS_BUILTIN_PUNC = ".,;(){}[]:";
|
||||||
|
std::string NS_BUILTIN_SPACE = " \t\r\n";
|
||||||
|
|
||||||
std::string std_v_n = "new std::vector<ns_node*>";
|
std::string std_v_n = "new std::vector<ns_node*>";
|
||||||
std::string std_v_v_n = "new std::vector<std::vector<ns_node*>*>";
|
std::string std_v_v_n = "new std::vector<std::vector<ns_node*>*>";
|
||||||
@ -60,6 +61,7 @@ namespace night
|
|||||||
NSCompileJs cjs;
|
NSCompileJs cjs;
|
||||||
std::string v19;
|
std::string v19;
|
||||||
std::vector<std::string> v18;
|
std::vector<std::string> v18;
|
||||||
|
cjs.offset_24 = &v39;
|
||||||
std::string v21 = cjs.compile_once(v19, &v18, a6);
|
std::string v21 = cjs.compile_once(v19, &v18, a6);
|
||||||
v17.hamlet();
|
v17.hamlet();
|
||||||
if (v21.length())
|
if (v21.length())
|
||||||
|
@ -14,21 +14,30 @@ namespace night
|
|||||||
{
|
{
|
||||||
night::NSGod::GodsSon* node = new night::NSGod::GodsSon();
|
night::NSGod::GodsSon* node = new night::NSGod::GodsSon();
|
||||||
|
|
||||||
|
node->offset_0.assign(a2);
|
||||||
if (night::std_v_n == a2)
|
if (night::std_v_n == a2)
|
||||||
{
|
{
|
||||||
|
node->offset_24_vec = new std::vector<night::ns_node *>();
|
||||||
}
|
}
|
||||||
if (night::std_v_v_n == a2)
|
if (night::std_v_v_n == a2)
|
||||||
{
|
{
|
||||||
|
node->offset_24_vec = new std::vector<night::ns_node *>();
|
||||||
}
|
}
|
||||||
this->offset_0.push_back(node);
|
this->offset_0.push_back(node);
|
||||||
return node->offset_24;
|
return node->offset_24_vec;
|
||||||
}
|
}
|
||||||
|
|
||||||
night::ns_node* 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)
|
void NSGod::hamlet(void)
|
||||||
@ -38,19 +47,27 @@ namespace night
|
|||||||
auto v3 = this->offset_0[i];
|
auto v3 = this->offset_0[i];
|
||||||
if (v3->offset_0 == night::std_v_n)
|
if (v3->offset_0 == night::std_v_n)
|
||||||
{
|
{
|
||||||
auto v4 = v3->offset_24;
|
auto v4 = v3->offset_24_vec;
|
||||||
if (v4)
|
if (v4)
|
||||||
{
|
{
|
||||||
delete v4;
|
delete v4;
|
||||||
}
|
}
|
||||||
|
if (v3->offset_24_node)
|
||||||
|
{
|
||||||
|
delete v3->offset_24_node;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (v3->offset_0 == night::std_v_v_n)
|
if (v3->offset_0 == night::std_v_v_n)
|
||||||
{
|
{
|
||||||
auto v4 = v3->offset_24;
|
auto v4 = v3->offset_24_vec;
|
||||||
if (v4)
|
if (v4)
|
||||||
{
|
{
|
||||||
delete v4;
|
delete v4;
|
||||||
}
|
}
|
||||||
|
if (v3->offset_24_node)
|
||||||
|
{
|
||||||
|
delete v3->offset_24_node;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
delete v3;
|
delete v3;
|
||||||
|
@ -14,18 +14,25 @@ namespace night
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void NSStream::peek(void)
|
char NSStream::peek(void)
|
||||||
{
|
{
|
||||||
if (this->offset_48 < this->offset_24.length())
|
if (this->offset_48 < this->offset_24.length())
|
||||||
{
|
{
|
||||||
char v3 = this->offset_24.at(this->offset_48);
|
char v3 = this->offset_24.at(this->offset_48);
|
||||||
|
return v3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void NSStream::peek_2(void)
|
|
||||||
|
bool NSStream::eof(void)
|
||||||
|
{
|
||||||
|
return this->peek() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char NSStream::peek_2(void)
|
||||||
{
|
{
|
||||||
if (this->offset_48 + 1 < this->offset_24.length())
|
if (this->offset_48 + 1 < this->offset_24.length())
|
||||||
{
|
{
|
||||||
@ -35,12 +42,42 @@ namespace night
|
|||||||
this->offset_52++;
|
this->offset_52++;
|
||||||
this->offset_56 = 1;
|
this->offset_56 = 1;
|
||||||
}
|
}
|
||||||
|
return v3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NSStream::eof_2(void)
|
||||||
|
{
|
||||||
|
return this->peek_2() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
char NSStream::next(void)
|
||||||
|
{
|
||||||
|
if (this->offset_48 < this->offset_24.length())
|
||||||
|
{
|
||||||
|
char v7 = this->offset_24.at(this->offset_48);
|
||||||
|
this->offset_48++;
|
||||||
|
if (v7 == 10) // \n
|
||||||
|
{
|
||||||
|
this->offset_56 = 1;
|
||||||
|
this->offset_52++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->offset_56++;
|
||||||
|
}
|
||||||
|
return v7;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void NSStream::err(std::string const& a2, int a3, int a4, bool a5)
|
void NSStream::err(std::string const& a2, int a3, int a4, bool a5)
|
||||||
{
|
{
|
||||||
std::string v10;
|
std::string v10;
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "../include/night.h"
|
#include "../include/night.h"
|
||||||
|
#include "../include/wxml.h"
|
||||||
|
|
||||||
namespace night
|
namespace night
|
||||||
{
|
{
|
||||||
@ -9,6 +10,7 @@ namespace night
|
|||||||
NSToken::~NSToken()
|
NSToken::~NSToken()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
night::ns_node* NSToken::peek(void)
|
night::ns_node* NSToken::peek(void)
|
||||||
{
|
{
|
||||||
auto result = this->offset_8;
|
auto result = this->offset_8;
|
||||||
@ -19,9 +21,38 @@ namespace night
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
night::ns_node* 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();
|
||||||
|
this->read_string(v13, v14);
|
||||||
|
// TODO...
|
||||||
|
|
||||||
|
}
|
||||||
|
return v7;
|
||||||
|
}
|
||||||
|
auto ret = this->offset_12.back();
|
||||||
|
this->offset_12.pop_back();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
night::ns_node* NSToken::next(void)
|
night::ns_node* NSToken::next(void)
|
||||||
{
|
{
|
||||||
auto result = this->offset_8;
|
auto result = this->offset_8;
|
||||||
@ -38,14 +69,160 @@ namespace night
|
|||||||
return this->peek() == 0;
|
return this->peek() == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NSToken::push(night::ns_node*)
|
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 != '/')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (this->offset_4.eof_2())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
v5 = this->offset_4.peek_2();
|
||||||
|
if (v5 == '/')
|
||||||
|
{
|
||||||
|
v5 = this->offset_4.next();
|
||||||
|
v5 = this->offset_4.next();
|
||||||
|
this->read_comment_method_1();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v5 = this->offset_4.peek_2();
|
||||||
|
if (v5 == '*')
|
||||||
|
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.eof();
|
||||||
|
if ( v9 == '\n')
|
||||||
|
{
|
||||||
|
if (!i)
|
||||||
|
{
|
||||||
|
this->offset_4.err("Unexpected `\\n`", 0, 0, false);
|
||||||
|
}
|
||||||
|
v10.push_back('\n');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!i)
|
||||||
|
{
|
||||||
|
if (v9 == '\\')
|
||||||
|
{
|
||||||
|
v4 = 1;
|
||||||
|
v10.push_back('\\');
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (v9 == a2)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
v10.push_back(v9);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
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, a4))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
v6 = this->offset_4.next();
|
||||||
|
result.push_back(v6);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void NSToken::err(std::string const& a2, int a3, int a4, bool a5)
|
void NSToken::err(std::string const& a2, int a3, int a4, bool a5)
|
||||||
{
|
{
|
||||||
this->offset_4.err(a2, a3, a4, a5);
|
this->offset_4.err(a2, a3, a4, a5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NSToken::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_comment2(char ch, void * t)
|
||||||
|
{
|
||||||
|
night::NSStream *a2 = (night::NSStream *)t;
|
||||||
|
auto v3 = a2->peek();
|
||||||
|
if (v3 != '*')
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
v3 = a2->peek_2();
|
||||||
|
if (v3 != '/')
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
a2->next();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,16 +1,58 @@
|
|||||||
#include "../../include/night.h"
|
#include "../../include/night.h"
|
||||||
|
#include "../../include/wxa.h"
|
||||||
|
#include "../../include/wxml.h"
|
||||||
|
|
||||||
namespace night
|
namespace night
|
||||||
{
|
{
|
||||||
|
|
||||||
namespace str
|
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;
|
||||||
|
|
||||||
}
|
}
|
||||||
bool path_combine(std::string const&, std::string const&, std::string&)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* todo...
|
||||||
|
*/
|
||||||
|
bool path_combine(std::string const& a1, std::string const& a2, std::string& a3)
|
||||||
|
{
|
||||||
|
std::string v11;
|
||||||
|
MMBizWxaAppComm::PathCombine(a1, a2, v11);
|
||||||
|
if (v11.length() > 3)
|
||||||
|
{
|
||||||
|
std::string v14 = v11.substr(v11.length() - 3);
|
||||||
|
int code = v14 == ".wxs";
|
||||||
|
if (code)
|
||||||
|
{
|
||||||
|
code = 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::string v3 = WXML::Rewrite::ToStringCode(v11);
|
||||||
|
if (v3 == "")
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} // namespace str
|
} // namespace str
|
||||||
} // namespace night
|
} // namespace night
|
||||||
|
@ -15901,26 +15901,33 @@ _DWORD *__thiscall night::NSGod::gen_son(void *this, int a2)
|
|||||||
v6[0] = (int)v3;
|
v6[0] = (int)v3;
|
||||||
std::string::_M_assign((int)v3, a2);
|
std::string::_M_assign((int)v3, a2);
|
||||||
v4 = operator new(0xF8u);
|
v4 = operator new(0xF8u);
|
||||||
*v4 = v4 + 2;
|
*v4 = v4 + 2; // std::string offset_0
|
||||||
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[1] = 0;
|
v4[1] = 0;
|
||||||
*((_BYTE *)v4 + 8) = 0;
|
|
||||||
|
v4[6] = v4 + 8; // std::string offset_24
|
||||||
v4[7] = 0;
|
v4[7] = 0;
|
||||||
*((_BYTE *)v4 + 32) = 0;
|
|
||||||
|
v4[15] = v4 + 17; // std::string offset_60
|
||||||
v4[16] = 0;
|
v4[16] = 0;
|
||||||
*((_BYTE *)v4 + 68) = 0;
|
|
||||||
|
v4[21] = v4 + 23; // std::string offset_84
|
||||||
v4[22] = 0;
|
v4[22] = 0;
|
||||||
*((_BYTE *)v4 + 92) = 0;
|
|
||||||
|
v4[27] = v4 + 29; // std::string offset_108
|
||||||
v4[28] = 0;
|
v4[28] = 0;
|
||||||
*((_BYTE *)v4 + 116) = 0;
|
|
||||||
|
v4[33] = v4 + 35; // std::string offset_132
|
||||||
v4[34] = 0;
|
v4[34] = 0;
|
||||||
*((_BYTE *)v4 + 140) = 0;
|
|
||||||
|
v4[39] = v4 + 41; // std::string offset_156
|
||||||
v4[40] = 0;
|
v4[40] = 0;
|
||||||
|
|
||||||
|
*((_BYTE *)v4 + 8) = 0;
|
||||||
|
*((_BYTE *)v4 + 32) = 0;
|
||||||
|
*((_BYTE *)v4 + 68) = 0;
|
||||||
|
*((_BYTE *)v4 + 92) = 0;
|
||||||
|
*((_BYTE *)v4 + 116) = 0;
|
||||||
|
*((_BYTE *)v4 + 140) = 0;
|
||||||
*((_BYTE *)v4 + 164) = 0;
|
*((_BYTE *)v4 + 164) = 0;
|
||||||
v4[13] = 0;
|
v4[13] = 0;
|
||||||
v4[12] = 0;
|
v4[12] = 0;
|
||||||
@ -15962,16 +15969,16 @@ struct _Unwind_Exception *__thiscall night::NSToken::read_string(night::NSStream
|
|||||||
void *v12[8]; // [esp+78h] [ebp-20h] BYREF
|
void *v12[8]; // [esp+78h] [ebp-20h] BYREF
|
||||||
|
|
||||||
night::NSStream::next(v12, this[1]);
|
night::NSStream::next(v12, this[1]);
|
||||||
v11 = 0;
|
v10[0] = &v11; // std::string
|
||||||
v10[0] = &v11;
|
|
||||||
v10[1] = 0;
|
v10[1] = 0;
|
||||||
|
v11 = 0;
|
||||||
for ( i = 0; ; i = v4 )
|
for ( i = 0; ; i = v4 )
|
||||||
{
|
{
|
||||||
v4 = night::NSStream::eof(this[1]);
|
v4 = night::NSStream::eof(this[1]);
|
||||||
if ( v4 )
|
if ( v4 )
|
||||||
break;
|
break;
|
||||||
night::NSStream::next(v9, this[1]);
|
night::NSStream::next(v9, this[1]);
|
||||||
if ( LOBYTE(v9[0]) == 10 )
|
if ( LOBYTE(v9[0]) == '\n'/*10*/ )
|
||||||
{
|
{
|
||||||
if ( !i )
|
if ( !i )
|
||||||
{
|
{
|
||||||
@ -15984,7 +15991,7 @@ struct _Unwind_Exception *__thiscall night::NSToken::read_string(night::NSStream
|
|||||||
{
|
{
|
||||||
if ( !i )
|
if ( !i )
|
||||||
{
|
{
|
||||||
if ( LOBYTE(v9[0]) == 92 )
|
if ( LOBYTE(v9[0]) == '\\'/*92*/ )
|
||||||
{
|
{
|
||||||
v4 = 1;
|
v4 = 1;
|
||||||
std::string::push_back(v10, 92);
|
std::string::push_back(v10, 92);
|
||||||
@ -16222,7 +16229,7 @@ unsigned __int8 **__fastcall night::NSToken::read_next(int a1)
|
|||||||
{
|
{
|
||||||
night::NSStream::peek(v13, *(night::NSStream **)(a1 + 4));
|
night::NSStream::peek(v13, *(night::NSStream **)(a1 + 4));
|
||||||
v8 = v13[0];
|
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);
|
string = night::NSToken::read_string((night::NSStream **)a1, v13[0], (int)v14);
|
||||||
}
|
}
|
||||||
@ -16290,7 +16297,7 @@ unsigned __int8 **__fastcall night::NSToken::read_next(int a1)
|
|||||||
}
|
}
|
||||||
v7 = (unsigned __int8 **)string;
|
v7 = (unsigned __int8 **)string;
|
||||||
}
|
}
|
||||||
LABEL_19:
|
LABEL_19:
|
||||||
std::string::_M_dispose(v14);
|
std::string::_M_dispose(v14);
|
||||||
return v7;
|
return v7;
|
||||||
}
|
}
|
||||||
@ -20605,17 +20612,17 @@ int __cdecl night::compile_ns(int a1, int a2, int a3, int a4, unsigned int *a5,
|
|||||||
std::string::basic_string((char *)v29, a1);
|
std::string::basic_string((char *)v29, a1);
|
||||||
night::NSASTParse::NSASTParse((int)v39, (int)v29, (int)v27, (int)v17);
|
night::NSASTParse::NSASTParse((int)v39, (int)v29, (int)v27, (int)v17);
|
||||||
std::string::_M_dispose(v29);
|
std::string::_M_dispose(v29);
|
||||||
v29[1] = 0; // v29.offset_4
|
|
||||||
v29[0] = &v30; // v29.offset_0 std::string缓冲区
|
v29[0] = &v30; // v29.offset_0 std::string缓冲区
|
||||||
v31 = v39; // v29.offset_12
|
v29[1] = 0; // v29.offset_4
|
||||||
v19[0] = &v20;
|
|
||||||
v30 = 0; // v29.offset_8
|
v30 = 0; // v29.offset_8
|
||||||
|
v31 = v39; // v29.offset_24 = v39
|
||||||
|
v32 = 0; // v29.offset_16
|
||||||
|
v33 = 0; // v29.offset_20
|
||||||
v34 = 0; // v29.offset_24
|
v34 = 0; // v29.offset_24
|
||||||
v35 = 0; // v29.offset_28
|
v35 = 0; // v29.offset_28
|
||||||
v36 = 0; // v29.offset_32
|
v36 = 0; // v29.offset_32
|
||||||
v32 = 0; // v29.offset_16
|
|
||||||
v33 = 0; // v29.offset_20
|
|
||||||
v37 = 1; // v29.offset_36
|
v37 = 1; // v29.offset_36
|
||||||
|
v19[0] = &v20;
|
||||||
v19[1] = 0;
|
v19[1] = 0;
|
||||||
v20 = 0;
|
v20 = 0;
|
||||||
memset(v18, 0, sizeof(v18));
|
memset(v18, 0, sizeof(v18));
|
||||||
@ -21645,7 +21652,7 @@ int __cdecl night::str::path_combine(_DWORD *a1, _DWORD *a2, int a3)
|
|||||||
int v17[5]; // [esp+90h] [ebp-18h] BYREF
|
int v17[5]; // [esp+90h] [ebp-18h] BYREF
|
||||||
|
|
||||||
v12 = 0;
|
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;
|
v13 = 0;
|
||||||
lpuexcpt = MMBizWxaAppComm::PathCombine(a1, a2, (unsigned int *)&v11);
|
lpuexcpt = MMBizWxaAppComm::PathCombine(a1, a2, (unsigned int *)&v11);
|
||||||
if ( !lpuexcpt )
|
if ( !lpuexcpt )
|
||||||
@ -21710,7 +21717,7 @@ int __cdecl night::str::get_token(int a1, _DWORD *a2, unsigned int a3)
|
|||||||
{
|
{
|
||||||
char v3; // al
|
char v3; // al
|
||||||
|
|
||||||
*(_DWORD *)(a1 + 4) = 0;
|
*(_DWORD *)(a1 + 4) = 0; // std::string
|
||||||
*(_DWORD *)a1 = a1 + 8;
|
*(_DWORD *)a1 = a1 + 8;
|
||||||
*(_BYTE *)(a1 + 8) = 0;
|
*(_BYTE *)(a1 + 8) = 0;
|
||||||
while ( a3 < a2[1] )
|
while ( a3 < a2[1] )
|
||||||
@ -53938,10 +53945,10 @@ char __cdecl night::NSToken::tk_is_comment2(night::NSToken *this, night::NSStrea
|
|||||||
int v5[4]; // [esp+34h] [ebp-14h] BYREF
|
int v5[4]; // [esp+34h] [ebp-14h] BYREF
|
||||||
|
|
||||||
night::NSStream::peek(v3, a2);
|
night::NSStream::peek(v3, a2);
|
||||||
if ( LOBYTE(v3[0]) != 42 )
|
if ( LOBYTE(v3[0]) != '*'/*42*/ )
|
||||||
return 1;
|
return 1;
|
||||||
night::NSStream::peek_2(v4, a2);
|
night::NSStream::peek_2(v4, a2);
|
||||||
if ( LOBYTE(v4[0]) != 47 )
|
if ( LOBYTE(v4[0]) != '/'/*47*/ )
|
||||||
return 1;
|
return 1;
|
||||||
night::NSStream::next(v5, a2);
|
night::NSStream::next(v5, a2);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user