bootstrap and singleheader compile and generate.

This commit is contained in:
Edward R. Gonzalez 2023-07-29 12:25:38 -04:00
parent 689646c393
commit 108b16739f
5 changed files with 69 additions and 56 deletions

View File

@ -1738,7 +1738,6 @@ internal
Code parse_class_struct( Parser::TokType which )
{
using namespace Parser;
push_scope();
if ( which != TokType::Decl_Class && which != TokType::Decl_Struct )
{
@ -1814,7 +1813,6 @@ Code parse_class_struct( Parser::TokType which )
result = def_struct( name, body, (CodeType)parent, access, attributes, mflags );
interfaces.free();
Context.pop();
return result;
}
@ -1865,7 +1863,6 @@ CodeBody parse_global_nspace( CodeT which )
{
using namespace Parser;
using namespace ECode;
push_scope();
if ( which != Namespace_Body && which != Global_Body && which != Export_Body && which != Extern_Linkage_Body )
return CodeInvalid;
@ -2024,7 +2021,6 @@ CodeBody parse_global_nspace( CodeT which )
if ( which != Global_Body )
eat( TokType::BraceCurly_Close );
Context.pop();
return result;
}
@ -2047,6 +2043,7 @@ CodeClass parse_class( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
push_scope();
CodeClass result = (CodeClass) parse_class_struct( TokType::Decl_Class );
Context.pop();
@ -2171,6 +2168,7 @@ CodeEnum parse_enum( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_enum();
}
@ -2193,6 +2191,7 @@ CodeBody parse_export_body( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_export_body();
}
@ -2247,6 +2246,7 @@ CodeExtern parse_extern_link( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_extern_link();
}
@ -2309,6 +2309,7 @@ CodeFriend parse_friend( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_friend();
}
@ -2388,6 +2389,7 @@ CodeFn parse_function( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return (CodeFn) parse_functon();
}
@ -2400,6 +2402,7 @@ CodeBody parse_global_body( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
push_scope();
CodeBody result = parse_global_nspace( ECode::Global_Body );
Context.pop();
@ -2440,6 +2443,7 @@ CodeNamespace parse_namespace( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_namespace();
}
@ -2512,6 +2516,7 @@ CodeOperator parse_operator( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return (CodeOperator) parse_operator();
}
@ -2589,6 +2594,7 @@ CodeOpCast parse_operator_cast( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_operator_cast();
}
@ -2611,6 +2617,7 @@ CodeStruct parse_struct( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return (CodeStruct) parse_class_struct( TokType::Decl_Struct );
}
@ -2738,6 +2745,7 @@ CodeTemplate parse_template( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_template();
}
@ -2927,6 +2935,7 @@ CodeType parse_type( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_type();
}
@ -3004,6 +3013,7 @@ CodeTypedef parse_typedef( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_typedef();
}
@ -3078,6 +3088,7 @@ CodeUnion parse_union( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_union();
}
@ -3167,6 +3178,7 @@ CodeUsing parse_using( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_using();
}
@ -3252,6 +3264,7 @@ CodeVar parse_variable( StrC def )
if ( toks.Arr == nullptr )
return CodeInvalid;
Context.Tokens = toks;
return parse_variable();
}

View File

@ -129,7 +129,7 @@ int gen_main()
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
// TODO : Make this optional to include
Code builder = scan_file( "file_proecessors/builder.hpp" );
Code builder = scan_file( "file_processors/builder.hpp" );
Builder
header;
@ -160,7 +160,7 @@ int gen_main()
// gen.cpp
{
Code impl_start = scan_file( "components/gen.impl_start.cpp" );
Code impl_start = scan_file( "components/impl_start.cpp" );
CodeInclude header = def_include( txt_StrC("gen.hpp") );
Code data = scan_file( "components/static_data.cpp" );
Code ast_case_macros = scan_file( "components/ast_case_macros.cpp" );
@ -174,7 +174,7 @@ int gen_main()
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
// TODO : Make this optional to include
Code builder = scan_file( "file_proecessors/builder.cpp" );
Code builder = scan_file( "file_processors/builder.cpp" );
Builder
impl;

View File

@ -3,7 +3,7 @@
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Right
AlignArrayOfStructures: Left
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
@ -61,7 +61,7 @@ BraceWrapping:
BeforeLambdaBody: false
BeforeWhile: false
# BreakAfterAttributes: Always
BreakAfterAttributes: Always
# BreakArrays: false
# BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeBinaryOperators: NonAssignment
@ -96,7 +96,7 @@ IncludeBlocks: Preserve
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: false
IndentGotoLabels: true
IndentPPDirectives: AfterHash
IndentRequires: true
IndentWidth: 4
@ -127,7 +127,7 @@ SeparateDefinitionBlocks: Always
ShortNamespaceLines: 40
SortIncludes: true
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false

View File

@ -2,8 +2,8 @@
#define GEN_ENFORCE_STRONG_CODE_TYPES
#define GEN_EXPOSE_BACKEND
#include "gen.cpp"
#include "filesystem/gen.scanner.hpp"
#include "helpers/gen.helper.hpp"
#include "file_processors/scanner.hpp"
#include "helpers/helper.hpp"
using namespace gen;
@ -59,10 +59,10 @@ int gen_main()
#define project_dir "../project/"
Code push_ignores = scan_file( project_dir "helpers/gen.push_ignores.inline.hpp" );
Code pop_ignores = scan_file( project_dir "helpers/gen.pop_ignores.inline.hpp" );
Code push_ignores = scan_file( project_dir "helpers/push_ignores.inline.hpp" );
Code pop_ignores = scan_file( project_dir "helpers/pop_ignores.inline.hpp" );
Code header_start = scan_file( "components/gen.header_start.hpp" );
Code header_start = scan_file( "components/header_start.hpp" );
Code nspace_macro = untyped_str( namespace_by_default ? nspace_default : nspace_non_default );
Builder
@ -80,19 +80,19 @@ int gen_main()
{
header.print_fmt( roll_own_dependencies_guard_start );
Code header_start = scan_file( project_dir "dependencies/gen.header_start.hpp" );
Code macros = scan_file( project_dir "dependencies/gen.macros.hpp" );
Code basic_types = scan_file( project_dir "dependencies/gen.basic_types.hpp" );
Code debug = scan_file( project_dir "dependencies/gen.debug.hpp" );
Code memory = scan_file( project_dir "dependencies/gen.memory.hpp" );
Code string_ops = scan_file( project_dir "dependencies/gen.string_ops.hpp" );
Code printing = scan_file( project_dir "dependencies/gen.printing.hpp" );
Code containers = scan_file( project_dir "dependencies/gen.containers.hpp" );
Code hashing = scan_file( project_dir "dependencies/gen.hashing.hpp" );
Code string = scan_file( project_dir "dependencies/gen.string.hpp" );
Code file_handling = scan_file( project_dir "dependencies/gen.file_handling.hpp" );
Code parsing = scan_file( project_dir "dependencies/gen.parsing.hpp" );
Code timing = scan_file( project_dir "dependencies/gen.timing.hpp" );
Code header_start = scan_file( project_dir "dependencies/header_start.hpp" );
Code macros = scan_file( project_dir "dependencies/macros.hpp" );
Code basic_types = scan_file( project_dir "dependencies/basic_types.hpp" );
Code debug = scan_file( project_dir "dependencies/debug.hpp" );
Code memory = scan_file( project_dir "dependencies/memory.hpp" );
Code string_ops = scan_file( project_dir "dependencies/string_ops.hpp" );
Code printing = scan_file( project_dir "dependencies/printing.hpp" );
Code containers = scan_file( project_dir "dependencies/containers.hpp" );
Code hashing = scan_file( project_dir "dependencies/hashing.hpp" );
Code string = scan_file( project_dir "dependencies/string.hpp" );
Code file_handling = scan_file( project_dir "dependencies/file_handling.hpp" );
Code parsing = scan_file( project_dir "dependencies/parsing.hpp" );
Code timing = scan_file( project_dir "dependencies/timing.hpp" );
header.print( header_start );
header.print_fmt( "GEN_NS_BEGIN\n\n" );
@ -113,16 +113,16 @@ int gen_main()
header.print_fmt( roll_own_dependencies_guard_end );
}
Code types = scan_file( project_dir "components/gen.types.hpp" );
Code data_structs = scan_file( project_dir "components/gen.data_structures.hpp" );
Code interface = scan_file( project_dir "components/gen.interface.hpp" );
Code header_end = scan_file( project_dir "components/gen.header_end.hpp" );
Code types = scan_file( project_dir "components/types.hpp" );
Code data_structs = scan_file( project_dir "components/data_structures.hpp" );
Code interface = scan_file( project_dir "components/interface.hpp" );
Code header_end = scan_file( project_dir "components/header_end.hpp" );
CodeBody ecode = gen_ecode( project_dir "components/ECode.csv" );
CodeBody eoperator = gen_eoperator( project_dir "components/EOperator.csv" );
CodeBody especifier = gen_especifier( project_dir "components/ESpecifier.csv" );
CodeBody ecode = gen_ecode( project_dir "enums/ECode.csv" );
CodeBody eoperator = gen_eoperator( project_dir "enums/EOperator.csv" );
CodeBody especifier = gen_especifier( project_dir "enums/ESpecifier.csv" );
Code builder = scan_file( project_dir "filesystem/gen.builder.hpp" );
Code builder = scan_file( project_dir "file_processors/builder.hpp" );
header.print_fmt( "GEN_NS_BEGIN\n\n" );
@ -146,17 +146,17 @@ int gen_main()
{
header.print_fmt( roll_own_dependencies_guard_start );
Code impl_start = scan_file( project_dir "dependencies/gen.impl_start.cpp" );
Code debug = scan_file( project_dir "dependencies/gen.debug.cpp" );
Code string_ops = scan_file( project_dir "dependencies/gen.string_ops.cpp" );
Code printing = scan_file( project_dir "dependencies/gen.printing.cpp" );
Code memory = scan_file( project_dir "dependencies/gen.memory.cpp" );
Code parsing = scan_file( project_dir "dependencies/gen.parsing.cpp" );
Code hashing = scan_file( project_dir "dependencies/gen.hashing.cpp" );
Code string = scan_file( project_dir "dependencies/gen.string.cpp" );
Code timing = scan_file( project_dir "dependencies/gen.timing.cpp" );
Code impl_start = scan_file( project_dir "dependencies/impl_start.cpp" );
Code debug = scan_file( project_dir "dependencies/debug.cpp" );
Code string_ops = scan_file( project_dir "dependencies/string_ops.cpp" );
Code printing = scan_file( project_dir "dependencies/printing.cpp" );
Code memory = scan_file( project_dir "dependencies/memory.cpp" );
Code parsing = scan_file( project_dir "dependencies/parsing.cpp" );
Code hashing = scan_file( project_dir "dependencies/hashing.cpp" );
Code string = scan_file( project_dir "dependencies/string.cpp" );
Code timing = scan_file( project_dir "dependencies/timing.cpp" );
Code file_handling = scan_file( project_dir "dependencies/gen.file_handling.cpp" );
Code file_handling = scan_file( project_dir "dependencies/file_handling.cpp" );
header.print_fmt( "GEN_NS_BEGIN\n\n");
header.print( impl_start );
@ -176,18 +176,18 @@ int gen_main()
header.print_fmt( roll_own_dependencies_guard_end );
}
Code data = scan_file( project_dir "components/gen.data.cpp" );
Code ast_case_macros = scan_file( project_dir "components/gen.ast_case_macros.cpp" );
Code ast = scan_file( project_dir "components/gen.ast.cpp" );
Code interface = scan_file( project_dir "components/gen.interface.cpp" );
Code upfront = scan_file( project_dir "components/gen.interface.upfront.cpp" );
Code parsing = scan_file( project_dir "components/gen.interface.parsing.cpp" );
Code untyped = scan_file( project_dir "components/gen.untyped.cpp" );
Code data = scan_file( project_dir "components/static_data.cpp" );
Code ast_case_macros = scan_file( project_dir "components/ast_case_macros.cpp" );
Code ast = scan_file( project_dir "components/ast.cpp" );
Code interface = scan_file( project_dir "components/interface.cpp" );
Code upfront = scan_file( project_dir "components/interface.upfront.cpp" );
Code parsing = scan_file( project_dir "components/interface.parsing.cpp" );
Code untyped = scan_file( project_dir "components/untyped.cpp" );
CodeBody etoktype = gen_etoktype( project_dir "components/ETokType.csv", project_dir "components/AttributeTokens.csv" );
CodeBody etoktype = gen_etoktype( project_dir "enums/ETokType.csv", project_dir "enums/AttributeTokens.csv" );
CodeNamespace parser_nspace = def_namespace( name(Parser), def_namespace_body( args(etoktype)) );
Code builder = scan_file( project_dir "filesystem/gen.builder.cpp" );
Code builder = scan_file( project_dir "file_processors/builder.cpp" );
header.print_fmt( "GEN_NS_BEGIN\n\n");
header.print( data );