Formatting fixes

This commit is contained in:
Edward R. Gonzalez 2023-08-22 01:51:59 -04:00
parent a61a28b778
commit c4846dad26
13 changed files with 79 additions and 66 deletions

View File

@ -9,7 +9,8 @@
"_DEBUG", "_DEBUG",
"UNICODE", "UNICODE",
"_UNICODE", "_UNICODE",
"GEN_TIME" "GEN_TIME",
"GEN_IMPLEMENTATION"
// "GEN_DONT_USE_NAMESPACE" // "GEN_DONT_USE_NAMESPACE"
], ],
"windowsSdkVersion": "10.0.19041.0", "windowsSdkVersion": "10.0.19041.0",
@ -26,7 +27,8 @@
"_DEBUG", "_DEBUG",
"UNICODE", "UNICODE",
"_UNICODE", "_UNICODE",
"GEN_TIME" "GEN_TIME",
"GEN_IMPLEMENTATION"
// "GEN_DONT_USE_NAMESPACE" // "GEN_DONT_USE_NAMESPACE"
], ],
"windowsSdkVersion": "10.0.19041.0", "windowsSdkVersion": "10.0.19041.0",

View File

@ -63,7 +63,7 @@ int gen_main()
header.print( filesystem ); header.print( filesystem );
header.print( timing ); header.print( timing );
header.print_fmt( "GEN_NS_END\n" ); header.print_fmt( "\nGEN_NS_END\n" );
header.write(); header.write();
} }
@ -84,7 +84,7 @@ int gen_main()
src.print_fmt( generation_notice ); src.print_fmt( generation_notice );
src.print_fmt( "// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)\n\n" ); src.print_fmt( "// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)\n\n" );
src.print( src_start ); src.print( src_start );
src.print_fmt( "GEN_NS_BEGIN\n\n" ); src.print_fmt( "\nGEN_NS_BEGIN\n" );
src.print( debug ); src.print( debug );
src.print( string_ops ); src.print( string_ops );
@ -95,7 +95,7 @@ int gen_main()
src.print( filesystem ); src.print( filesystem );
src.print( timing ); src.print( timing );
src.print_fmt( "GEN_NS_END\n\n" ); src.print_fmt( "\nGEN_NS_END\n" );
src.write(); src.write();
} }
@ -120,26 +120,27 @@ int gen_main()
header.print_fmt( "#pragma once\n\n" ); header.print_fmt( "#pragma once\n\n" );
header.print( push_ignores ); header.print( push_ignores );
header.print( header_start ); header.print( header_start );
header.print_fmt( "GEN_NS_BEGIN\n\n" ); header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
header.print_fmt( "#pragma region Types\n\n" ); header.print_fmt( "#pragma region Types\n" );
header.print( types ); header.print( types );
header.print( ecode ); header.print( ecode );
header.print( eoperator ); header.print( eoperator );
header.print( especifier ); header.print( especifier );
header.print_fmt( "#pragma endregion Types\n\n" ); header.print_fmt( "#pragma endregion Types\n\n" );
header.print_fmt( "#pragma region AST\n\n" ); header.print_fmt( "#pragma region AST\n" );
header.print( ast ); header.print( ast );
header.print( ast_types ); header.print( ast_types );
header.print_fmt( "#pragma endregion AST\n\n" ); header.print_fmt( "\n#pragma endregion AST\n" );
header.print( interface ); header.print( interface );
header.print_fmt( "#pragma region Inlines\n\n" ); header.print_fmt( "\npragma region Inlines\n" );
header.print( inlines ); header.print( inlines );
header.print( fmt_newline );
header.print( ast_inlines ); header.print( ast_inlines );
header.print_fmt( "#pragma endregion Inlines\n\n" ); header.print_fmt( "#pragma endregion Inlines\n" );
header.print( header_end ); header.print( header_end );
header.print_fmt( "GEN_NS_END\n\n" ); header.print_fmt( "GEN_NS_END\n\n" );
@ -148,29 +149,29 @@ int gen_main()
Builder Builder
header_ecode = Builder::open( "components/gen/ecode.hpp" ); header_ecode = Builder::open( "components/gen/ecode.hpp" );
header_ecode.print_fmt( generation_notice );
header_ecode.print( pragma_once ); header_ecode.print( pragma_once );
header_ecode.print_fmt( generation_notice );
header_ecode.print( ecode ); header_ecode.print( ecode );
header_ecode.write(); header_ecode.write();
Builder Builder
header_eoperator = Builder::open( "components/gen/eoperator.hpp" ); header_eoperator = Builder::open( "components/gen/eoperator.hpp" );
header_eoperator.print_fmt( generation_notice );
header_eoperator.print( pragma_once ); header_eoperator.print( pragma_once );
header_eoperator.print_fmt( generation_notice );
header_eoperator.print( eoperator ); header_eoperator.print( eoperator );
header_eoperator.write(); header_eoperator.write();
Builder Builder
header_especifier = Builder::open( "components/gen/especifier.hpp" ); header_especifier = Builder::open( "components/gen/especifier.hpp" );
header_especifier.print_fmt( generation_notice );
header_especifier.print( pragma_once ); header_especifier.print( pragma_once );
header_especifier.print_fmt( generation_notice );
header_especifier.print( especifier ); header_especifier.print( especifier );
header_especifier.write(); header_especifier.write();
Builder Builder
header_ast_inlines = Builder::open( "components/gen/ast_inlines.hpp" ); header_ast_inlines = Builder::open( "components/gen/ast_inlines.hpp" );
header_ast_inlines.print_fmt( generation_notice );
header_ast_inlines.print( pragma_once ); header_ast_inlines.print( pragma_once );
header_ast_inlines.print_fmt( generation_notice );
header_ast_inlines.print( ast_inlines ); header_ast_inlines.print( ast_inlines );
header_ast_inlines.write(); header_ast_inlines.write();
} }
@ -194,23 +195,23 @@ int gen_main()
src.print_fmt( generation_notice ); src.print_fmt( generation_notice );
src.print( push_ignores ); src.print( push_ignores );
src.print( src_start ); src.print( src_start );
src.print_fmt( "\nGEN_NS_BEGIN\n\n"); src.print_fmt( "GEN_NS_BEGIN\n");
src.print( static_data ); src.print( static_data );
src.print_fmt( "#pragma region AST\n\n" ); src.print_fmt( "\n#pragma region AST\n\n" );
src.print( ast_case_macros ); src.print( ast_case_macros );
src.print( ast ); src.print( ast );
src.print_fmt( "#pragma endregion AST\n\n" ); src.print_fmt( "\n#pragma endregion AST\n" );
src.print_fmt( "#pragma region Interface\n\n" ); src.print_fmt( "\n#pragma region Interface\n" );
src.print( interface ); src.print( interface );
src.print( upfront ); src.print( upfront );
src.print_fmt( "#pragma region Parsing\n\n" ); src.print_fmt( "\n#pragma region Parsing\n\n" );
src.print( nspaced_etoktype ); src.print( nspaced_etoktype );
src.print( parsing ); src.print( parsing );
src.print( untyped ); src.print( untyped );
src.print_fmt( "#pragma endregion Parsing\n\n" ); src.print_fmt( "\n#pragma endregion Parsing\n\n" );
src.print_fmt( "#pragma endregion Interface\n\n" ); src.print_fmt( "#pragma endregion Interface\n\n" );
src.print_fmt( "GEN_NS_END\n\n"); src.print_fmt( "GEN_NS_END\n\n");
@ -234,9 +235,9 @@ int gen_main()
header.print_fmt( generation_notice ); header.print_fmt( generation_notice );
header.print_fmt( "#pragma once\n\n" ); header.print_fmt( "#pragma once\n\n" );
header.print( def_include( txt("gen.hpp") )); header.print( def_include( txt("gen.hpp") ));
header.print_fmt( "\nGEN_NS_BEGIN\n\n" ); header.print_fmt( "\nGEN_NS_BEGIN\n" );
header.print( builder ); header.print( builder );
header.print_fmt( "\nGEN_NS_END\n\n" ); header.print_fmt( "GEN_NS_END\n" );
header.write(); header.write();
} }
@ -248,9 +249,9 @@ int gen_main()
src = Builder::open( "gen/gen.builder.cpp" ); src = Builder::open( "gen/gen.builder.cpp" );
src.print_fmt( generation_notice ); src.print_fmt( generation_notice );
src.print( def_include( txt("gen.builder.hpp") ) ); src.print( def_include( txt("gen.builder.hpp") ) );
src.print_fmt( "\nGEN_NS_BEGIN\n\n" ); src.print_fmt( "\nGEN_NS_BEGIN\n" );
src.print( builder ); src.print( builder );
src.print_fmt( "\nGEN_NS_END\n\n" ); src.print_fmt( "\nGEN_NS_END\n" );
src.write(); src.write();
} }
@ -264,10 +265,10 @@ int gen_main()
header.print_fmt( generation_notice ); header.print_fmt( generation_notice );
header.print_fmt( "#pragma once\n\n" ); header.print_fmt( "#pragma once\n\n" );
header.print( def_include( txt("gen.hpp") ) ); header.print( def_include( txt("gen.hpp") ) );
header.print_fmt( "\nGEN_NS_BEGIN\n\n" ); header.print_fmt( "\nGEN_NS_BEGIN\n" );
header.print( parsing ); header.print( parsing );
header.print( scanner ); header.print( scanner );
header.print_fmt( "\nGEN_NS_END\n\n" ); header.print_fmt( "GEN_NS_END\n" );
header.write(); header.write();
} }
@ -280,10 +281,10 @@ int gen_main()
src = Builder::open( "gen/gen.scanner.cpp" ); src = Builder::open( "gen/gen.scanner.cpp" );
src.print_fmt( generation_notice ); src.print_fmt( generation_notice );
src.print( def_include( txt("gen.scanner.hpp") ) ); src.print( def_include( txt("gen.scanner.hpp") ) );
src.print_fmt( "\nGEN_NS_BEGIN\n\n" ); src.print_fmt( "\nGEN_NS_BEGIN\n" );
src.print( parsing ); src.print( parsing );
src.print( scanner ); src.print( scanner );
src.print_fmt( "\nGEN_NS_END\n\n" ); src.print_fmt( "GEN_NS_END\n" );
src.write(); src.write();
} }

