progress on modularizing parser paths

This commit is contained in:
Edward R. Gonzalez 2025-03-16 23:13:46 -04:00
parent 441a46daaa
commit 790087aa3c
3 changed files with 244 additions and 220 deletions

View File

@ -25,7 +25,7 @@ ParseInfo wip_parse_str(LexedInfo lexed, ParseOpts* opts)
_ctx->parser.Tokens = toks;
push_scope();
CodeBody result = parse_global_nspace(CT_Global_Body);
CodeBody result = parse_global_nspace(_ctx, CT_Global_Body);
parser_pop(& _ctx->parser);
return info;
@ -41,7 +41,7 @@ CodeClass parse_class( Str def )
_ctx->parser.Tokens = toks;
push_scope();
CodeClass result = (CodeClass) parse_class_struct( Tok_Decl_Class, parser_not_inplace_def );
CodeClass result = (CodeClass) parse_class_struct( _ctx, Tok_Decl_Class, parser_not_inplace_def );
parser_pop(& _ctx->parser);
return result;
}
@ -209,7 +209,7 @@ CodeBody parse_global_body( Str def )
_ctx->parser.Tokens = toks;
push_scope();
CodeBody result = parse_global_nspace( CT_Global_Body );
CodeBody result = parse_global_nspace(_ctx, CT_Global_Body );
parser_pop(& _ctx->parser);
return result;
}
@ -260,7 +260,7 @@ CodeStruct parse_struct( Str def )
_ctx->parser.Tokens = toks;
push_scope();
CodeStruct result = (CodeStruct) parse_class_struct( Tok_Decl_Struct, parser_not_inplace_def );
CodeStruct result = (CodeStruct) parse_class_struct( _ctx, Tok_Decl_Struct, parser_not_inplace_def );
parser_pop(& _ctx->parser);
return result;
}

File diff suppressed because it is too large Load Diff

View File

@ -26,10 +26,8 @@ template <class TType> using TRemovePtr = typename RemovePtr<TType>::Type;
struct ArrayHeader;
#if GEN_COMPILER_CPP
template<class Type> struct Array;
# define get_array_underlying_type(array) typename TRemovePtr<typeof(array)>:: DataType
#endif
template<class Type> struct Array;
#define get_array_underlying_type(array) typename TRemovePtr<typeof(array)>:: DataType
usize array_grow_formula(ssize value);
@ -59,12 +57,12 @@ struct ArrayHeader {
usize Num;
};
#if GEN_COMPILER_CPP
template<class Type>
struct Array
{
Type* Data;
#if ! GEN_C_LIKE_CPP
#pragma region Member Mapping
forceinline static Array init(AllocatorInfo allocator) { return array_init<Type>(allocator); }
forceinline static Array init_reserve(AllocatorInfo allocator, ssize capacity) { return array_init_reserve<Type>(allocator, capacity); }
@ -88,6 +86,7 @@ struct Array
forceinline bool resize(usize num) { return array_resize<Type>(this, num); }
forceinline bool set_capacity(usize new_capacity) { return array_set_capacity<Type>(this, new_capacity); }
#pragma endregion Member Mapping
#endif
forceinline operator Type*() { return Data; }
forceinline operator Type const*() const { return Data; }
@ -99,9 +98,8 @@ struct Array
using DataType = Type;
};
#endif
#if GEN_COMPILER_CPP && 0
#if 0
template<class Type> bool append(Array<Type>& array, Array<Type> other) { return append( & array, other ); }
template<class Type> bool append(Array<Type>& array, Type value) { return append( & array, value ); }
template<class Type> bool append(Array<Type>& array, Type* items, usize item_num) { return append( & array, items, item_num ); }