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
|
@ -7560,19 +7560,63 @@ BfAstNode* BfReducer::CreateTopLevelObject(BfTokenNode* tokenNode, BfAttributeDi
|
|||
SetAndRestoreValue<BfVisitorPos> prevVisitorPos(mVisitorPos, BfVisitorPos(block));
|
||||
mVisitorPos.MoveNext();
|
||||
|
||||
BfAstNode* headNode = block->mChildArr.GetAs<BfAstNode*>(0);
|
||||
if (auto nameNode = BfNodeDynCast<BfIdentifierNode>(headNode))
|
||||
bool hadIllegal = false;
|
||||
bool inAssignment = false;
|
||||
|
||||
int checkIdx = 0;
|
||||
while (true)
|
||||
{
|
||||
auto nextNode = mVisitorPos.Get(1);
|
||||
if (auto nextToken = BfNodeDynCast<BfTokenNode>(nextNode))
|
||||
auto node = block->mChildArr.Get(checkIdx);
|
||||
if (node == NULL)
|
||||
break;
|
||||
|
||||
if (auto identifierNode = BfNodeDynCast<BfIdentifierNode>(node))
|
||||
{
|
||||
if ((nextToken->GetToken() == BfToken_Comma) || (nextToken->GetToken() == BfToken_AssignEquals))
|
||||
isSimpleEnum = true;
|
||||
// Allow
|
||||
}
|
||||
if (nextNode == NULL)
|
||||
isSimpleEnum = true;
|
||||
else if (auto tokenNode = BfNodeDynCast<BfTokenNode>(node))
|
||||
{
|
||||
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++;
|
||||
}
|
||||
break;
|
||||
|
||||
if (!hadIllegal)
|
||||
{
|
||||
isSimpleEnum = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
checkReadPos++;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue