mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Comptime updates, start of metaprogramming support
This commit is contained in:
parent
be1c099f19
commit
3bbf2d8313
43 changed files with 1562 additions and 885 deletions
|
@ -341,6 +341,7 @@ BfParser::BfParser(BfSystem* bfSystem, BfProject* bfProject) : BfSource(bfSystem
|
|||
mAwaitingDelete = false;
|
||||
mScanOnly = false;
|
||||
mCompleteParse = false;
|
||||
mIsEmitted = false;
|
||||
mJumpTable = NULL;
|
||||
mProject = bfProject;
|
||||
mPassInstance = NULL;
|
||||
|
@ -525,6 +526,8 @@ void BfParser::SetSource(const char* data, int length)
|
|||
canCache = false;
|
||||
if (mProject == NULL)
|
||||
canCache = false;
|
||||
if (mIsEmitted)
|
||||
canCache = false;
|
||||
|
||||
uint64 cacheHash = 0;
|
||||
if (canCache)
|
||||
|
@ -3447,8 +3450,11 @@ void BfParser::Parse(BfPassInstance* passInstance)
|
|||
{
|
||||
BP_ZONE_F("BfParser::Parse %s", mFileName.c_str());
|
||||
|
||||
mSyntaxToken = BfSyntaxToken_None;
|
||||
mPassInstance = passInstance;
|
||||
|
||||
int startIdx = mSrcIdx;
|
||||
|
||||
if (mUsingCache)
|
||||
{
|
||||
mRootNode = mParserData->mRootNode;
|
||||
|
@ -3476,7 +3482,7 @@ void BfParser::Parse(BfPassInstance* passInstance)
|
|||
mPassInstance->Warn(0, "No matching #endif found", mPreprocessorNodeStack.back().first);
|
||||
}
|
||||
|
||||
for (int i = 1; i < mJumpTableSize; i++)
|
||||
for (int i = (startIdx / PARSER_JUMPTABLE_DIVIDE)+1; i < mJumpTableSize; i++)
|
||||
if (mJumpTable[i].mCharIdx == 0)
|
||||
mJumpTable[i] = mJumpTable[i - 1];
|
||||
|
||||
|
@ -3523,6 +3529,26 @@ void BfParser::Close()
|
|||
}
|
||||
}
|
||||
|
||||
void BfParser::HadSrcRealloc()
|
||||
{
|
||||
int jumpTableSize = ((mSrcAllocSize + 1) + PARSER_JUMPTABLE_DIVIDE - 1) / PARSER_JUMPTABLE_DIVIDE;
|
||||
if (jumpTableSize > mJumpTableSize)
|
||||
{
|
||||
auto jumpTable = new BfLineStartEntry[jumpTableSize];
|
||||
memset(jumpTable, 0, jumpTableSize * sizeof(BfLineStartEntry));
|
||||
memcpy(jumpTable, mJumpTable, mJumpTableSize * sizeof(BfLineStartEntry));
|
||||
|
||||
delete mJumpTable;
|
||||
|
||||
mJumpTable = jumpTable;
|
||||
mJumpTableSize = jumpTableSize;
|
||||
|
||||
mParserData->mJumpTable = mJumpTable;
|
||||
mParserData->mJumpTableSize = mJumpTableSize;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void BfParser::GenerateAutoCompleteFrom(int srcPosition)
|
||||
{
|
||||
BfSourcePositionFinder posFinder(this, srcPosition);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue