mirror of
https://github.com/msojocs/wx-compiler.git
synced 2025-07-19 00:00:04 +08:00
fix: Tokenizer::GetTokens
This commit is contained in:
parent
7b37dcaabd
commit
c173f17062
@ -23,7 +23,9 @@ namespace WXSS
|
||||
class Token
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
/* data
|
||||
size: 92字节
|
||||
*/
|
||||
public:
|
||||
int offset_0 = 0;
|
||||
std::shared_ptr<std::string> offset_4;
|
||||
@ -31,7 +33,7 @@ namespace WXSS
|
||||
int offset_16 = 0;
|
||||
int offset_20 = 0;
|
||||
int offset_24 = 0;
|
||||
std::string offset_28;
|
||||
char offset_28[64];
|
||||
Token(/* args */);
|
||||
~Token();
|
||||
std::string GetLiteral(void);
|
||||
@ -46,8 +48,8 @@ namespace WXSS
|
||||
using STATE = int;
|
||||
static int TT[26113];
|
||||
static bool bInited;
|
||||
std::string offset_0;
|
||||
std::string offset_24;
|
||||
std::string offset_0; // 文件内容
|
||||
std::string offset_24; // 文件路径
|
||||
Tokenizer(/* args */);
|
||||
Tokenizer(char const*,std::string const&);
|
||||
~Tokenizer();
|
||||
|
@ -36,7 +36,11 @@ namespace WXSS
|
||||
this->offset_16 = old.offset_16;
|
||||
this->offset_20 = old.offset_20;
|
||||
this->offset_24 = old.offset_24;
|
||||
this->offset_28 = old.offset_28;
|
||||
for (int i = 0; i < 64; i++)
|
||||
{
|
||||
this->offset_28[i] = old.offset_28[i];
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
}
|
@ -332,13 +332,14 @@ namespace WXSS
|
||||
{
|
||||
v10 = 0;
|
||||
}
|
||||
int lt = this->TT[1024 * v4 + 2 * 10];
|
||||
v44 = v10;
|
||||
int lt = this->TT[1024 * v4 + 2 * v10];
|
||||
WXSS::TokenType AnotherTypeByAnySubStr;
|
||||
AnotherTypeByAnySubStr = this->TryGetAnotherTypeByAnySubStr(this->offset_0.data(), v47, v4, AnotherTypeByAnySubStr);
|
||||
|
||||
if (!lt)
|
||||
{
|
||||
lt = this->TT[1024 * v4];
|
||||
lt = this->TT[(0x522AA0 - 0x005222A0) / 4 + 1024 * v4];
|
||||
if (!lt)
|
||||
{
|
||||
std::stringstream v66;
|
||||
@ -350,7 +351,8 @@ namespace WXSS
|
||||
}
|
||||
if (lt == -1)
|
||||
break;
|
||||
if (lt & 0x30000 != 0)
|
||||
v4 = (int16_t)lt;
|
||||
if ((lt & 0x30000) != 0)
|
||||
{
|
||||
int v43 = ((lt & 0x20000) == 0) + v47 - 1;
|
||||
if ( !AnotherTypeByAnySubStr )
|
||||
@ -375,16 +377,17 @@ namespace WXSS
|
||||
}
|
||||
if (sa <= v43)
|
||||
{
|
||||
char dest[64];
|
||||
int v58 = AnotherTypeByAnySubStr;
|
||||
const char * v59 = nullptr;
|
||||
int v61 = sa;
|
||||
int v63 = v35;
|
||||
int v62 = ((lt & 0x20000) == 0) + v47 - sa;
|
||||
WXSS::Token v58;
|
||||
v58.offset_0 = AnotherTypeByAnySubStr;
|
||||
// const char * v59 = nullptr;
|
||||
v58.offset_12 = sa; // v61
|
||||
v58.offset_20 = v35;
|
||||
v58.offset_24 = v37;
|
||||
v58.offset_16 = ((lt & 0x20000) == 0) + v47 - sa;
|
||||
if (AnotherTypeByAnySubStr == 1)
|
||||
{
|
||||
strncpy(dest, &this->offset_0[sa], v62);
|
||||
dest[v43 - sa + 1] = 0;
|
||||
strncpy(v58.offset_28, &this->offset_0[sa], v58.offset_16);
|
||||
v58.offset_28[v43 - sa + 1] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -395,7 +398,7 @@ namespace WXSS
|
||||
{
|
||||
if (i == 10)
|
||||
{
|
||||
++v63;
|
||||
++v58.offset_20;
|
||||
}
|
||||
sa++;
|
||||
}
|
||||
@ -411,46 +414,47 @@ namespace WXSS
|
||||
}
|
||||
|
||||
}
|
||||
v61 = sa;
|
||||
v58.offset_12 = sa;
|
||||
int v39 = v38 - sa + 1;
|
||||
std::string str = this->offset_0.substr(sa, v39);
|
||||
v59 = str.data();
|
||||
v58.offset_4 = std::make_shared<std::string>(str);
|
||||
}
|
||||
if (v58 != 1)
|
||||
if (v58.offset_0 != 1)
|
||||
{
|
||||
if (!v59)
|
||||
if (!v58.offset_4.get())
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "pos: " << v47 << "f739 error" << std::endl;
|
||||
a3 = ss.str();
|
||||
return -1;
|
||||
}
|
||||
if (v58 == 4)
|
||||
if (v58.offset_0 == 4)
|
||||
{
|
||||
int v42 = 0;
|
||||
if (
|
||||
!strcasecmp(v59, "@media")
|
||||
|| !strcasecmp(v59, "@keyframes")
|
||||
|| !strcasecmp(v59, "@-webkit-keyframes")
|
||||
|| !strcasecmp(v59, "@supports")
|
||||
!strcasecmp(v58.offset_4->data(), "@media")
|
||||
|| !strcasecmp(v58.offset_4->data(), "@keyframes")
|
||||
|| !strcasecmp(v58.offset_4->data(), "@-webkit-keyframes")
|
||||
|| !strcasecmp(v58.offset_4->data(), "@supports")
|
||||
)
|
||||
{
|
||||
v42 = 24;
|
||||
v4 = 24;
|
||||
}
|
||||
const char *DIRECTIVES = "@import";
|
||||
for (int k = 0; DIRECTIVES[k]; k++)
|
||||
{
|
||||
if (!strcasecmp(v59, DIRECTIVES + k))
|
||||
if (!strcasecmp(v58.offset_4->data(), DIRECTIVES + k))
|
||||
{
|
||||
WXSS::Token v66;
|
||||
v66.offset_0 = 1;
|
||||
v66.offset_12 = v61;
|
||||
v66.offset_16 = v62;
|
||||
v66.offset_20 = v63;
|
||||
v66.offset_12 = v58.offset_12;
|
||||
v66.offset_16 = v58.offset_16;
|
||||
v66.offset_20 = v58.offset_20;
|
||||
v66.offset_24 = v37;
|
||||
v66.offset_28 = DIRECTIVES + k;
|
||||
// v66.offset_28 = DIRECTIVES + k;
|
||||
strcpy(v66.offset_28, DIRECTIVES + k);
|
||||
a2.push_back(v66);
|
||||
goto LABEL_77;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@ -458,8 +462,7 @@ namespace WXSS
|
||||
}
|
||||
}
|
||||
{
|
||||
WXSS::Token _v58;
|
||||
a2.push_back(_v58);
|
||||
a2.push_back(v58);
|
||||
}
|
||||
LABEL_77:
|
||||
sa = v43 + 1;
|
||||
|
@ -12436,14 +12436,14 @@ int __thiscall WXSS::Tokenizer::GetTokens(int *this, int a2, unsigned int **a3,
|
||||
const char **v55; // [esp+84h] [ebp-154h]
|
||||
volatile signed __int32 *v56; // [esp+88h] [ebp-150h] BYREF
|
||||
void *v57[6]; // [esp+8Ch] [ebp-14Ch] BYREF
|
||||
void *v58; // [esp+A4h] [ebp-134h] BYREF
|
||||
const char **v59; // [esp+A8h] [ebp-130h]
|
||||
volatile signed __int32 *v60; // [esp+ACh] [ebp-12Ch] BYREF
|
||||
char *v61; // [esp+B0h] [ebp-128h]
|
||||
unsigned int v62; // [esp+B4h] [ebp-124h]
|
||||
int v63; // [esp+B8h] [ebp-120h]
|
||||
int v64; // [esp+BCh] [ebp-11Ch]
|
||||
char Destination[64]; // [esp+C0h] [ebp-118h] BYREF
|
||||
void *v58; // [esp+A4h] [ebp-134h] BYREF v58.0ffset_0
|
||||
const char **v59; // [esp+A8h] [ebp-130h] v58.0ffset_4
|
||||
volatile signed __int32 *v60; // [esp+ACh] [ebp-12Ch] BYREF v58.0ffset_8
|
||||
char *v61; // [esp+B0h] [ebp-128h] v58.0ffset_12
|
||||
unsigned int v62; // [esp+B4h] [ebp-124h] v58.0ffset_16
|
||||
int v63; // [esp+B8h] [ebp-120h] v58.0ffset_20
|
||||
int v64; // [esp+BCh] [ebp-11Ch] v58.0ffset_24
|
||||
char Destination[64]; // [esp+C0h] [ebp-118h] BYREF v58.0ffset_28 28 + 64 = 92
|
||||
int v66; // [esp+100h] [ebp-D8h] BYREF
|
||||
volatile signed __int32 *v67; // [esp+104h] [ebp-D4h] BYREF
|
||||
volatile signed __int32 *v68; // [esp+108h] [ebp-D0h] BYREF
|
||||
@ -12555,14 +12555,14 @@ int __thiscall WXSS::Tokenizer::GetTokens(int *this, int a2, unsigned int **a3,
|
||||
}
|
||||
if ( (int)String1a <= v43 )
|
||||
{
|
||||
v58 = (void *)AnotherTypeByAnySubStr;
|
||||
v59 = 0;
|
||||
v61 = String1a;
|
||||
v58 = (void *)AnotherTypeByAnySubStr; // v58.0ffset_0
|
||||
v59 = 0; // v58.0ffset_4
|
||||
v61 = String1a; // v58.0ffset_12
|
||||
v60 = 0;
|
||||
v63 = v35;
|
||||
v63 = v35; // v58.0ffset_20
|
||||
Destination[0] = 0;
|
||||
v64 = v37;
|
||||
v62 = (((unsigned int)lpuexcpt & 0x20000) == 0) + v47 - (_DWORD)String1a;
|
||||
v64 = v37; // // v58.0ffset_24
|
||||
v62 = (((unsigned int)lpuexcpt & 0x20000) == 0) + v47 - (_DWORD)String1a; // v58.offset_16
|
||||
if ( AnotherTypeByAnySubStr == 1 )
|
||||
{
|
||||
strncpy(Destination, &String1a[v45], (((unsigned int)lpuexcpt & 0x20000) == 0) + v47 - (_DWORD)String1a);
|
||||
|
Loading…
x
Reference in New Issue
Block a user