More compression. Removing unused code form gs_meta_lexer

This commit is contained in:
Peter Slattery 2020-01-19 17:15:04 -08:00
parent d6cf235ece
commit 0efa2477fc
2 changed files with 3 additions and 55 deletions

View File

@ -17,14 +17,9 @@
#include <gs_bucket.h> #include <gs_bucket.h>
#include "..\src\gs_platform.h" #include "..\src\gs_platform.h"
#include <gs_memory_arena.h> #include <gs_memory_arena.h>
#if 1
#include "..\src\gs_string.h"
#else
#include <gs_string.h> #include <gs_string.h>
#endif
#include <gs_string_builder.h> #include <gs_string_builder.h>
#include "gs_meta_error.h"
#include "gs_meta_lexer.h" #include "gs_meta_lexer.h"
struct error_buffer struct error_buffer
@ -96,7 +91,6 @@ PrintAllErrors (errors Errors)
} }
#include "foldhaus_meta_type_table.h" #include "foldhaus_meta_type_table.h"
error_list GlobalErrorList = {};
PLATFORM_ALLOC(StdAlloc) PLATFORM_ALLOC(StdAlloc)
{ {
@ -233,7 +227,7 @@ GetFileSize (char* FileName)
} }
internal s32 internal s32
ReadEntireFileAndNullTerminate (source_code_file* File) ReadEntireFileAndNullTerminate (source_code_file* File, errors* Errors)
{ {
s32 LengthRead = 0; s32 LengthRead = 0;
@ -257,7 +251,7 @@ ReadEntireFileAndNullTerminate (source_code_file* File)
} }
else else
{ {
LogError(&GlobalErrorList, "Could Not Read File: %.*s", StringExpand(File->Path)); PushFError(Errors, "Could Not Read File: %S", File->Path);
} }
return LengthRead; return LengthRead;
@ -326,7 +320,7 @@ AddFileToSource(string RelativePath, gs_bucket<source_code_file>* SourceFiles, e
CopyStringTo(RelativePath, &File.Path); CopyStringTo(RelativePath, &File.Path);
NullTerminate(&File.Path); NullTerminate(&File.Path);
File.FileSize = ReadEntireFileAndNullTerminate(&File); File.FileSize = ReadEntireFileAndNullTerminate(&File, Errors);
if (File.FileSize > 0) if (File.FileSize > 0)
{ {
@ -1348,7 +1342,6 @@ int main(int ArgCount, char** ArgV)
} }
errors Errors = {0}; errors Errors = {0};
gs_bucket<source_code_file> SourceFiles; gs_bucket<source_code_file> SourceFiles;
string CurrentWorkingDirectory = MakeString((char*)malloc(1024), 0, 1024); string CurrentWorkingDirectory = MakeString((char*)malloc(1024), 0, 1024);
@ -1364,7 +1357,6 @@ int main(int ArgCount, char** ArgV)
CopyStringTo(RootPath, &CurrentWorkingDirectory); CopyStringTo(RootPath, &CurrentWorkingDirectory);
} }
// NOTE(Peter): this is a temporary list of GSMetaTags. It gets copied and cleared // NOTE(Peter): this is a temporary list of GSMetaTags. It gets copied and cleared
// after use // after use
gs_bucket<token> Tokens; gs_bucket<token> Tokens;
@ -1479,8 +1471,6 @@ int main(int ArgCount, char** ArgV)
fclose(TypeInfoH); fclose(TypeInfoH);
} }
PrintErrorList(GlobalErrorList);
s64 TotalEnd = GetWallClock(); s64 TotalEnd = GetWallClock();
r32 TotalTime = GetSecondsElapsed(TotalStart, TotalEnd); r32 TotalTime = GetSecondsElapsed(TotalStart, TotalEnd);
printf("Metaprogram Preproc Time: %.*f sec\n", 6, TotalTime); printf("Metaprogram Preproc Time: %.*f sec\n", 6, TotalTime);

View File

@ -260,45 +260,3 @@ GetNextToken (tokenizer* Tokenizer)
return Result; return Result;
} }
internal s32
FindNextMatchingToken (u32 TokenAt, u32 TokenMax, gs_bucket<token> Tokens, token_selection_spec Spec)
{
s32 Result = -1;
s32 Start = (s32)TokenAt + 1;
for (s32 i = Start; i < (s32)TokenMax; i++)
{
token* Token = Tokens.GetElementAtIndex(i);
if (Token->Text.Memory)
{
if (Spec.MatchText && StringsEqual(Spec.Text, Token->Text))
{
Result = i;
break;
}
}
}
return Result;
}
internal s32
GetNextTokenOfType (s32 TokenAtIndex, s32 Max, gs_bucket<token> Tokens, token_type Type)
{
s32 Result = -1;
s32 Start = TokenAtIndex + 1;
for (s32 i = Start; i < Max; i++)
{
token* At = Tokens.GetElementAtIndex(i);
if (At->Type == Type)
{
Result = i;
break;
}
}
return Result;
}