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
e90fa63ebf
commit
4f705a100d
@ -91,6 +91,7 @@ namespace WXML
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
|
int offset_0;
|
||||||
int offset_16;
|
int offset_16;
|
||||||
int offset_20;
|
int offset_20;
|
||||||
bool offset_28;
|
bool offset_28;
|
||||||
@ -101,6 +102,7 @@ namespace WXML
|
|||||||
Token(/* args */);
|
Token(/* args */);
|
||||||
Token(WXML::DOMLib::Token&&);
|
Token(WXML::DOMLib::Token&&);
|
||||||
Token(WXML::DOMLib::Token const&);
|
Token(WXML::DOMLib::Token const&);
|
||||||
|
~Token();
|
||||||
std::string ToString();
|
std::string ToString();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,7 +113,6 @@ namespace WXML
|
|||||||
bool IsValidVariableName(std::string const&);
|
bool IsValidVariableName(std::string const&);
|
||||||
bool IsMatch(char const*);
|
bool IsMatch(char const*);
|
||||||
bool GetTemplateContent(std::string const&, std::string&);
|
bool GetTemplateContent(std::string const&, std::string&);
|
||||||
~Token();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ParseException
|
class ParseException
|
||||||
@ -128,15 +129,15 @@ namespace WXML
|
|||||||
private:
|
private:
|
||||||
/* data */
|
/* data */
|
||||||
static bool bInited; // 初始化标志
|
static bool bInited; // 初始化标志
|
||||||
static int * TT; //类型不确定
|
static int TT[0x101000u]; //类型不确定
|
||||||
static int * STT;
|
static int STT[0x80];
|
||||||
int offset_0; // offset + 0
|
int fileLength = 0; // offset + 0
|
||||||
int offset_1; // offset + 1
|
int offset_1 = 0; // offset + 1
|
||||||
int lineCount;// 当前处理的行数 offset + 2
|
int lineCount = 0;// 当前处理的行数 offset + 2
|
||||||
int lineLength; // 正在处理行的长度 offset + 3
|
int lineLength = 0; // 正在处理行的长度 offset + 3
|
||||||
int offset_4; // offset + 4
|
int offset_4 = 0; // offset + 4
|
||||||
int offset_5; // offset + 5
|
int offset_5 = 0; // offset + 5
|
||||||
int offset_6; // offset + 6
|
int offset_6 = 0; // offset + 6
|
||||||
std::string filePath; // 文件路径 offset + 7 this+28
|
std::string filePath; // 文件路径 offset + 7 this+28
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -204,7 +205,12 @@ namespace WXML
|
|||||||
std::map<std::string, WXML::DOMLib::Token> offset_12;
|
std::map<std::string, WXML::DOMLib::Token> offset_12;
|
||||||
WXMLDom(/* args */);
|
WXMLDom(/* args */);
|
||||||
~WXMLDom();
|
~WXMLDom();
|
||||||
void Error();
|
std::string Error(
|
||||||
|
std::string const& a2,
|
||||||
|
WXML::DOMLib::Token const& a3,
|
||||||
|
std::string const& a4,
|
||||||
|
std::string const& a5
|
||||||
|
);
|
||||||
void RenderMeAsFunction(
|
void RenderMeAsFunction(
|
||||||
std::string const&,
|
std::string const&,
|
||||||
std::string const&,
|
std::string const&,
|
||||||
@ -276,12 +282,12 @@ namespace WXML
|
|||||||
std::shared_ptr<WXML::DOMLib::WXMLDom> dom;
|
std::shared_ptr<WXML::DOMLib::WXMLDom> dom;
|
||||||
std::deque<std::string> dequeStr;
|
std::deque<std::string> dequeStr;
|
||||||
std::vector<WXML::DOMLib::Token> tokenList;
|
std::vector<WXML::DOMLib::Token> tokenList;
|
||||||
int peekIndex = 0;
|
int peekIndex = 0; // _DWORD * a1[25], *((_DWORD *)a1 + 25)
|
||||||
int offset_4;
|
int offset_4;
|
||||||
int offset_8;
|
int offset_8; // _DWORD * a1[8]
|
||||||
int offset_128;
|
int offset_128;
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
std::deque<std::shared_ptr<WXML::DOMLib::WXMLDom>> dequeDom;
|
std::deque<std::shared_ptr<WXML::DOMLib::WXMLDom>> dequeDom; // int a1 + 48, _DWORD * a1 + 12
|
||||||
int v8;
|
int v8;
|
||||||
public:
|
public:
|
||||||
Parser(/* args */);
|
Parser(/* args */);
|
||||||
@ -304,8 +310,8 @@ namespace WXML
|
|||||||
std::shared_ptr<DOMLib::WXMLDom> GetParsed();
|
std::shared_ptr<DOMLib::WXMLDom> GetParsed();
|
||||||
void DOM();
|
void DOM();
|
||||||
void DOMS();
|
void DOMS();
|
||||||
std::vector<std::string> ATTR_LIST();
|
void ATTR_LIST();
|
||||||
std::string ATTR();
|
void ATTR();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "../include/wxml.h"
|
#include "../include/wxml.h"
|
||||||
#include "../include/define.h"
|
#include "../include/define.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <set>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
namespace WXML{
|
namespace WXML{
|
||||||
@ -237,17 +238,32 @@ namespace WXML{
|
|||||||
auto it = ssDataMap.lower_bound(splitedData[i]);
|
auto it = ssDataMap.lower_bound(splitedData[i]);
|
||||||
if (it == ssDataMap.end())
|
if (it == ssDataMap.end())
|
||||||
{
|
{
|
||||||
|
ssDataMap.insert({splitedData[i], v328_ss});
|
||||||
}
|
}
|
||||||
std::string path = "./" + splitedData[i] + ".wxml";
|
std::string path = "./" + splitedData[i] + ".wxml";
|
||||||
std::vector<std::string> j;
|
std::vector<std::string> j;
|
||||||
j.push_back(path);
|
j.push_back(path);
|
||||||
v307_localVecStrMap1[splitedData[i]] = j;
|
v307_localVecStrMap1[splitedData[i]] = j;
|
||||||
}
|
}
|
||||||
// for (auto it = splitedData.begin(); it != splitedData.end(); it++)
|
std::set<std::string> temp;
|
||||||
|
for (int i = 0 ; i < splitedData.size(); i++)
|
||||||
|
{
|
||||||
|
temp.insert(splitedData[i]);
|
||||||
|
}
|
||||||
|
for (auto it = splitedData.begin(); it != splitedData.end(); it++)
|
||||||
|
{
|
||||||
|
auto str = it->substr(2, it->size() - 7);
|
||||||
|
}
|
||||||
|
std::stringstream info;
|
||||||
|
info << "WXML::Compiler::CompileLazy: file name to paths:\n";
|
||||||
|
info << " all files: [ ";
|
||||||
|
// for (size_t i = 0; i < count; i++)
|
||||||
// {
|
// {
|
||||||
|
// /* code */
|
||||||
// }
|
// }
|
||||||
|
info << "];\n";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,18 @@ namespace WXML
|
|||||||
|
|
||||||
Machine::Machine(std::string const& filePath)
|
Machine::Machine(std::string const& filePath)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
DC F2 97 00 E8 00 F1 00 70 BB F0 00 0B(起点) 00 00 00(总长度)
|
||||||
|
06 00 00 00 01 00 00 00(+2行数) 0B 00 00 00(+3当前行长度) 01 00 00 00
|
||||||
|
06 00 00 00 06 00 00 00 98 00 F1 00(+7文件路径) 30 00 00 00
|
||||||
|
30 00 00 00 A0 3A 53 00 94 8B 53 00 18 F3 97 00
|
||||||
|
20 09 47 00 C0 F2 97 00 00 B4 75 FA 88 91 F0 00
|
||||||
|
2A 00 00 00 5C FC 97 00 98 F7 97 00 58 56 40 00
|
||||||
|
B8 93 F0 00 88 FC 97 00 98 91 F0 00 94 F3 97 00
|
||||||
|
42 04 04 42 00 00 F0 00 EC 02 04 EA 7F 00 00 00
|
||||||
|
D8 F4 97 00 00 00 F0 00 0A 00 04 06 70 00 00 00
|
||||||
|
42 04 04 42 0A 00 00 00 01 00 00 00 7C F8 97 00
|
||||||
|
*/
|
||||||
InitTransitTable();
|
InitTransitTable();
|
||||||
this->filePath.assign(filePath);
|
this->filePath.assign(filePath);
|
||||||
}
|
}
|
||||||
@ -39,8 +51,12 @@ namespace WXML
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
bool Machine::bInited = false;
|
bool Machine::bInited = false;
|
||||||
int * Machine::TT = nullptr;
|
/*
|
||||||
int * Machine::STT = nullptr;
|
WXML::DOMLib::Machine::TT 00567560
|
||||||
|
WXML::DOMLib::Machine::TT 00668560
|
||||||
|
*/
|
||||||
|
int Machine::TT[0x101000u];
|
||||||
|
int Machine::STT[0x80] = {0};
|
||||||
|
|
||||||
void Machine::InitTransitTable()
|
void Machine::InitTransitTable()
|
||||||
{
|
{
|
||||||
@ -48,13 +64,237 @@ namespace WXML
|
|||||||
if (!this->bInited)
|
if (!this->bInited)
|
||||||
{
|
{
|
||||||
this->bInited = true;
|
this->bInited = true;
|
||||||
std::string v0 = "\n\t\r";
|
char * v0 = " \n\t\r";
|
||||||
// memset(&this->TT, 0, 0x101000u);
|
memset(&this->TT, 0, 0x101000u);
|
||||||
|
|
||||||
|
// dword_5806EC = 99;
|
||||||
|
this->TT[ 0x5806EC - 0x00567560] = 99;
|
||||||
|
// dword_567A54 = 131074;
|
||||||
|
this->TT[ 0x567A54 - 0x00567560] = 131074;
|
||||||
|
// dword_567B50 = 15;
|
||||||
|
this->TT[ 0x567B50 - 0x00567560] = 15;
|
||||||
|
// dword_567D64 = 1;
|
||||||
|
this->TT[ 0x567D64 - 0x00567560] = 1;
|
||||||
|
// dword_567964 = 131171;
|
||||||
|
this->TT[ 0x567964 - 0x00567560] = 131171;
|
||||||
|
// dword_56B388 = 16;
|
||||||
|
this->TT[ 0x56B388 - 0x00567560] = 16;
|
||||||
|
// dword_56B59C = 1;
|
||||||
|
this->TT[ 0x56B59C - 0x00567560] = 1;
|
||||||
|
// dword_56B794 = 17;
|
||||||
|
this->TT[ 0x56B794 - 0x00567560] = 17;
|
||||||
|
this->TT[ 0x56B5A0 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56B9A0 - 0x00567560] = 16;
|
||||||
|
this->TT[ 0x56BB98 - 0x00567560] = 1;
|
||||||
|
this->TT[ 0x56BDA4 - 0x00567560] = 1048592;
|
||||||
|
this->TT[ 0x56B628 - 0x00567560] = 11;
|
||||||
|
this->TT[ 0x56B63C - 0x00567560] = 13;
|
||||||
|
this->TT[ 0x56A2FC - 0x00567560] = 12;
|
||||||
|
this->TT[ 0x56A990 - 0x00567560] = 11;
|
||||||
|
this->TT[ 0x56A214 - 0x00567560] = 16;
|
||||||
|
this->TT[ 0x56A18C - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56A58C - 0x00567560] = 11;
|
||||||
|
this->TT[ 0x56AB04 - 0x00567560] = 14;
|
||||||
|
this->TT[ 0x56B198 - 0x00567560] = 13;
|
||||||
|
this->TT[ 0x56AA30 - 0x00567560] = 16;
|
||||||
|
this->TT[ 0x56A994 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56AD94 - 0x00567560] = 13;
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
char v1 = *v0;
|
||||||
|
if (!v1)
|
||||||
|
break;
|
||||||
|
this->TT[ 0x567D68 - 0x00567560 + v1] = 655363;
|
||||||
|
v0++;
|
||||||
|
}
|
||||||
|
for (char * i = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:"; ; ++i )
|
||||||
|
{
|
||||||
|
char v3 = *i;
|
||||||
|
if ( !v3 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x567D68 - 0x00567560 + v3] = 131076;
|
||||||
|
}
|
||||||
|
this->TT[ 0x567E24 - 0x00567560] = 262147;
|
||||||
|
char *v4 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:";
|
||||||
|
this->TT[ 0x567DEC - 0x00567560] = 33;
|
||||||
|
this->TT[ 0x567F44 - 0x00567560] = 22;
|
||||||
|
this->TT[ 0x568168 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56FA98 - 0x00567560] = 34;
|
||||||
|
this->TT[ 0x56FDE4 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56FE9C - 0x00567560] = 19;
|
||||||
|
this->TT[ 0x5701E8 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56C260 - 0x00567560] = 20;
|
||||||
|
this->TT[ 0x56C5AC - 0x00567560] = 19;
|
||||||
|
this->TT[ 0x56C664 - 0x00567560] = 21;
|
||||||
|
this->TT[ 0x56C9B0 - 0x00567560] = 19;
|
||||||
|
this->TT[ 0x56CAAC - 0x00567560] = 524289;
|
||||||
|
this->TT[ 0x56CA68 - 0x00567560] = 21;
|
||||||
|
this->TT[ 0x56CDB4 - 0x00567560] = 19;
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
char v5 = *v4;
|
||||||
|
if ( !v5 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x567D68 - 0x00567560 + v5] = 4;
|
||||||
|
++v4;
|
||||||
|
}
|
||||||
|
for (char * j = "0123456789"; ; ++j )
|
||||||
|
{
|
||||||
|
char v7 = *j;
|
||||||
|
if ( !v7 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x567D68 - 0x00567560 + v7] = 4;
|
||||||
|
}
|
||||||
|
for (char* k = " \n\t\r"; ; ++k )
|
||||||
|
{
|
||||||
|
char v9 = *k;
|
||||||
|
if ( !v9 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x567D68 - 0x00567560 + v9] = 655363;
|
||||||
|
}
|
||||||
|
this->TT[ 0x568664 - 0x00567560] = 131078;
|
||||||
|
char *v10 = " \n\t\r";
|
||||||
|
this->TT[ 0x5685F8 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x568668 - 0x00567560] = 393217;
|
||||||
|
this->TT[ 0x56862C - 0x00567560] = 131090;
|
||||||
|
this->TT[ 0x568970 - 0x00567560] = 131075;
|
||||||
|
this->TT[ 0x568570 - 0x00567560] = -1;
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
char v11 = *v10;
|
||||||
|
if ( !v11 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x568D78 - 0x00567560 + v11] = 655363;
|
||||||
|
++v10;
|
||||||
|
}
|
||||||
|
for ( char *m = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:"; ; ++m )
|
||||||
|
{
|
||||||
|
char v13 = *m;
|
||||||
|
if ( !v13 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x568D78 - 0x00567560 + v13] = 131077;
|
||||||
|
}
|
||||||
|
this->TT[ 0x568E00 - 0x00567560] = 131077;
|
||||||
|
char *v14 = " \n\t\r";
|
||||||
|
this->TT[ 0x568E14 - 0x00567560] = 131081;
|
||||||
|
this->TT[ 0x568D78 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x569178 - 0x00567560] = -1;
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
char v15 = *v14;
|
||||||
|
if ( !v15 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x56816C - 0x00567560 + v15] = 524291;
|
||||||
|
++v14;
|
||||||
|
}
|
||||||
|
for ( char* n = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:"; ; ++n )
|
||||||
|
{
|
||||||
|
char v17 = *n;
|
||||||
|
if ( !v17 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x56816C - 0x00567560 + v17] = 4;
|
||||||
|
}
|
||||||
|
for ( char* ii = "0123456789"; ; ++ii )
|
||||||
|
{
|
||||||
|
char v19 = *ii;
|
||||||
|
if ( !v19 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x56816C - 0x00567560 + v19] = -1;
|
||||||
|
}
|
||||||
|
this->TT[ 0x56825C - 0x00567560] = -1;
|
||||||
|
char *v20 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-:";
|
||||||
|
this->TT[ 0x5681F4 - 0x00567560] = 5;
|
||||||
|
this->TT[ 0x568208 - 0x00567560] = 9;
|
||||||
|
this->TT[ 0x568228 - 0x00567560] = 18;
|
||||||
|
this->TT[ 0x568264 - 0x00567560] = 262145;
|
||||||
|
this->TT[ 0x568260 - 0x00567560] = 6;
|
||||||
|
this->TT[ 0x56816C - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56856C - 0x00567560] = -1;
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
char v21 = *v20;
|
||||||
|
if ( !v21 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x56BDA8 - 0x00567560 + v21] = 131076;
|
||||||
|
++v20;
|
||||||
|
}
|
||||||
|
this->TT[ 0x56BEA0 - 0x00567560] = 262145;
|
||||||
|
char *v22 = " \n\t\r";
|
||||||
|
this->TT[ 0x56C1A8 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x568AE4 - 0x00567560] = 7;
|
||||||
|
this->TT[ 0x56899C - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56957C - 0x00567560] = 5;
|
||||||
|
this->TT[ 0x5691A4 - 0x00567560] = 655363;
|
||||||
|
this->TT[ 0x5689FC - 0x00567560] = 262147;
|
||||||
|
this->TT[ 0x568974 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x568D74 - 0x00567560] = 5;
|
||||||
|
this->TT[ 0x569AF4 - 0x00567560] = 10;
|
||||||
|
this->TT[ 0x5699AC - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x56A188 - 0x00567560] = 9;
|
||||||
|
this->TT[ 0x569DB0 - 0x00567560] = 655363;
|
||||||
|
this->TT[ 0x569A20 - 0x00567560] = 262147;
|
||||||
|
this->TT[ 0x569984 - 0x00567560] = -1;
|
||||||
|
this->TT[ 0x569D84 - 0x00567560] = 9;
|
||||||
|
this->TT[ 0x56CF98 - 0x00567560] = 23;
|
||||||
|
this->TT[ 0x56D1B8 - 0x00567560] = 3145732;
|
||||||
|
this->TT[ 0x56D388 - 0x00567560] = 24;
|
||||||
|
this->TT[ 0x56D5BC - 0x00567560] = 3145732;
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
char v23 = *v22;
|
||||||
|
if ( !v23 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x56D5C0 - 0x00567560 + v23] = 25;
|
||||||
|
++v22;
|
||||||
|
}
|
||||||
|
this->TT[ 0x56D6B8 - 0x00567560] = 31;
|
||||||
|
char *v24 = " \n\t\r";
|
||||||
|
this->TT[ 0x56D9C0 - 0x00567560] = 3145732;
|
||||||
|
this->TT[ 0x56DABC - 0x00567560] = 31;
|
||||||
|
this->TT[ 0x56DA80 - 0x00567560] = 32;
|
||||||
|
this->TT[ 0x56DDC4 - 0x00567560] = 25;
|
||||||
|
this->TT[ 0x56F6D8 - 0x00567560] = 262145;
|
||||||
|
this->TT[ 0x56F9E0 - 0x00567560] = 1048601;
|
||||||
|
this->TT[ 0x56F2CC - 0x00567560] = 131098;
|
||||||
|
this->TT[ 0x56F5DC - 0x00567560] = 31;
|
||||||
|
this->TT[ 0x56DE84 - 0x00567560] = 27;
|
||||||
|
this->TT[ 0x56E1C8 - 0x00567560] = 0x50001E + 1;
|
||||||
|
this->TT[ 0x56E3A8 - 0x00567560] = 28;
|
||||||
|
this->TT[ 0x56E5CC - 0x00567560] = 0x50001E + 1;
|
||||||
|
this->TT[ 0x56E7B0 - 0x00567560] = 29;
|
||||||
|
this->TT[ 0x56E9D0 - 0x00567560] = 0x50001E + 1;
|
||||||
|
this->TT[ 0x56EBA0 - 0x00567560] = 30;
|
||||||
|
this->TT[ 0x56EDD4 - 0x00567560] = 0x50001E + 1;
|
||||||
|
while ( 1 )
|
||||||
|
{
|
||||||
|
char v25 = *v24;
|
||||||
|
if ( !v25 )
|
||||||
|
break;
|
||||||
|
this->TT[ 0x56EDD8 - 0x00567560 + v25] = 30;
|
||||||
|
++v24;
|
||||||
|
}
|
||||||
|
this->TT[ 0x56EED0 - 0x00567560] = 524289;
|
||||||
|
this->TT[ 0x56F1D8 - 0x00567560] = -1;
|
||||||
|
/*
|
||||||
|
0x00566560
|
||||||
|
1 - 1
|
||||||
|
2 - 0
|
||||||
|
3 - 0
|
||||||
|
4 - 0
|
||||||
|
5 - 2
|
||||||
|
6 - 0
|
||||||
|
*/
|
||||||
|
this->STT[0x566564 - 0x00566560] = 1;
|
||||||
|
this->STT[0x566574 - 0x00566560] = 2;
|
||||||
|
this->STT[0x566584 - 0x00566560] = 2;
|
||||||
|
this->STT[0x5665DC - 0x00566560] = 3;
|
||||||
|
this->STT[0x5665E0 - 0x00566560] = 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int dword_567960[1000] = {0};
|
int dword_567960[1000] = {0};
|
||||||
void Machine::Feed(
|
void Machine::Feed(
|
||||||
char c,
|
char inputChar,
|
||||||
std::vector<WXML::DOMLib::Token> & a3,
|
std::vector<WXML::DOMLib::Token> & a3,
|
||||||
std::string &errorMessage,
|
std::string &errorMessage,
|
||||||
std::vector<WXML::DOMLib::Token> & a5,
|
std::vector<WXML::DOMLib::Token> & a5,
|
||||||
@ -64,16 +304,17 @@ namespace WXML
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
/* code */
|
/* code */
|
||||||
if (c == '\n')
|
if (inputChar == '\n')
|
||||||
{
|
{
|
||||||
// 一行结束,行数加一,长度变0
|
// 一行结束,行数加一,长度变0
|
||||||
this->lineCount++;
|
this->lineCount++;
|
||||||
this->lineLength = 0;
|
this->lineLength = 0;
|
||||||
}
|
}
|
||||||
|
int v46;
|
||||||
int v45 = this->offset_6;
|
int v45;
|
||||||
int v46 = this->TT[257 * this->offset_6 + c];
|
|
||||||
do{
|
do{
|
||||||
|
v46 = this->TT[257 * this->offset_6 + inputChar];
|
||||||
|
v45 = this->offset_6;
|
||||||
if (!v46)
|
if (!v46)
|
||||||
{
|
{
|
||||||
v46 = dword_567960[257 * v45];
|
v46 = dword_567960[257 * v45];
|
||||||
@ -81,7 +322,7 @@ namespace WXML
|
|||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "BAD STATE MACHINE! AT INPUT ";
|
ss << "BAD STATE MACHINE! AT INPUT ";
|
||||||
ss << this->offset_6 << " " << c;
|
ss << this->offset_6 << " " << inputChar;
|
||||||
errorMessage = ss.str();
|
errorMessage = ss.str();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -92,9 +333,9 @@ namespace WXML
|
|||||||
ss << this->filePath << ":";
|
ss << this->filePath << ":";
|
||||||
ss << this->lineCount << ":";
|
ss << this->lineCount << ":";
|
||||||
ss << this->lineLength << ":";
|
ss << this->lineLength << ":";
|
||||||
if (c)
|
if (inputChar)
|
||||||
{
|
{
|
||||||
ss << "unexpected character `" << c << "`";
|
ss << "unexpected character `" << inputChar << "`";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -107,7 +348,7 @@ namespace WXML
|
|||||||
if (bittest(&v46, 0x15u))
|
if (bittest(&v46, 0x15u))
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
if (this->offset_0 > this->offset_1)
|
if (this->fileLength > this->offset_1)
|
||||||
{
|
{
|
||||||
this->offset_1++;
|
this->offset_1++;
|
||||||
this->offset_5++;
|
this->offset_5++;
|
||||||
@ -119,7 +360,7 @@ namespace WXML
|
|||||||
if (bittest(&v46, 0x16u))
|
if (bittest(&v46, 0x16u))
|
||||||
{
|
{
|
||||||
// TODO:
|
// TODO:
|
||||||
WXML::DOMLib::Token token;
|
WXML::DOMLib::Token token(a5[0]);
|
||||||
// this->offset_4 = this->offset_4 - 112;
|
// this->offset_4 = this->offset_4 - 112;
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
@ -131,9 +372,9 @@ namespace WXML
|
|||||||
|
|
||||||
if (bittest(&v46, 0x11u))
|
if (bittest(&v46, 0x11u))
|
||||||
{
|
{
|
||||||
if (this->offset_1 < this->offset_0)
|
if (this->offset_1 < this->fileLength)
|
||||||
{
|
{
|
||||||
this->offset_1 = this->offset_0;
|
this->offset_1 = this->fileLength;
|
||||||
this->offset_5 = this->lineLength;
|
this->offset_5 = this->lineLength;
|
||||||
this->offset_4 = this->lineCount;
|
this->offset_4 = this->lineCount;
|
||||||
|
|
||||||
@ -151,11 +392,11 @@ namespace WXML
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->offset_0++;
|
this->fileLength++;
|
||||||
this->lineLength++;
|
this->lineLength++;
|
||||||
if (bittest(&v46, 0x12u))
|
if (bittest(&v46, 0x12u))
|
||||||
{
|
{
|
||||||
this->offset_1 = this->offset_0;
|
this->offset_1 = this->fileLength;
|
||||||
this->offset_5 = this->lineLength;
|
this->offset_5 = this->lineLength;
|
||||||
this->offset_4 = this->lineCount;
|
this->offset_4 = this->lineCount;
|
||||||
if (WXML::DOMLib::Machine::STT[v45] == 3)
|
if (WXML::DOMLib::Machine::STT[v45] == 3)
|
||||||
@ -172,7 +413,7 @@ namespace WXML
|
|||||||
v46 &= 0x80000u;
|
v46 &= 0x80000u;
|
||||||
if (v46)
|
if (v46)
|
||||||
{
|
{
|
||||||
offset_1 = offset_0;
|
offset_1 = fileLength;
|
||||||
offset_5 = lineLength;
|
offset_5 = lineLength;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -185,7 +426,13 @@ namespace WXML
|
|||||||
}
|
}
|
||||||
void Machine::Reset()
|
void Machine::Reset()
|
||||||
{
|
{
|
||||||
|
this->fileLength = 0;
|
||||||
|
this->offset_1 = 0;
|
||||||
|
this->lineCount = 1;
|
||||||
|
this->lineLength = 1;
|
||||||
|
this->offset_4 = 1;
|
||||||
|
this->offset_5 = 1;
|
||||||
|
this->offset_6 = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,63 @@ namespace WXML
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Parser::ATTR()
|
||||||
|
{
|
||||||
|
auto token = this->Peek();
|
||||||
|
if (!token.IsMatch(">")
|
||||||
|
&& !token.IsMatch("/>"))
|
||||||
|
{
|
||||||
|
// if(!token)
|
||||||
|
// throw "unexpected attribute name"
|
||||||
|
int v20;
|
||||||
|
for (int i = 0; i < v20; i++)
|
||||||
|
{
|
||||||
|
char v3;
|
||||||
|
if ((v3 & 0xDF) - 'A' > 25
|
||||||
|
&& (v3 - '0') > 10
|
||||||
|
&& v3 != '_'
|
||||||
|
&& v3 != '-')
|
||||||
|
{
|
||||||
|
throw "unexpected attribute name";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (v20 - 1 > 0xFFFE)
|
||||||
|
{
|
||||||
|
throw "unexpected attribute name";
|
||||||
|
}
|
||||||
|
auto v4 = token.ToString();
|
||||||
|
this->peekIndex++;
|
||||||
|
auto v19 = this->Peek();
|
||||||
|
if (v19.IsMatch("="))
|
||||||
|
{
|
||||||
|
this->peekIndex++;
|
||||||
|
auto v6 = this->Peek();
|
||||||
|
int v22;
|
||||||
|
if (v22 == 2)
|
||||||
|
{
|
||||||
|
this->peekIndex++;
|
||||||
|
auto v7 = this->dequeDom.back();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto v9 = this->dequeDom.back();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Parser::ATTR_LIST()
|
||||||
|
{
|
||||||
|
this->ATTR();
|
||||||
|
auto token = this->Peek();
|
||||||
|
if (!token.IsMatch(">")
|
||||||
|
&& !token.IsMatch("/>"))
|
||||||
|
{
|
||||||
|
this->ATTR_LIST();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Parser::IsValidTag(std::string & tag)
|
bool Parser::IsValidTag(std::string & tag)
|
||||||
{
|
{
|
||||||
return tag.compare("wx-") != 0;
|
return tag.compare("wx-") != 0;
|
||||||
@ -36,8 +93,8 @@ namespace WXML
|
|||||||
if (!ret)
|
if (!ret)
|
||||||
{
|
{
|
||||||
std::shared_ptr<WXML::DOMLib::WXMLDom> domPtr;
|
std::shared_ptr<WXML::DOMLib::WXMLDom> domPtr;
|
||||||
this->dom->tag = "root";
|
domPtr->tag = "root";
|
||||||
domPtr.get()->tag = "root";
|
this->dom = domPtr;
|
||||||
dequeDom.push_back(domPtr);
|
dequeDom.push_back(domPtr);
|
||||||
// DOMS
|
// DOMS
|
||||||
this->DOMS();
|
this->DOMS();
|
||||||
@ -62,7 +119,7 @@ namespace WXML
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (token.IsMatch(""))
|
if (token.IsMatch("<"))
|
||||||
{
|
{
|
||||||
this->peekIndex++;
|
this->peekIndex++;
|
||||||
auto token = this->Peek();
|
auto token = this->Peek();
|
||||||
@ -72,7 +129,14 @@ namespace WXML
|
|||||||
throw this->Error("unexpected tag", 0);
|
throw this->Error("unexpected tag", 0);
|
||||||
}
|
}
|
||||||
this->peekIndex++;
|
this->peekIndex++;
|
||||||
|
// if (this->offset_8 == )
|
||||||
|
std::shared_ptr<WXML::DOMLib::WXMLDom> domPtr;
|
||||||
|
auto v8 = this->dequeDom.back();
|
||||||
|
// push_back
|
||||||
|
// push_back
|
||||||
|
this->ATTR_LIST();
|
||||||
|
auto v9 = this->Peek();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,9 +5,19 @@ namespace WXML
|
|||||||
{
|
{
|
||||||
namespace DOMLib
|
namespace DOMLib
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Token
|
||||||
|
00(起点) B6 BF 00(文件内容) 80 CC BF 00 01 00 00 00 01 00 00 00
|
||||||
|
01 00 00 00(pos) 04 00 00 00(size) 00 00 00 00 00(布尔值) F6 97 00
|
||||||
|
38 F0 97 00 00 00 00 00 00 CC FA 00 CC F0 97 00
|
||||||
|
00 00 BF 00 00 00 00 00 FF FF FF FF 54 F0 97 00
|
||||||
|
00 00 00 00 00 3A 53 00 00 00 00 00 78 F0 97 00
|
||||||
|
00 00 00 00 00 F2 97 00 70 F0 97 00 00 00 00 00
|
||||||
|
00 00 00 00 62 00 00 40 F8 F1 97 00 7A 15 46 00
|
||||||
|
*/
|
||||||
Token::Token(/* args */)
|
Token::Token(/* args */)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Token::Token(WXML::DOMLib::Token&& token)
|
Token::Token(WXML::DOMLib::Token&& token)
|
||||||
@ -26,7 +36,7 @@ namespace WXML
|
|||||||
}
|
}
|
||||||
std::string Token::ToString()
|
std::string Token::ToString()
|
||||||
{
|
{
|
||||||
std::string v4 = "";
|
std::string v4 = this->offset_32;
|
||||||
if (!this->offset_28)
|
if (!this->offset_28)
|
||||||
{
|
{
|
||||||
v4 = this->offset_32.substr(this->offset_16, this->offset_20);
|
v4 = this->offset_32.substr(this->offset_16, this->offset_20);
|
||||||
@ -35,9 +45,11 @@ namespace WXML
|
|||||||
return v4;
|
return v4;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Token::IsMatch(char const*)
|
bool Token::IsMatch(char const* str)
|
||||||
{
|
{
|
||||||
return true;
|
bool result = false;
|
||||||
|
// this->offset_20
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,5 +340,27 @@ namespace WXML {
|
|||||||
{
|
{
|
||||||
return this->tag.compare(tag) == 0;
|
return this->tag.compare(tag) == 0;
|
||||||
}
|
}
|
||||||
|
std::string WXMLDom::Error(
|
||||||
|
std::string const& a2,
|
||||||
|
WXML::DOMLib::Token const& a3,
|
||||||
|
std::string const& a4,
|
||||||
|
std::string const& a5
|
||||||
|
)
|
||||||
|
{
|
||||||
|
std::stringstream v15;
|
||||||
|
v15 << a2 << ":";
|
||||||
|
// v15 << a3.???1 << ":";
|
||||||
|
// v15 << a3.???2 << ":";
|
||||||
|
if (a4.length() > 0)
|
||||||
|
{
|
||||||
|
v15 << " Bad attr `" << a4 << "`";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v15 << " Bad value";
|
||||||
|
}
|
||||||
|
v15 << " with message: " << a5 << ".";
|
||||||
|
return v15.str();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user