mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-14 18:51:47 -07:00
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:
@ -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();
|
||||
}
|
||||
|
@ -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 );
|
||||
|
@ -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
@ -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 };
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
#pragma region Containers
|
||||
|
||||
template<class TType> struct RemoveConst { typedef TType Type; };
|
||||
template<class TType> struct RemoveConst<const TType> { typedef TType Type; };
|
||||
template<class TType> struct RemoveConst<const TType[]> { typedef TType Type[]; };
|
||||
template<class TType, uw Size> struct RemoveConst<const TType[Size]> { typedef TType Type[Size]; };
|
||||
template<class TType> struct RemoveConst { typedef TType Type; };
|
||||
template<class TType> struct RemoveConst<const TType> { typedef TType Type; };
|
||||
template<class TType> struct RemoveConst<const TType[]> { typedef TType Type[]; };
|
||||
template<class TType, uw Size> struct RemoveConst<const TType[Size]> { typedef TType Type[Size]; };
|
||||
|
||||
template<class TType>
|
||||
using TRemoveConst = typename RemoveConst<TType>::Type;
|
||||
|
@ -44,8 +44,8 @@ void process_exit( u32 code );
|
||||
{ \
|
||||
local_persist thread_local \
|
||||
char buf[GEN_PRINTF_MAXLEN] = { 0 }; \
|
||||
\
|
||||
str_fmt(buf, GEN_PRINTF_MAXLEN, __VA_ARGS__); \
|
||||
\
|
||||
str_fmt(buf, GEN_PRINTF_MAXLEN, __VA_ARGS__); \
|
||||
GEN_PANIC(buf); \
|
||||
} \
|
||||
while (0)
|
||||
@ -53,10 +53,10 @@ void process_exit( u32 code );
|
||||
|
||||
# define GEN_FATAL( ... ) \
|
||||
do \
|
||||
{ \
|
||||
{ \
|
||||
str_fmt_out_err( __VA_ARGS__ ); \
|
||||
process_exit(1); \
|
||||
} \
|
||||
} \
|
||||
while (0)
|
||||
#endif
|
||||
|
||||
|
@ -292,7 +292,7 @@ FileInfo* file_get_standard( FileStandardType std )
|
||||
if ( ! _std_file_set )
|
||||
{
|
||||
# define GEN__SET_STD_FILE( type, v ) \
|
||||
_std_files[ type ].fd.p = v; \
|
||||
_std_files[ type ].fd.p = v; \
|
||||
_std_files[ type ].ops = default_file_operations
|
||||
GEN__SET_STD_FILE( EFileStandard_INPUT, GetStdHandle( STD_INPUT_HANDLE ) );
|
||||
GEN__SET_STD_FILE( EFileStandard_OUTPUT, GetStdHandle( STD_OUTPUT_HANDLE ) );
|
||||
|
@ -336,8 +336,6 @@ GEN_IMPL_INLINE b32 file_write_at_check( FileInfo* f, void const* buffer, sw siz
|
||||
return f->ops.write_at( f->fd, buffer, size, offset, bytes_written );
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum FileStreamFlags : u32
|
||||
{
|
||||
/* Allows us to write to the buffer directly. Beware: you can not append a new data! */
|
||||
|
Reference in New Issue
Block a user