bugfixes while testing with unreal (still more needs fixing

This commit is contained in:
2024-12-15 17:52:31 -05:00
parent 0b03b3cd92
commit 868b93cdd0
15 changed files with 103 additions and 49 deletions

View File

@ -2490,7 +2490,40 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
// Example : <Capture_Start> <Value> <Comma>
// idx +1 +2
bool detected_comma = _ctx->parser.Tokens.Arr[ _ctx->parser.Tokens.Idx + 2 ].Type == Tok_Comma;
if ( detected_capture && ! detected_comma )
b32 detected_non_varadic_unpaired_param = detected_comma && nexttok.Type != Tok_Varadic_Argument;
if (! detected_non_varadic_unpaired_param && nexttok.Type == Tok_Preprocess_Macro_Expr) for( s32 break_scope = 0; break_scope == 0; ++ break_scope)
{
Macro* macro = lookup_macro( nexttok.Text );
if (macro == nullptr || ! macro_is_functional(* macro))
break;
// ( <Macro_Expr> (
// Idx +1 +2
s32 idx = _ctx->parser.Tokens.Idx + 1;
s32 level = 0;
// Find end of the token expression
for ( ; idx < array_num(_ctx->parser.Tokens.Arr); idx++ )
{
Token tok = _ctx->parser.Tokens.Arr[ idx ];
if ( tok.Type == Tok_Capture_Start )
level++;
else if ( tok.Type == Tok_Capture_End && level > 0 )
level--;
if (level == 0 && tok.Type == Tok_Capture_End)
break;
}
++ idx; // Will incremnt to possible comma position
if ( _ctx->parser.Tokens.Arr[ idx ].Type != Tok_Comma )
break;
detected_non_varadic_unpaired_param = true;
}
if ( detected_capture && ! detected_non_varadic_unpaired_param )
{
// Dealing with a function
result = cast(Code, parse_function_after_name( ModuleFlag_None, attributes, specifiers, type, name ));
@ -2509,7 +2542,7 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
}
}
parser_pop(& _ctx->parser);
parser_pop(& _ctx->parser);
return result;
}
@ -3002,7 +3035,7 @@ Code parse_simple_preprocess( TokType which )
|| str_contains(calling_proc, txt("parse_class_struct_body"))
)
{
if (peektok.Type == Tok_Statement_End)
if (left && peektok.Type == Tok_Statement_End)
{
Token stmt_end = currtok;
eat( Tok_Statement_End );
@ -5015,7 +5048,6 @@ CodeTypedef parser_parse_typedef()
// valid_macro |= macro && macro_expects_body(* macro));
// }
Code macro;
if ( valid_macro )
#endif
{