Added is_body to AST and Code types

This commit is contained in:
2024-12-01 12:48:58 -05:00
parent 31691b1466
commit 8ef982003a
9 changed files with 109 additions and 75 deletions

View File

@@ -19,7 +19,7 @@ CodeBody gen_array_base()
// Code grow_formula = untyped_str( txt( "#define gen_array_grow_formula( value ) ( 2 * value + 8 )\n" ));
Code get_header = untyped_str( txt( "#define array_get_header( Type, self ) ( (ArrayHeader*)( self ) - 1)\n" ));
return def_global_body( args( td_header, header, get_header ) );
return def_global_body( args( fmt_newline, td_header, header, get_header, fmt_newline ) );
};
CodeBody gen_array( StrC type, StrC array_name )

View File

@@ -7,9 +7,13 @@ using SwapContentProc = CodeBody(void);
b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& body )
{
b32 found = false;
CodePreprocessCond cond = entry_iter.cast<CodePreprocessCond>();
if ( cond->Content.contains(cond_sig) )
{
log_fmt("Preprocess cond found: %S\n", cond->Content);
found = true;
s32 depth = 1;
++ entry_iter; for(b32 continue_for = true; continue_for && entry_iter != body.end(); ) switch
(entry_iter->Type) {
@@ -34,7 +38,7 @@ b32 ignore_preprocess_cond_block( StrC cond_sig, Code& entry_iter, CodeBody& bod
}
}
return entry_iter != body.end();
return found;
}
bool swap_pragma_region_implementation( StrC region_name, SwapContentProc* swap_content, Code& entry_iter, CodeBody& body )