View File

@ -76,4 +76,3 @@
case Specifiers: \ case Specifiers: \
case Struct_Body: \ case Struct_Body: \
case Typename: case Typename:

View File

@ -541,4 +541,5 @@ struct AST_Var
char _PAD_UNUSED_[ sizeof(u32) ]; char _PAD_UNUSED_[ sizeof(u32) ];
}; };
static_assert( sizeof(AST_Var) == sizeof(AST), "ERROR: AST_Var is not the same size as AST"); static_assert( sizeof(AST_Var) == sizeof(AST), "ERROR: AST_Var is not the same size as AST");
#pragma endregion AST Types #pragma endregion AST Types

View File

@ -1,6 +1,6 @@
#pragma once
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp) // This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
#pragma once
#pragma region generated code inline implementation #pragma region generated code inline implementation
char const* Code::debug_str( void ) char const* Code::debug_str( void )

View File

@ -1,7 +1,7 @@
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
#pragma once #pragma once
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
namespace ECode namespace ECode
{ {
enum Type : u32 enum Type : u32

View File

@ -1,7 +1,7 @@
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
#pragma once #pragma once
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
namespace EOperator namespace EOperator
{ {
enum Type : u32 enum Type : u32

View File

@ -1,7 +1,7 @@
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
#pragma once #pragma once
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
namespace ESpecifier namespace ESpecifier
{ {
enum Type : u32 enum Type : u32

View File

@ -401,6 +401,11 @@ namespace Parser
if ( token.Type == TokType::Preprocess_Else || token.Type == TokType::Preprocess_EndIf ) if ( token.Type == TokType::Preprocess_Else || token.Type == TokType::Preprocess_EndIf )
{ {
Tokens.append( token ); Tokens.append( token );
while ( left && current != '\n' )
{
move_forward();
}
move_forward();
continue; continue;
} }
@ -882,13 +887,13 @@ namespace Parser
} }
else if ( current == '*' ) else if ( current == '*' )
{ {
token.Type = TokType::Comment_Start; token.Type = TokType::Comment_Start;
token.Length = 2; token.Length = 2;
Tokens.append( token ); Tokens.append( token );
Token content = { token.Text, 0, TokType::Comment, line, column, false };
move_forward(); move_forward();
// move_forward(); content.Length++;
Token content = { scanner, 0, TokType::Comment, line, column, false };
bool star = current == '*'; bool star = current == '*';
bool slash = scanner[1] == '/'; bool slash = scanner[1] == '/';
@ -902,13 +907,19 @@ namespace Parser
slash = scanner[1] == '/'; slash = scanner[1] == '/';
at_end = star && slash; at_end = star && slash;
} }
content.Length += 3;
Tokens.append( content ); Tokens.append( content );
Token end = { scanner, 2, TokType::Comment_End, line, column, false }; Token end = { scanner, 2, TokType::Comment_End, line, column, false };
Tokens.append( end );
move_forward(); move_forward();
move_forward(); move_forward();
Tokens.append( end ); while ( left && current != '\n' )
{
move_forward();
}
move_forward();
continue; continue;
} }
} }
@ -2288,7 +2299,7 @@ Code parse_simple_preprocess( Parser::TokType which )
tok.Length = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)tok.Text; tok.Length = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)tok.Text;
} }
char const* content = str_fmt_buf( "%.*s\n", tok.Length, tok.Text ); char const* content = str_fmt_buf( "%.*s ", tok.Length, tok.Text );
Code result = untyped_str( to_str( content ) ); Code result = untyped_str( to_str( content ) );
Context.Scope->Name = tok; Context.Scope->Name = tok;

