mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Changed isSimpleEnum classification to be more permissive
This commit is contained in:
parent
5d4d21cce1
commit
32c09bf94b
1 changed files with 53 additions and 9 deletions
|
@ -7559,20 +7559,64 @@ BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDi
|
||||||
{
|
{
|
||||||
SetAndRestoreValue<BfVisitorPos> prevVisitorPos(mVisitorPos, BfVisitorPos(block));
|
SetAndRestoreValue<BfVisitorPos> prevVisitorPos(mVisitorPos, BfVisitorPos(block));
|
||||||
mVisitorPos.MoveNext();
|
mVisitorPos.MoveNext();
|
||||||
|
|
||||||
|
bool hadIllegal = false;
|
||||||
|
bool inAssignment = false;
|
||||||
|
|
||||||
BfAstNode* headNode = block->mChildArr.GetAs<BfAstNode*>(0);
|
int checkIdx = 0;
|
||||||
if (auto nameNode = BfNodeDynCast<BfIdentifierNode>(headNode))
|
while (true)
|
||||||
{
|
{
|
||||||
auto nextNode = mVisitorPos.Get(1);
|
auto node = block->mChildArr.Get(checkIdx);
|
||||||
if (auto nextToken = BfNodeDynCast<BfTokenNode>(nextNode))
|
if (node == NULL)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (auto identifierNode = BfNodeDynCast<BfIdentifierNode>(node))
|
||||||
{
|
{
|
||||||
if ((nextToken->GetToken() == BfToken_Comma) || (nextToken->GetToken() == BfToken_AssignEquals))
|
// Allow
|
||||||
isSimpleEnum = true;
|
|
||||||
}
|
}
|
||||||
if (nextNode == NULL)
|
else if (auto tokenNode = BfNodeDynCast<BfTokenNode>(node))
|
||||||
isSimpleEnum = true;
|
{
|
||||||
|
if (tokenNode->mToken == BfToken_Comma)
|
||||||
|
{
|
||||||
|
// Allow
|
||||||
|
inAssignment = false;
|
||||||
|
}
|
||||||
|
else if (tokenNode->mToken == BfToken_AssignEquals)
|
||||||
|
{
|
||||||
|
inAssignment = true;
|
||||||
|
}
|
||||||
|
else if (tokenNode->mToken == BfToken_Semicolon)
|
||||||
|
{
|
||||||
|
hadIllegal = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!inAssignment)
|
||||||
|
{
|
||||||
|
hadIllegal = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!inAssignment)
|
||||||
|
{
|
||||||
|
hadIllegal = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkIdx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hadIllegal)
|
||||||
|
{
|
||||||
|
isSimpleEnum = true;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkReadPos++;
|
checkReadPos++;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue