2024-10-24 22:04:48 -07:00
|
|
|
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
|
|
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
2024-10-25 09:54:55 -07:00
|
|
|
#define GEN_EXPOSE_BACKEND
|
2024-10-24 22:04:48 -07:00
|
|
|
#include "gen.cpp"
|
|
|
|
#include "helpers/push_ignores.inline.hpp"
|
2024-12-10 23:04:22 -08:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
2024-10-24 22:04:48 -07:00
|
|
|
|
|
|
|
GEN_NS_BEGIN
|
2024-12-10 23:04:22 -08:00
|
|
|
#include "helpers/base_codegen.hpp"
|
|
|
|
#include "helpers/misc.hpp"
|
2024-10-24 22:04:48 -07:00
|
|
|
GEN_NS_END
|
|
|
|
|
|
|
|
using namespace gen;
|
|
|
|
|
|
|
|
constexpr char const* generation_notice =
|
2024-10-25 02:01:37 -07:00
|
|
|
"// This file was generated automatially by gencpp's unreal.cpp "
|
2024-10-24 22:04:48 -07:00
|
|
|
"(See: https://github.com/Ed94/gencpp)\n\n";
|
|
|
|
|
2024-12-12 09:55:15 -08:00
|
|
|
constexpr Str implementation_guard_start = txt(R"(
|
2024-10-24 22:04:48 -07:00
|
|
|
#pragma region GENCPP IMPLEMENTATION GUARD
|
|
|
|
#if defined(GEN_IMPLEMENTATION) && ! defined(GEN_IMPLEMENTED)
|
|
|
|
# define GEN_IMPLEMENTED
|
|
|
|
)");
|
|
|
|
|
2024-12-12 09:55:15 -08:00
|
|
|
constexpr Str implementation_guard_end = txt(R"(
|
2024-10-24 22:04:48 -07:00
|
|
|
#endif
|
|
|
|
#pragma endregion GENCPP IMPLEMENTATION GUARD
|
|
|
|
)");
|
|
|
|
|
2024-12-12 09:55:15 -08:00
|
|
|
constexpr Str roll_own_dependencies_guard_start = txt(R"(
|
2024-10-24 22:04:48 -07:00
|
|
|
//! If its desired to roll your own dependencies, define GEN_ROLL_OWN_DEPENDENCIES before including this file.
|
|
|
|
// Dependencies are derived from the c-zpl library: https://github.com/zpl-c/zpl
|
|
|
|
#ifndef GEN_ROLL_OWN_DEPENDENCIES
|
|
|
|
|
|
|
|
)");
|
|
|
|
|
2024-12-12 09:55:15 -08:00
|
|
|
constexpr Str roll_own_dependencies_guard_end = txt(R"(
|
2024-10-24 22:04:48 -07:00
|
|
|
// GEN_ROLL_OWN_DEPENDENCIES
|
|
|
|
#endif
|
|
|
|
)");
|
|
|
|
|
|
|
|
global bool generate_gen_dep = true;
|
|
|
|
global bool generate_builder = true;
|
|
|
|
global bool generate_editor = true;
|
|
|
|
global bool generate_scanner = true;
|
|
|
|
|
2024-12-10 23:04:22 -08:00
|
|
|
#define path_format_style "../scripts/.clang-format "
|
|
|
|
#define scratch_file "gen/scratch.hpp"
|
|
|
|
#define path_base "../base/"
|
2024-10-27 17:01:54 -07:00
|
|
|
|
2024-12-10 23:04:22 -08:00
|
|
|
Code format( Code code ) {
|
|
|
|
return code_refactor_and_format(code, scratch_file, nullptr, path_format_style );
|
2024-10-27 17:01:54 -07:00
|
|
|
}
|
|
|
|
|
2024-10-24 22:04:48 -07:00
|
|
|
int gen_main()
|
|
|
|
{
|
2024-12-13 17:40:18 -08:00
|
|
|
Context ctx {};
|
|
|
|
gen::init( & ctx);
|
2024-10-24 22:04:48 -07:00
|
|
|
|
2024-12-10 23:04:22 -08:00
|
|
|
Code push_ignores = scan_file( path_base "helpers/push_ignores.inline.hpp" );
|
|
|
|
Code pop_ignores = scan_file( path_base "helpers/pop_ignores.inline.hpp" );
|
2024-10-24 22:04:48 -07:00
|
|
|
|
|
|
|
Code ue_forceinline = code_str(FORCEINLINE);
|
|
|
|
// Code
|
2024-10-25 00:00:07 -07:00
|
|
|
|
2024-12-15 07:08:28 -08:00
|
|
|
register_macros( args(
|
|
|
|
(Macro { txt("bit"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("bitfield_is_set"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("GEN_C_LIKE_CPP"), MT_Expression, MF_Null }),
|
|
|
|
(Macro { txt("cast"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("ccast"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("rcast"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("pcast"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("scast"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("stringize_va"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("stringize"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("do_once"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("do_once_defer"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("do_once_start"), MT_Statement, MF_Null }),
|
|
|
|
(Macro { txt("do_once_end"), MT_Statement, MF_Null }),
|
|
|
|
(Macro { txt("labeled_scope_start"), MT_Statement, MF_Null }),
|
|
|
|
(Macro { txt("labeled_scope_end"), MT_Statement, MF_Null }),
|
|
|
|
(Macro { txt("compiler_decorated_func_name"), MT_Expression, MF_Null }),
|
|
|
|
(Macro { txt("num_args_impl"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("num_args"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("count_of"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("clamp"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("is_between"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("size_of"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("min"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("max"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("offset_of"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("static_assert"), MT_Statement, MF_Functional }),
|
|
|
|
(Macro { txt("typeof"), MT_Expression, MF_Null }),
|
|
|
|
(Macro { txt("GEN_API_C_BEGIN"), MT_Statement, MF_Null }),
|
|
|
|
(Macro { txt("GEN_API_C_END"), MT_Statement, MF_Null }),
|
|
|
|
(Macro { txt("nullptr"), MT_Expression, MF_Null }),
|
|
|
|
(Macro { txt("GEN_REMOVE_PTR"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("GEN_PARAM_DEFAULT"), MT_Expression, MF_Null }),
|
|
|
|
(Macro { txt("struct_init"), MT_Expression, MF_Functional }),
|
|
|
|
(Macro { txt("GEN_OPTIMIZE_MAPPINGS_BEGIN"), MT_Statement, MF_Null }),
|
2024-12-15 19:53:32 -08:00
|
|
|
(Macro { txt("GEN_OPITMIZE_MAPPINGS_END"), MT_Statement, MF_Null }),
|
|
|
|
(Macro { txt("src_line_str"), MT_Expression, MF_Null })
|
2024-12-14 20:10:23 -08:00
|
|
|
));
|
|
|
|
|
2024-10-25 00:00:07 -07:00
|
|
|
// gen_dep.hpp
|
|
|
|
{
|
2024-12-10 10:57:12 -08:00
|
|
|
CodeBody macros = def_body( CT_Global_Body );
|
2024-10-25 00:00:07 -07:00
|
|
|
{
|
2024-12-13 17:40:18 -08:00
|
|
|
FileContents content = file_read_contents( ctx.Allocator_Temp, file_zero_terminate, path_base "dependencies/macros.hpp" );
|
2024-12-13 10:20:16 -08:00
|
|
|
CodeBody ori_macros = parse_global_body( Str { (char const*)content.data, content.size });
|
2024-10-25 00:00:07 -07:00
|
|
|
|
|
|
|
for (Code code = ori_macros.begin();
|
|
|
|
code != ori_macros.end();
|
|
|
|
++ code )
|
|
|
|
{
|
|
|
|
switch (code->Type)
|
|
|
|
{
|
2024-12-10 10:57:12 -08:00
|
|
|
case CT_Preprocess_Define:
|
2024-10-25 00:00:07 -07:00
|
|
|
{
|
2024-12-10 10:57:12 -08:00
|
|
|
CodeDefine define = cast(CodeDefine, code);
|
2024-10-25 00:00:07 -07:00
|
|
|
if ( define->Name.starts_with(txt("global")) )
|
|
|
|
{
|
|
|
|
macros.append(parse_global_body(txt("#define global // Global variables")));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
macros.append(define);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
macros.append(code);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-12-10 23:04:22 -08:00
|
|
|
Code platform = scan_file( path_base "dependencies/platform.hpp" );
|
|
|
|
Code basic_types = scan_file( path_base "dependencies/basic_types.hpp" );
|
|
|
|
Code debug = scan_file( path_base "dependencies/debug.hpp" );
|
|
|
|
Code memory = scan_file( path_base "dependencies/memory.hpp" );
|
|
|
|
Code string_ops = scan_file( path_base "dependencies/string_ops.hpp" );
|
|
|
|
Code printing = scan_file( path_base "dependencies/printing.hpp" );
|
|
|
|
Code containers = scan_file( path_base "dependencies/containers.hpp" );
|
|
|
|
Code hashing = scan_file( path_base "dependencies/hashing.hpp" );
|
|
|
|
Code strings = scan_file( path_base "dependencies/strings.hpp" );
|
|
|
|
Code filesystem = scan_file( path_base "dependencies/filesystem.hpp" );
|
|
|
|
Code timing = scan_file( path_base "dependencies/timing.hpp" );
|
2024-12-15 14:52:31 -08:00
|
|
|
Code parsing = scan_file( path_base "dependencies/parsing.hpp" );
|
2024-10-25 00:00:07 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
header = Builder::open("gen/gen.dep.hpp");
|
|
|
|
header.print_fmt( generation_notice );
|
2024-10-27 17:01:54 -07:00
|
|
|
header.print( pragma_once );
|
|
|
|
header.print( push_ignores );
|
|
|
|
header.print( platform );
|
2024-10-25 00:00:07 -07:00
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n" );
|
|
|
|
|
2024-10-27 17:01:54 -07:00
|
|
|
header.print( fmt_newline);
|
2024-12-10 23:04:22 -08:00
|
|
|
header.print( format(macros) );
|
2024-10-25 00:00:07 -07:00
|
|
|
header.print( basic_types );
|
|
|
|
header.print( debug );
|
|
|
|
header.print( memory );
|
|
|
|
header.print( string_ops );
|
|
|
|
header.print( printing );
|
|
|
|
header.print( containers );
|
|
|
|
header.print( hashing );
|
|
|
|
header.print( strings );
|
|
|
|
header.print( filesystem );
|
|
|
|
header.print( timing );
|
2024-12-15 14:52:31 -08:00
|
|
|
header.print(parsing);
|
2024-10-25 00:00:07 -07:00
|
|
|
|
|
|
|
header.print_fmt( "\nGEN_NS_END\n" );
|
|
|
|
header.print( fmt_newline );
|
|
|
|
header.print( pop_ignores );
|
|
|
|
header.write();
|
|
|
|
}
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
// gen_dep.cpp
|
|
|
|
{
|
2024-12-10 23:04:22 -08:00
|
|
|
Code src_start = scan_file( path_base "dependencies/src_start.cpp" );
|
|
|
|
Code debug = scan_file( path_base "dependencies/debug.cpp" );
|
|
|
|
Code string_ops = scan_file( path_base "dependencies/string_ops.cpp" );
|
|
|
|
Code printing = scan_file( path_base "dependencies/printing.cpp" );
|
|
|
|
Code memory = scan_file( path_base "dependencies/memory.cpp" );
|
|
|
|
Code hashing = scan_file( path_base "dependencies/hashing.cpp" );
|
|
|
|
Code strings = scan_file( path_base "dependencies/strings.cpp" );
|
|
|
|
Code filesystem = scan_file( path_base "dependencies/filesystem.cpp" );
|
|
|
|
Code timing = scan_file( path_base "dependencies/timing.cpp" );
|
2024-12-15 14:52:31 -08:00
|
|
|
Code parsing = scan_file( path_base "dependencies/parsing.cpp" );
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
src = Builder::open( "gen/gen.dep.cpp" );
|
|
|
|
src.print_fmt( generation_notice );
|
|
|
|
src.print( def_include(txt("gen.dep.hpp")));
|
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print( push_ignores );
|
|
|
|
src.print( src_start );
|
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n" );
|
|
|
|
|
|
|
|
src.print( debug );
|
|
|
|
src.print( string_ops );
|
|
|
|
src.print( printing );
|
|
|
|
src.print( hashing );
|
|
|
|
src.print( memory );
|
|
|
|
src.print( strings );
|
|
|
|
src.print( filesystem );
|
|
|
|
src.print( timing );
|
2024-12-15 14:52:31 -08:00
|
|
|
src.print( parsing );
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
src.print_fmt( "\nGEN_NS_END\n" );
|
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print( pop_ignores );
|
|
|
|
src.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen.hpp
|
|
|
|
{
|
2024-12-11 10:33:35 -08:00
|
|
|
Code header_start = scan_file( "components/header_start.hpp" );
|
2024-12-10 23:04:22 -08:00
|
|
|
Code types = scan_file( path_base "components/types.hpp" );
|
2024-12-13 17:40:18 -08:00
|
|
|
Code parser_types = scan_file( path_base "components/parser_types.hpp");
|
2024-12-10 23:04:22 -08:00
|
|
|
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" );
|
|
|
|
Code interface = scan_file( path_base "components/interface.hpp" );
|
|
|
|
Code inlines = scan_file( path_base "components/inlines.hpp" );
|
|
|
|
Code header_end = scan_file( path_base "components/header_end.hpp" );
|
|
|
|
|
|
|
|
CodeBody ecode = gen_ecode ( path_base "enums/ECodeTypes.csv" );
|
|
|
|
CodeBody eoperator = gen_eoperator ( path_base "enums/EOperator.csv" );
|
2024-12-14 08:24:21 -08:00
|
|
|
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
|
2024-10-25 02:01:37 -07:00
|
|
|
CodeBody ast_inlines = gen_ast_inlines();
|
|
|
|
|
2024-12-13 17:40:18 -08:00
|
|
|
// 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).
|
2024-12-14 08:24:21 -08:00
|
|
|
CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
2024-12-13 17:40:18 -08:00
|
|
|
|
2024-10-25 02:01:37 -07:00
|
|
|
Builder
|
|
|
|
header = Builder::open( "gen/gen.hpp" );
|
|
|
|
header.print_fmt( generation_notice );
|
|
|
|
header.print_fmt( "#pragma once\n\n" );
|
|
|
|
header.print( push_ignores );
|
|
|
|
header.print( fmt_newline );
|
|
|
|
header.print( header_start );
|
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
|
|
|
|
|
|
|
header.print_fmt( "#pragma region Types\n" );
|
|
|
|
header.print( types );
|
2024-10-27 17:01:54 -07:00
|
|
|
header.print( fmt_newline );
|
2024-12-10 23:04:22 -08:00
|
|
|
header.print( format(ecode) );
|
2024-10-27 17:01:54 -07:00
|
|
|
header.print( fmt_newline );
|
2024-12-10 23:04:22 -08:00
|
|
|
header.print( format(eoperator) );
|
2024-10-27 17:01:54 -07:00
|
|
|
header.print( fmt_newline );
|
2024-12-10 23:04:22 -08:00
|
|
|
header.print( format(especifier) );
|
2024-10-27 17:01:54 -07:00
|
|
|
header.print( fmt_newline );
|
2024-12-13 17:40:18 -08:00
|
|
|
header.print( format(etoktype) );
|
|
|
|
header.print( parser_types );
|
2024-10-25 02:01:37 -07:00
|
|
|
header.print_fmt( "#pragma endregion Types\n\n" );
|
|
|
|
|
|
|
|
header.print_fmt( "#pragma region AST\n" );
|
|
|
|
header.print( ast );
|
|
|
|
header.print( code_types );
|
|
|
|
header.print( ast_types );
|
|
|
|
header.print_fmt( "\n#pragma endregion AST\n" );
|
|
|
|
|
|
|
|
header.print( interface );
|
|
|
|
|
|
|
|
header.print_fmt( "\n#pragma region Inlines\n" );
|
|
|
|
header.print( inlines );
|
|
|
|
header.print( fmt_newline );
|
2024-12-10 23:04:22 -08:00
|
|
|
header.print( format(ast_inlines) );
|
2024-10-27 17:01:54 -07:00
|
|
|
header.print( fmt_newline );
|
2024-10-25 02:01:37 -07:00
|
|
|
header.print_fmt( "#pragma endregion Inlines\n" );
|
|
|
|
|
|
|
|
header.print( header_end );
|
2024-12-13 12:56:57 -08:00
|
|
|
header.print_fmt( "\nGEN_NS_END\n\n" );
|
2024-10-25 02:01:37 -07:00
|
|
|
header.print( pop_ignores );
|
|
|
|
header.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen.cpp
|
|
|
|
{
|
2024-12-13 17:40:18 -08:00
|
|
|
Code src_start = scan_file( "components/src_start.cpp" );
|
2024-12-10 23:04:22 -08:00
|
|
|
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" );
|
|
|
|
Code code_serialization = scan_file( path_base "components/code_serialization.cpp" );
|
|
|
|
Code interface = scan_file( path_base "components/interface.cpp" );
|
|
|
|
Code upfront = scan_file( path_base "components/interface.upfront.cpp" );
|
|
|
|
Code lexer = scan_file( path_base "components/lexer.cpp" );
|
2024-12-14 08:24:21 -08:00
|
|
|
Code parser_case_macros = scan_file( "components/parser_case_macros.cpp" );
|
2024-12-10 23:04:22 -08:00
|
|
|
Code parser = scan_file( path_base "components/parser.cpp" );
|
|
|
|
Code parsing_interface = scan_file( path_base "components/interface.parsing.cpp" );
|
|
|
|
Code untyped = scan_file( path_base "components/interface.untyped.cpp" );
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
src = Builder::open( "gen/gen.cpp" );
|
|
|
|
src.print_fmt( generation_notice );
|
|
|
|
src.print( push_ignores );
|
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print( src_start );
|
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print_fmt( "GEN_NS_BEGIN\n");
|
|
|
|
|
|
|
|
src.print( static_data );
|
|
|
|
|
|
|
|
src.print_fmt( "\n#pragma region AST\n\n" );
|
|
|
|
src.print( ast_case_macros );
|
|
|
|
src.print( ast );
|
|
|
|
src.print( code_serialization );
|
|
|
|
src.print_fmt( "\n#pragma endregion AST\n" );
|
|
|
|
|
|
|
|
src.print_fmt( "\n#pragma region Interface\n" );
|
|
|
|
src.print( interface );
|
2024-12-15 14:52:31 -08:00
|
|
|
|
2024-10-25 02:01:37 -07:00
|
|
|
src.print( upfront );
|
2024-12-15 14:52:31 -08:00
|
|
|
|
2024-10-25 02:01:37 -07:00
|
|
|
src.print_fmt( "\n#pragma region Parsing\n\n" );
|
|
|
|
src.print( lexer );
|
2024-12-14 08:24:21 -08:00
|
|
|
src.print( parser_case_macros );
|
2024-10-25 02:01:37 -07:00
|
|
|
src.print( parser );
|
|
|
|
src.print( parsing_interface );
|
|
|
|
src.print_fmt( "\n#pragma endregion Parsing\n\n" );
|
2024-12-15 14:52:31 -08:00
|
|
|
|
|
|
|
src.print_fmt( "\n#pragma region Untyped\n\n" );
|
|
|
|
src.print( untyped );
|
|
|
|
src.print_fmt( "#pragma endregion \n\n" );
|
|
|
|
|
2024-10-25 02:01:37 -07:00
|
|
|
src.print_fmt( "#pragma endregion Interface\n\n" );
|
|
|
|
|
|
|
|
src.print_fmt( "GEN_NS_END\n\n");
|
|
|
|
src.print( pop_ignores );
|
|
|
|
src.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_builder.hpp
|
|
|
|
{
|
2024-12-10 23:04:22 -08:00
|
|
|
Code builder = scan_file( path_base "auxillary/builder.hpp" );
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
header = Builder::open( "gen/gen.builder.hpp" );
|
|
|
|
header.print_fmt( generation_notice );
|
|
|
|
header.print( push_ignores );
|
|
|
|
header.print( fmt_newline );
|
|
|
|
header.print_fmt( "#pragma once\n\n" );
|
|
|
|
header.print( def_include( txt("gen.hpp") ));
|
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n" );
|
|
|
|
header.print( builder );
|
2024-12-13 12:56:57 -08:00
|
|
|
header.print_fmt( "\nGEN_NS_END\n" );
|
2024-10-25 02:01:37 -07:00
|
|
|
header.print( fmt_newline );
|
|
|
|
header.print( pop_ignores );
|
|
|
|
header.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_builder.cpp
|
|
|
|
{
|
2024-12-10 23:04:22 -08:00
|
|
|
Code builder = scan_file( path_base "auxillary/builder.cpp" );
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
src = Builder::open( "gen/gen.builder.cpp" );
|
|
|
|
src.print_fmt( generation_notice );
|
|
|
|
src.print( push_ignores );
|
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print( def_include( txt("gen.builder.hpp") ) );
|
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n" );
|
|
|
|
src.print( builder );
|
|
|
|
src.print_fmt( "\nGEN_NS_END\n" );
|
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print( pop_ignores );
|
|
|
|
src.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_scanner.hpp
|
|
|
|
{
|
2024-12-10 23:04:22 -08:00
|
|
|
Code scanner = scan_file( path_base "auxillary/scanner.hpp" );
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
header = Builder::open( "gen/gen.scanner.hpp" );
|
|
|
|
header.print_fmt( generation_notice );
|
|
|
|
header.print_fmt( "#pragma once\n\n" );
|
|
|
|
header.print( push_ignores );
|
|
|
|
header.print( fmt_newline );
|
|
|
|
header.print( def_include( txt("gen.hpp") ) );
|
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n" );
|
|
|
|
header.print( scanner );
|
2024-12-13 12:56:57 -08:00
|
|
|
header.print_fmt( "\nGEN_NS_END\n" );
|
2024-10-25 02:01:37 -07:00
|
|
|
header.print( fmt_newline );
|
|
|
|
header.print( pop_ignores );
|
|
|
|
header.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen.scanner.cpp
|
|
|
|
{
|
2024-12-10 23:04:22 -08:00
|
|
|
Code scanner = scan_file( path_base "auxillary/scanner.cpp" );
|
2024-10-25 02:01:37 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
src = Builder::open( "gen/gen.scanner.cpp" );
|
|
|
|
src.print_fmt( generation_notice );
|
|
|
|
src.print( push_ignores );
|
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print( def_include( txt("gen.scanner.hpp") ) );
|
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n" );
|
2024-12-15 14:52:31 -08:00
|
|
|
src.print( scanner );
|
2024-12-13 12:56:57 -08:00
|
|
|
src.print_fmt( "\nGEN_NS_END\n" );
|
2024-10-25 02:01:37 -07:00
|
|
|
src.print( fmt_newline );
|
|
|
|
src.print( pop_ignores );
|
|
|
|
src.write();
|
|
|
|
}
|
2024-10-24 22:04:48 -07:00
|
|
|
}
|