mirror of
https://github.com/Ed94/gencpp.git
synced 2025-07-08 06:35:44 -07:00
All global vars (except concepts) have been retrofitetd to the library's new Context struct
This commit is contained in:
base
base.cpp
components
ast.cppast.hpp
gen
interface.cppinterface.hppinterface.parsing.cppinterface.upfront.cpplexer.cppparser.cppparser_types.hppstatic_data.cppdependencies
gen.cppgen.hpphelpers
gen_segmented
gen_singleheader
gen_unreal_engine
@ -7,12 +7,20 @@
|
||||
https://github.com/Ed94/gencpp
|
||||
|
||||
This is a variant intended for use with Unreal Engine 5
|
||||
|
||||
! ----------------------------------------------------------------------- VERSION: v0.20-Alpha !
|
||||
! ============================================================================================ !
|
||||
! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION !
|
||||
! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL !
|
||||
! ============================================================================================ !
|
||||
https://github.com/Ed94/gencpp --------------------------------------------------------------.
|
||||
| _____ _____ _ _ |
|
||||
| / ____) / ____} | | | |
|
||||
| | / ___ ___ _ __ ___ _ __ _ __ | {___ | |__ _ _, __ _, ___ __| | |
|
||||
| | |{_ |/ _ \ '_ \ / __} '_ l| '_ l `\___ \| __/ _` |/ _` |/ _ \/ _` | |
|
||||
| | l__j | ___/ | | | {__; |+l } |+l | ____) | l| (_| | {_| | ___/ (_| | |
|
||||
| \_____|\___}_l |_|\___} ,__/| ,__/ (_____/ \__\__/_|\__, |\___}\__,_l |
|
||||
| Unreal Engine | | | | __} | |
|
||||
| l_l l_l {___/ |
|
||||
! ----------------------------------------------------------------------- VERSION: v0.20-Alpha |
|
||||
! ============================================================================================ |
|
||||
! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION |
|
||||
! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL |
|
||||
! ============================================================================================ /
|
||||
*/
|
||||
#if ! defined(GEN_DONT_ENFORCE_GEN_TIME_GUARD) && ! defined(GEN_TIME)
|
||||
# error Gen.hpp : GEN_TIME not defined
|
||||
|
@ -55,7 +55,8 @@ Code format( Code code ) {
|
||||
|
||||
int gen_main()
|
||||
{
|
||||
gen::init();
|
||||
Context ctx {};
|
||||
gen::init( & ctx);
|
||||
|
||||
Code push_ignores = scan_file( path_base "helpers/push_ignores.inline.hpp" );
|
||||
Code pop_ignores = scan_file( path_base "helpers/pop_ignores.inline.hpp" );
|
||||
@ -67,7 +68,7 @@ int gen_main()
|
||||
{
|
||||
CodeBody macros = def_body( CT_Global_Body );
|
||||
{
|
||||
FileContents content = file_read_contents( FallbackAllocator, true, path_base "dependencies/macros.hpp" );
|
||||
FileContents content = file_read_contents( ctx.Allocator_Temp, file_zero_terminate, path_base "dependencies/macros.hpp" );
|
||||
CodeBody ori_macros = parse_global_body( Str { (char const*)content.data, content.size });
|
||||
|
||||
for (Code code = ori_macros.begin();
|
||||
@ -175,6 +176,7 @@ int gen_main()
|
||||
{
|
||||
Code header_start = scan_file( "components/header_start.hpp" );
|
||||
Code types = scan_file( path_base "components/types.hpp" );
|
||||
Code parser_types = scan_file( path_base "components/parser_types.hpp");
|
||||
Code ast = scan_file( path_base "components/ast.hpp" );
|
||||
Code ast_types = scan_file( path_base "components/ast_types.hpp" );
|
||||
Code code_types = scan_file( path_base "components/code_types.hpp" );
|
||||
@ -187,6 +189,11 @@ int gen_main()
|
||||
CodeBody especifier = gen_especifier( path_base "enums/ESpecifier.csv" );
|
||||
CodeBody ast_inlines = gen_ast_inlines();
|
||||
|
||||
// Note(Ed): The Attribute tokens need to be expanded and regenerated on a per-project/installation of this library for a specific codebase of Unreal.
|
||||
// We can support an arbitrary set of modules or plugin apis for parsing
|
||||
// but its up to the user to define them all (This will just provide whats I've used up till now).
|
||||
CodeBody etoktype = gen_etoktype( path_base "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
||||
|
||||
Builder
|
||||
header = Builder::open( "gen/gen.hpp" );
|
||||
header.print_fmt( generation_notice );
|
||||
@ -205,6 +212,8 @@ int gen_main()
|
||||
header.print( fmt_newline );
|
||||
header.print( format(especifier) );
|
||||
header.print( fmt_newline );
|
||||
header.print( format(etoktype) );
|
||||
header.print( parser_types );
|
||||
header.print_fmt( "#pragma endregion Types\n\n" );
|
||||
|
||||
header.print_fmt( "#pragma region AST\n" );
|
||||
@ -230,7 +239,7 @@ int gen_main()
|
||||
|
||||
// gen.cpp
|
||||
{
|
||||
Code src_start = scan_file( "components/src_start.cpp" );
|
||||
Code src_start = scan_file( "components/src_start.cpp" );
|
||||
Code static_data = scan_file( path_base "components/static_data.cpp" );
|
||||
Code ast_case_macros = scan_file( path_base "components/ast_case_macros.cpp" );
|
||||
Code ast = scan_file( path_base "components/ast.cpp" );
|
||||
@ -242,11 +251,6 @@ int gen_main()
|
||||
Code parsing_interface = scan_file( path_base "components/interface.parsing.cpp" );
|
||||
Code untyped = scan_file( path_base "components/interface.untyped.cpp" );
|
||||
|
||||
// Note(Ed): The Attribute tokens need to be expanded and regenerated on a per-project/installation of this library for a specific codebase of Unreal.
|
||||
// We can support an arbitrary set of modules or plugin apis for parsing
|
||||
// but its up to the user to define them all (This will just provide whats I've used up till now).
|
||||
CodeBody etoktype = gen_etoktype( path_base "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
||||
|
||||
Builder
|
||||
src = Builder::open( "gen/gen.cpp" );
|
||||
src.print_fmt( generation_notice );
|
||||
@ -268,7 +272,6 @@ int gen_main()
|
||||
src.print( interface );
|
||||
src.print( upfront );
|
||||
src.print_fmt( "\n#pragma region Parsing\n\n" );
|
||||
src.print( format(etoktype) );
|
||||
src.print( lexer );
|
||||
src.print( parser );
|
||||
src.print( parsing_interface );
|
||||
|
Reference in New Issue
Block a user