mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
Formatting fixes
This commit is contained in:
parent
a61a28b778
commit
c4846dad26
6
.vscode/c_cpp_properties.json
vendored
6
.vscode/c_cpp_properties.json
vendored
@ -9,7 +9,8 @@
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE",
|
||||
"GEN_TIME"
|
||||
"GEN_TIME",
|
||||
"GEN_IMPLEMENTATION"
|
||||
// "GEN_DONT_USE_NAMESPACE"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.19041.0",
|
||||
@ -26,7 +27,8 @@
|
||||
"_DEBUG",
|
||||
"UNICODE",
|
||||
"_UNICODE",
|
||||
"GEN_TIME"
|
||||
"GEN_TIME",
|
||||
"GEN_IMPLEMENTATION"
|
||||
// "GEN_DONT_USE_NAMESPACE"
|
||||
],
|
||||
"windowsSdkVersion": "10.0.19041.0",
|
||||
|
@ -63,7 +63,7 @@ int gen_main()
|
||||
header.print( filesystem );
|
||||
header.print( timing );
|
||||
|
||||
header.print_fmt( "GEN_NS_END\n" );
|
||||
header.print_fmt( "\nGEN_NS_END\n" );
|
||||
header.write();
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ int gen_main()
|
||||
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( src_start );
|
||||
src.print_fmt( "GEN_NS_BEGIN\n\n" );
|
||||
src.print_fmt( "\nGEN_NS_BEGIN\n" );
|
||||
|
||||
src.print( debug );
|
||||
src.print( string_ops );
|
||||
@ -95,7 +95,7 @@ int gen_main()
|
||||
src.print( filesystem );
|
||||
src.print( timing );
|
||||
|
||||
src.print_fmt( "GEN_NS_END\n\n" );
|
||||
src.print_fmt( "\nGEN_NS_END\n" );
|
||||
src.write();
|
||||
}
|
||||
|
||||
@ -120,26 +120,27 @@ int gen_main()
|
||||
header.print_fmt( "#pragma once\n\n" );
|
||||
header.print( push_ignores );
|
||||
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( ecode );
|
||||
header.print( eoperator );
|
||||
header.print( especifier );
|
||||
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_types );
|
||||
header.print_fmt( "#pragma endregion AST\n\n" );
|
||||
header.print_fmt( "\n#pragma endregion AST\n" );
|
||||
|
||||
header.print( interface );
|
||||
|
||||
header.print_fmt( "#pragma region Inlines\n\n" );
|
||||
header.print_fmt( "\npragma region Inlines\n" );
|
||||
header.print( inlines );
|
||||
header.print( fmt_newline );
|
||||
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_fmt( "GEN_NS_END\n\n" );
|
||||
@ -148,29 +149,29 @@ int gen_main()
|
||||
|
||||
Builder
|
||||
header_ecode = Builder::open( "components/gen/ecode.hpp" );
|
||||
header_ecode.print_fmt( generation_notice );
|
||||
header_ecode.print( pragma_once );
|
||||
header_ecode.print_fmt( generation_notice );
|
||||
header_ecode.print( ecode );
|
||||
header_ecode.write();
|
||||
|
||||
Builder
|
||||
header_eoperator = Builder::open( "components/gen/eoperator.hpp" );
|
||||
header_eoperator.print_fmt( generation_notice );
|
||||
header_eoperator.print( pragma_once );
|
||||
header_eoperator.print_fmt( generation_notice );
|
||||
header_eoperator.print( eoperator );
|
||||
header_eoperator.write();
|
||||
|
||||
Builder
|
||||
header_especifier = Builder::open( "components/gen/especifier.hpp" );
|
||||
header_especifier.print_fmt( generation_notice );
|
||||
header_especifier.print( pragma_once );
|
||||
header_especifier.print_fmt( generation_notice );
|
||||
header_especifier.print( especifier );
|
||||
header_especifier.write();
|
||||
|
||||
Builder
|
||||
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_fmt( generation_notice );
|
||||
header_ast_inlines.print( ast_inlines );
|
||||
header_ast_inlines.write();
|
||||
}
|
||||
@ -194,23 +195,23 @@ int gen_main()
|
||||
src.print_fmt( generation_notice );
|
||||
src.print( push_ignores );
|
||||
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_fmt( "#pragma region AST\n\n" );
|
||||
src.print_fmt( "\n#pragma region AST\n\n" );
|
||||
src.print( ast_case_macros );
|
||||
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( upfront );
|
||||
src.print_fmt( "#pragma region Parsing\n\n" );
|
||||
src.print_fmt( "\n#pragma region Parsing\n\n" );
|
||||
src.print( nspaced_etoktype );
|
||||
src.print( parsing );
|
||||
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( "GEN_NS_END\n\n");
|
||||
@ -234,9 +235,9 @@ int gen_main()
|
||||
header.print_fmt( generation_notice );
|
||||
header.print_fmt( "#pragma once\n\n" );
|
||||
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_fmt( "\nGEN_NS_END\n\n" );
|
||||
header.print_fmt( "GEN_NS_END\n" );
|
||||
header.write();
|
||||
}
|
||||
|
||||
@ -248,9 +249,9 @@ int gen_main()
|
||||
src = Builder::open( "gen/gen.builder.cpp" );
|
||||
src.print_fmt( generation_notice );
|
||||
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_fmt( "\nGEN_NS_END\n\n" );
|
||||
src.print_fmt( "\nGEN_NS_END\n" );
|
||||
src.write();
|
||||
}
|
||||
|
||||
@ -264,10 +265,10 @@ int gen_main()
|
||||
header.print_fmt( generation_notice );
|
||||
header.print_fmt( "#pragma once\n\n" );
|
||||
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( scanner );
|
||||
header.print_fmt( "\nGEN_NS_END\n\n" );
|
||||
header.print_fmt( "GEN_NS_END\n" );
|
||||
header.write();
|
||||
}
|
||||
|
||||
@ -280,10 +281,10 @@ int gen_main()
|
||||
src = Builder::open( "gen/gen.scanner.cpp" );
|
||||
src.print_fmt( generation_notice );
|
||||
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( scanner );
|
||||
src.print_fmt( "\nGEN_NS_END\n\n" );
|
||||
src.print_fmt( "GEN_NS_END\n" );
|
||||
src.write();
|
||||
}
|
||||
|
||||
|
@ -76,4 +76,3 @@
|
||||
case Specifiers: \
|
||||
case Struct_Body: \
|
||||
case Typename:
|
||||
|
||||
|
@ -541,4 +541,5 @@ struct AST_Var
|
||||
char _PAD_UNUSED_[ sizeof(u32) ];
|
||||
};
|
||||
static_assert( sizeof(AST_Var) == sizeof(AST), "ERROR: AST_Var is not the same size as AST");
|
||||
|
||||
#pragma endregion AST Types
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#pragma once
|
||||
#pragma region generated code inline implementation
|
||||
|
||||
char const* Code::debug_str( void )
|
||||
|
@ -1,7 +1,7 @@
|
||||
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#pragma once
|
||||
|
||||
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
namespace ECode
|
||||
{
|
||||
enum Type : u32
|
||||
|
@ -1,7 +1,7 @@
|
||||
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#pragma once
|
||||
|
||||
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
namespace EOperator
|
||||
{
|
||||
enum Type : u32
|
||||
|
@ -1,7 +1,7 @@
|
||||
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
#pragma once
|
||||
|
||||
// This file was generated automatially by gen.bootstrap.cpp (See: https://github.com/Ed94/gencpp)
|
||||
|
||||
namespace ESpecifier
|
||||
{
|
||||
enum Type : u32
|
||||
|
@ -401,6 +401,11 @@ namespace Parser
|
||||
if ( token.Type == TokType::Preprocess_Else || token.Type == TokType::Preprocess_EndIf )
|
||||
{
|
||||
Tokens.append( token );
|
||||
while ( left && current != '\n' )
|
||||
{
|
||||
move_forward();
|
||||
}
|
||||
move_forward();
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -886,9 +891,9 @@ namespace Parser
|
||||
token.Length = 2;
|
||||
Tokens.append( token );
|
||||
|
||||
Token content = { token.Text, 0, TokType::Comment, line, column, false };
|
||||
move_forward();
|
||||
// move_forward();
|
||||
Token content = { scanner, 0, TokType::Comment, line, column, false };
|
||||
content.Length++;
|
||||
|
||||
bool star = current == '*';
|
||||
bool slash = scanner[1] == '/';
|
||||
@ -902,13 +907,19 @@ namespace Parser
|
||||
slash = scanner[1] == '/';
|
||||
at_end = star && slash;
|
||||
}
|
||||
content.Length += 3;
|
||||
Tokens.append( content );
|
||||
|
||||
Token end = { scanner, 2, TokType::Comment_End, line, column, false };
|
||||
Tokens.append( end );
|
||||
move_forward();
|
||||
move_forward();
|
||||
|
||||
Tokens.append( end );
|
||||
while ( left && current != '\n' )
|
||||
{
|
||||
move_forward();
|
||||
}
|
||||
move_forward();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -2288,7 +2299,7 @@ Code parse_simple_preprocess( Parser::TokType which )
|
||||
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 ) );
|
||||
Context.Scope->Name = tok;
|
||||
|
@ -2255,5 +2255,4 @@ CodeBody def_union_body( s32 num, CodeUnion* codes )
|
||||
# undef def_body_start
|
||||
# undef def_body_code_array_start
|
||||
|
||||
|
||||
#pragma endregion Upfront
|
||||
|
@ -50,7 +50,7 @@ CodeBody gen_ecode( char const* path )
|
||||
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) ) );
|
||||
|
||||
return def_global_body( args( nspace, code_t ) );
|
||||
return def_global_body( args( nspace, code_t, fmt_newline ) );
|
||||
}
|
||||
|
||||
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) ) );
|
||||
|
||||
return def_global_body( args( nspace, operator_t ) );
|
||||
return def_global_body( args( nspace, operator_t, fmt_newline ) );
|
||||
}
|
||||
|
||||
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) ) );
|
||||
|
||||
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 )
|
||||
|
@ -444,7 +444,7 @@ if ( $bootstrap -and (Test-Path (Join-Path $path_project "gen/gen.hpp")) )
|
||||
'gen.scanner.hpp', 'gen.scanner.cpp'
|
||||
)
|
||||
$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
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ int gen_main()
|
||||
|
||||
header.print_fmt( roll_own_dependencies_guard_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( basic_types );
|
||||
@ -102,7 +102,7 @@ int gen_main()
|
||||
|
||||
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_fmt( "#pragma endregion Parsing\n\n" );
|
||||
}
|
||||
@ -126,37 +126,37 @@ int gen_main()
|
||||
|
||||
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( ecode );
|
||||
header.print( eoperator );
|
||||
header.print( especifier );
|
||||
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_types );
|
||||
header.print_fmt("#pragma endregion AST\n\n");
|
||||
header.print_fmt("\n#pragma endregion AST\n");
|
||||
|
||||
header.print( interface );
|
||||
|
||||
header.print_fmt( "#pragma region Inlines\n\n" );
|
||||
header.print_fmt( "\n#pragma region Inlines\n" );
|
||||
header.print( inlines );
|
||||
header.print( ast_inlines );
|
||||
header.print_fmt( "#pragma endregion Inlines\n\n" );
|
||||
header.print_fmt( "#pragma endregion Inlines\n" );
|
||||
|
||||
header.print( header_end );
|
||||
|
||||
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_fmt( "#pragma endregion Builder\n\n" );
|
||||
header.print_fmt( "#pragma endregion Builder\n" );
|
||||
}
|
||||
|
||||
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_fmt( "#pragma endregion Scanner\n\n" );
|
||||
}
|
||||
@ -195,7 +195,7 @@ int gen_main()
|
||||
|
||||
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_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" );
|
||||
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_fmt( "#pragma region AST\n\n" );
|
||||
@ -223,21 +223,21 @@ int gen_main()
|
||||
header.print( ast );
|
||||
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( upfront );
|
||||
header.print_fmt( "#pragma region Parsing\n\n" );
|
||||
header.print_fmt( "\n#pragma region Parsing\n\n" );
|
||||
header.print( parser_nspace );
|
||||
header.print( parsing );
|
||||
header.print_fmt( "#pragma endregion Parsing\n\n" );
|
||||
header.print_fmt( "\npragma endregion Parsing\n" );
|
||||
header.print( untyped );
|
||||
header.print_fmt( "#pragma endregion Interface\n\n");
|
||||
header.print_fmt( "\n#pragma endregion Interface\n\n");
|
||||
|
||||
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_fmt( "#pragma endregion Builder\n\n" );
|
||||
header.print_fmt( "\npragma endregion Builder\n\n" );
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
Loading…
Reference in New Issue
Block a user