View File

@ -2255,5 +2255,4 @@ CodeBody def_union_body( s32 num, CodeUnion* codes )
# undef def_body_start # undef def_body_start
# undef def_body_code_array_start # undef def_body_code_array_start
#pragma endregion Upfront #pragma endregion Upfront

View File

@ -50,7 +50,7 @@ CodeBody gen_ecode( char const* path )
CodeNS nspace = def_namespace( name(ECode), def_namespace_body( args( enum_code, to_str ) ) ); CodeNS nspace = def_namespace( name(ECode), def_namespace_body( args( enum_code, to_str ) ) );
CodeUsing code_t = def_using( name(CodeT), def_type( name(ECode::Type) ) ); CodeUsing code_t = def_using( name(CodeT), def_type( name(ECode::Type) ) );
return def_global_body( args( nspace, code_t ) ); return def_global_body( args( nspace, code_t, fmt_newline ) );
} }
CodeBody gen_eoperator( char const* path ) CodeBody gen_eoperator( char const* path )
@ -105,7 +105,7 @@ CodeBody gen_eoperator( char const* path )
CodeUsing operator_t = def_using( name(OperatorT), def_type( name(EOperator::Type) ) ); CodeUsing operator_t = def_using( name(OperatorT), def_type( name(EOperator::Type) ) );
return def_global_body( args( nspace, operator_t ) ); return def_global_body( args( nspace, operator_t, fmt_newline ) );
} }
CodeBody gen_especifier( char const* path ) CodeBody gen_especifier( char const* path )
@ -207,7 +207,7 @@ CodeBody gen_especifier( char const* path )
CodeUsing specifier_t = def_using( name(SpecifierT), def_type( name(ESpecifier::Type) ) ); CodeUsing specifier_t = def_using( name(SpecifierT), def_type( name(ESpecifier::Type) ) );
return def_global_body( args( nspace, specifier_t ) ); return def_global_body( args( nspace, specifier_t, fmt_newline ) );
} }
CodeBody gen_etoktype( char const* etok_path, char const* attr_path ) CodeBody gen_etoktype( char const* etok_path, char const* attr_path )

