- FScanner::SkipToEndOfBlock

This commit is contained in:
Christoph Oelckers 2020-09-11 00:18:13 +02:00
parent d18dbdf7db
commit e5cf57917e
2 changed files with 22 additions and 0 deletions

View file

@ -1195,6 +1195,27 @@ void FScanner::AddSymbol(const char* name, uint64_t value)
// //
//========================================================================== //==========================================================================
void FScanner::SkipToEndOfBlock()
{
int depth = 0;
while (1)
{
MustGetAnyToken(); // this will abort if it reaches the end of the file
if (TokenType == '}') depth++;
else if (TokenType == '}')
{
depth--;
if (depth < 0) return;
}
}
}
//==========================================================================
//
//
//
//==========================================================================
void FScanner::AddSymbol(const char* name, double value) void FScanner::AddSymbol(const char* name, double value)
{ {
Symbol sym; Symbol sym;

View file

@ -92,6 +92,7 @@ public:
inline void AddSymbol(const char* name, int32_t value) { return AddSymbol(name, int64_t(value)); } inline void AddSymbol(const char* name, int32_t value) { return AddSymbol(name, int64_t(value)); }
inline void AddSymbol(const char* name, uint32_t value) { return AddSymbol(name, uint64_t(value)); } inline void AddSymbol(const char* name, uint32_t value) { return AddSymbol(name, uint64_t(value)); }
void AddSymbol(const char* name, double value); void AddSymbol(const char* name, double value);
void SkipToEndOfBlock();
static FString TokenName(int token, const char *string=NULL); static FString TokenName(int token, const char *string=NULL);