mirror of
https://github.com/Ed94/gencpp.git
synced 2024-12-22 15:54:45 -08:00
Last fixes before handmade hero hiatus
This commit is contained in:
parent
754bcfb31e
commit
729c891cbd
@ -690,13 +690,25 @@ String AST::to_string()
|
||||
case Function:
|
||||
{
|
||||
if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Export ))
|
||||
result.append( "export " );
|
||||
result.append( "export" );
|
||||
|
||||
if ( Attributes )
|
||||
result.append_fmt( "%S ", Attributes->to_string() );
|
||||
result.append_fmt( " %S ", Attributes->to_string() );
|
||||
|
||||
if ( Specs )
|
||||
result.append_fmt( "%S", Specs->to_string() );
|
||||
{
|
||||
for ( SpecifierT spec : Specs->cast<CodeSpecifiers>() )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
result.append_fmt( " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( Attributes || Specs )
|
||||
result.append( "\n" );
|
||||
|
||||
if ( ReturnType )
|
||||
result.append_fmt( "%S %S(", ReturnType->to_string(), Name );
|
||||
@ -735,7 +747,21 @@ String AST::to_string()
|
||||
result.append_fmt( "%S ", Attributes->to_string() );
|
||||
|
||||
if ( Specs )
|
||||
result.append_fmt( "%S", Specs->to_string() );
|
||||
{
|
||||
for ( SpecifierT spec : Specs->cast<CodeSpecifiers>() )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
result.append_fmt( " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( Attributes || Specs )
|
||||
{
|
||||
result.append("\n" );
|
||||
}
|
||||
|
||||
if ( ReturnType )
|
||||
result.append_fmt( "%S %S(", ReturnType->to_string(), Name );
|
||||
@ -795,7 +821,24 @@ String AST::to_string()
|
||||
result.append_fmt( "%S ", Attributes->to_string() );
|
||||
|
||||
if ( Attributes )
|
||||
result.append_fmt( "%S\n", Attributes->to_string() );
|
||||
result.append_fmt( "%S ", Attributes->to_string() );
|
||||
|
||||
if ( Specs )
|
||||
{
|
||||
for ( SpecifierT spec : Specs->cast<CodeSpecifiers>() )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
result.append_fmt( " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( Attributes || Specs )
|
||||
{
|
||||
result.append("\n" );
|
||||
}
|
||||
|
||||
if ( ReturnType )
|
||||
result.append_fmt( "%S %S (", ReturnType->to_string(), Name );
|
||||
@ -834,7 +877,21 @@ String AST::to_string()
|
||||
result.append_fmt( "%S\n", Attributes->to_string() );
|
||||
|
||||
if ( Specs )
|
||||
result.append_fmt( "%S\n", Specs->to_string() );
|
||||
{
|
||||
for ( SpecifierT spec : Specs->cast<CodeSpecifiers>() )
|
||||
{
|
||||
if ( ! ESpecifier::is_trailing( spec ) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
result.append_fmt( " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( Attributes || Specs )
|
||||
{
|
||||
result.append("\n" );
|
||||
}
|
||||
|
||||
result.append_fmt( "%S %S (", ReturnType->to_string(), Name );
|
||||
|
||||
@ -991,12 +1048,6 @@ String AST::to_string()
|
||||
s32 left = NumEntries;
|
||||
while ( left-- )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( ArrSpecs[idx]) && ArrSpecs[idx] != ESpecifier::Const )
|
||||
{
|
||||
idx++;
|
||||
continue;
|
||||
}
|
||||
|
||||
StrC spec = ESpecifier::to_str( ArrSpecs[idx] );
|
||||
result.append_fmt( "%.*s ", spec.Len, spec.Ptr );
|
||||
idx++;
|
||||
|
@ -257,7 +257,7 @@ struct AST
|
||||
};
|
||||
union {
|
||||
AST* NextVar; // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = NextVar->Value )
|
||||
AST* SpecsFuncSuffix; // Only used with typenames, to store the function suffix if typename is function signature. ( May not be needed )
|
||||
AST* SuffixSpecs; // Only used with typenames, to store the function suffix if typename is function signature. ( May not be needed )
|
||||
};
|
||||
};
|
||||
StringCached Content; // Attributes, Comment, Execution, Include
|
||||
@ -316,7 +316,7 @@ struct AST_POD
|
||||
};
|
||||
union {
|
||||
AST* NextVar; // Variable; Possible way to handle comma separated variables declarations. ( , NextVar->Specs NextVar->Name NextVar->ArrExpr = NextVar->Value )
|
||||
AST* SpecsFuncSuffix; // Only used with typenames, to store the function suffix if typename is function signature. ( May not be needed )
|
||||
AST* SuffixSpecs; // Only used with typenames, to store the function suffix if typename is function signature. ( May not be needed )
|
||||
};
|
||||
};
|
||||
StringCached Content; // Attributes, Comment, Execution, Include
|
||||
|
@ -2296,6 +2296,7 @@ CodeFn parse_function_after_name(
|
||||
|
||||
CodeParam params = parse_params();
|
||||
|
||||
// These have to be kept separate from the return type's specifiers.
|
||||
while ( left && currtok.is_specifier() )
|
||||
{
|
||||
if ( specifiers.ast == nullptr )
|
||||
@ -4784,7 +4785,7 @@ CodeType parse_type( bool* typedef_is_function )
|
||||
#if 0
|
||||
else if ( currtok.Type == TokType::DeclType )
|
||||
{
|
||||
// Will have a capture and its own parsing rules, were going to just shove everything in a string.
|
||||
// Will have a capture and its own parsing rules, were going to just shove everything in a string (for now).
|
||||
name = currtok;
|
||||
eat( TokType::DeclType );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user