Finished current iteration of parser_algo docs and parser.cpp inline comment docs

Added some todos and prep for upcoming changes
This commit is contained in:
2023-11-22 14:23:21 -05:00
parent a667eb4afe
commit 91a3250d4c
10 changed files with 577 additions and 36 deletions

View File

@ -325,6 +325,8 @@ void deinit()
LexArena.free();
PreprocessorDefines.free();
index = 0;
left = Global_AllocatorBuckets.num();
do
@ -335,8 +337,6 @@ void deinit()
}
while ( left--, left );
PreprocessorDefines.free();
Global_AllocatorBuckets.free();
parser::deinit();
}

View File

@ -29,7 +29,6 @@ StringCached get_cached_string( StrC str );
Code make_code();
// Set these before calling gen's init() procedure.
// Data
void set_allocator_data_arrays ( AllocatorInfo data_array_allocator );
void set_allocator_code_pool ( AllocatorInfo pool_allocator );
@ -145,6 +144,42 @@ CodeBody def_union_body ( s32 num, Code* codes );
#pragma region Parsing
// TODO(Ed) : Implmeent the new parser API design.
#if 0
namespace parser {
struct StackNode
{
StackNode* Prev;
Token Start;
Token Name; // The name of the AST node (if parsed)
StrC FailedProc; // The name of the procedure that failed
};
// Stack nodes are allocated the error's allocator
struct Error
{
String message;
StackNode* context_stack;
};
}
struct ParseInfo
{
Arena file_mem;
Arena token_mem;
Arena code_mem;
FileContents file_content;
Array<parser::Token> tokens;
Array<parser::Error> errors;
// Errors are allocated to a dedicated general arena.
};
CodeBody parse_file( StrC path );
#endif
CodeClass parse_class ( StrC class_def );
CodeConstructor parse_constructor ( StrC constructor_def );
CodeDestructor parse_destructor ( StrC destructor_def );

View File

@ -537,6 +537,7 @@ void lex_found_token( StrC& content
neverinline
// TokArray lex( Array<Token> tokens, StrC content )
TokArray lex( StrC content )
{
s32 left = content.Len;

File diff suppressed because it is too large Load Diff

View File

@ -9,6 +9,7 @@
global AllocatorInfo GlobalAllocator;
global Array<Arena> Global_AllocatorBuckets;
// TODO(Ed) : Make the code pool a dynamic arena
global Array< Pool > CodePools = { nullptr };
global Array< Arena > StringArenas = { nullptr };