View File

@ -444,7 +444,7 @@ if ( $bootstrap -and (Test-Path (Join-Path $path_project "gen/gen.hpp")) )
'gen.scanner.hpp', 'gen.scanner.cpp' 'gen.scanner.hpp', 'gen.scanner.cpp'
) )
$exclude = $null $exclude = $null
format-cpp $path_gen $include $exclude # format-cpp $path_gen $include $exclude
format-cpp $path_comp_gen @( 'ast_inlines.hpp', 'ecode.hpp', 'especifier.hpp', 'eoperator.hpp', 'etoktype.cpp' ) $null format-cpp $path_comp_gen @( 'ast_inlines.hpp', 'ecode.hpp', 'especifier.hpp', 'eoperator.hpp', 'etoktype.cpp' ) $null
} }

View File

@ -86,7 +86,7 @@ int gen_main()
header.print_fmt( roll_own_dependencies_guard_start ); header.print_fmt( roll_own_dependencies_guard_start );
header.print( header_start ); header.print( header_start );
header.print_fmt( "GEN_NS_BEGIN\n\n" ); header.print_fmt( "\nGEN_NS_BEGIN\n" );
header.print( macros ); header.print( macros );
header.print( basic_types ); header.print( basic_types );
@ -102,7 +102,7 @@ int gen_main()
if ( generate_scanner ) if ( generate_scanner )
{ {
header.print_fmt( "#pragma region Parsing\n\n" ); header.print_fmt( "\n#pragma region Parsing\n" );
header.print( scan_file( project_dir "dependencies/parsing.hpp" ) ); header.print( scan_file( project_dir "dependencies/parsing.hpp" ) );
header.print_fmt( "#pragma endregion Parsing\n\n" ); header.print_fmt( "#pragma endregion Parsing\n\n" );
} }
@ -126,37 +126,37 @@ int gen_main()
header.print_fmt( "GEN_NS_BEGIN\n\n" ); header.print_fmt( "GEN_NS_BEGIN\n\n" );
header.print_fmt("#pragma region Types\n\n"); header.print_fmt("#pragma region Types\n");
header.print( types ); header.print( types );
header.print( ecode ); header.print( ecode );
header.print( eoperator ); header.print( eoperator );
header.print( especifier ); header.print( especifier );
header.print_fmt("#pragma endregion Types\n\n"); header.print_fmt("#pragma endregion Types\n\n");
header.print_fmt("#pragma region AST\n\n"); header.print_fmt("#pragma region AST\n");
header.print( ast ); header.print( ast );
header.print( ast_types ); header.print( ast_types );
header.print_fmt("#pragma endregion AST\n\n"); header.print_fmt("\n#pragma endregion AST\n");
header.print( interface ); header.print( interface );
header.print_fmt( "#pragma region Inlines\n\n" ); header.print_fmt( "\n#pragma region Inlines\n" );
header.print( inlines ); header.print( inlines );
header.print( ast_inlines ); header.print( ast_inlines );
header.print_fmt( "#pragma endregion Inlines\n\n" ); header.print_fmt( "#pragma endregion Inlines\n" );
header.print( header_end ); header.print( header_end );
if ( generate_builder ) if ( generate_builder )
{ {
header.print_fmt( "#pragma region Builder\n\n" ); header.print_fmt( "\n#pragma region Builder\n" );
header.print( scan_file( project_dir "auxillary/builder.hpp" ) ); header.print( scan_file( project_dir "auxillary/builder.hpp" ) );
header.print_fmt( "#pragma endregion Builder\n\n" ); header.print_fmt( "#pragma endregion Builder\n" );
} }
if ( generate_scanner ) if ( generate_scanner )
{ {
header.print_fmt( "#pragma region Scanner\n\n" ); header.print_fmt( "\n#pragma region Scanner\n" );
header.print( scan_file( project_dir "auxillary/scanner.hpp" ) ); header.print( scan_file( project_dir "auxillary/scanner.hpp" ) );
header.print_fmt( "#pragma endregion Scanner\n\n" ); header.print_fmt( "#pragma endregion Scanner\n\n" );
} }
@ -195,8 +195,8 @@ int gen_main()
if ( generate_scanner ) if ( generate_scanner )
{ {
header.print_fmt( "#pragma region Parsing\n\n" ); header.print_fmt( "\n#pragma region Parsing\n" );
header.print( scan_file( project_dir "dependencies/parsing.cpp" ) ); header.print( scan_file( project_dir "dependencies/parsing.cpp" ) );
header.print_fmt( "#pragma endregion Parsing\n\n" ); header.print_fmt( "#pragma endregion Parsing\n\n" );
} }
@ -215,7 +215,7 @@ int gen_main()
CodeBody etoktype = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" ); CodeBody etoktype = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" );
CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) ); CodeNS parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
header.print_fmt( "GEN_NS_BEGIN\n\n"); header.print_fmt( "\njGEN_NS_BEGIN\n");
header.print( static_data ); header.print( static_data );
header.print_fmt( "#pragma region AST\n\n" ); header.print_fmt( "#pragma region AST\n\n" );
@ -223,21 +223,21 @@ int gen_main()
header.print( ast ); header.print( ast );
header.print_fmt( "#pragma endregion AST\n\n" ); header.print_fmt( "#pragma endregion AST\n\n" );
header.print_fmt( "#pragma region Interface\n\n" ); header.print_fmt( "#pragma region Interface\n" );
header.print( interface ); header.print( interface );
header.print( upfront ); header.print( upfront );
header.print_fmt( "#pragma region Parsing\n\n" ); header.print_fmt( "\n#pragma region Parsing\n\n" );
header.print( parser_nspace ); header.print( parser_nspace );
header.print( parsing ); header.print( parsing );
header.print_fmt( "#pragma endregion Parsing\n\n" ); header.print_fmt( "\npragma endregion Parsing\n" );
header.print( untyped ); header.print( untyped );
header.print_fmt( "#pragma endregion Interface\n\n"); header.print_fmt( "\n#pragma endregion Interface\n\n");
if ( generate_builder ) if ( generate_builder )
{ {
header.print_fmt( "#pragma region Builder\n\n" ); header.print_fmt( "#pragma region Builder\n" );
header.print( scan_file( project_dir "auxillary/builder.cpp" ) ); header.print( scan_file( project_dir "auxillary/builder.cpp" ) );
header.print_fmt( "#pragma endregion Builder\n\n" ); header.print_fmt( "\npragma endregion Builder\n\n" );
} }
#if 0 #if 0