2023-07-24 15:51:49 -07:00
|
|
|
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
|
|
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
|
|
|
#define GEN_EXPOSE_BACKEND
|
|
|
|
#include "gen.cpp"
|
2023-08-03 08:01:43 -07:00
|
|
|
|
2023-08-09 15:47:59 -07:00
|
|
|
#include "helpers/push_ignores.inline.hpp"
|
2023-07-29 02:52:06 -07:00
|
|
|
#include "helpers/helper.hpp"
|
2023-07-24 15:51:49 -07:00
|
|
|
|
2023-08-03 08:01:43 -07:00
|
|
|
GEN_NS_BEGIN
|
|
|
|
#include "dependencies/parsing.cpp"
|
|
|
|
GEN_NS_END
|
|
|
|
|
2023-08-09 15:47:59 -07:00
|
|
|
#include "auxillary/builder.hpp"
|
|
|
|
#include "auxillary/builder.cpp"
|
|
|
|
#include "auxillary/scanner.hpp"
|
2023-08-03 08:01:43 -07:00
|
|
|
|
2023-07-24 15:51:49 -07:00
|
|
|
using namespace gen;
|
|
|
|
|
2023-08-03 08:01:43 -07:00
|
|
|
constexpr char const* generation_notice =
|
2023-08-22 21:05:58 -07:00
|
|
|
"// This file was generated automatially by gencpp's bootstrap.cpp "
|
2023-08-03 08:01:43 -07:00
|
|
|
"(See: https://github.com/Ed94/gencpp)\n\n";
|
2023-07-24 19:19:21 -07:00
|
|
|
|
2023-07-24 15:56:15 -07:00
|
|
|
int gen_main()
|
2023-07-24 15:51:49 -07:00
|
|
|
{
|
2023-07-24 19:19:21 -07:00
|
|
|
gen::init();
|
|
|
|
|
2023-08-28 20:46:50 -07:00
|
|
|
Code push_ignores = scan_file( "helpers/push_ignores.inline.hpp" );
|
|
|
|
Code pop_ignores = scan_file( "helpers/pop_ignores.inline.hpp" );
|
2023-07-24 19:19:21 -07:00
|
|
|
|
2023-07-25 12:12:51 -07:00
|
|
|
// gen_dep.hpp
|
2023-07-24 19:19:21 -07:00
|
|
|
{
|
2023-08-28 20:46:50 -07:00
|
|
|
Code header_start = scan_file( "dependencies/header_start.hpp" );
|
2023-08-09 15:47:59 -07:00
|
|
|
Code macros = scan_file( "dependencies/macros.hpp" );
|
|
|
|
Code basic_types = scan_file( "dependencies/basic_types.hpp" );
|
|
|
|
Code debug = scan_file( "dependencies/debug.hpp" );
|
|
|
|
Code memory = scan_file( "dependencies/memory.hpp" );
|
|
|
|
Code string_ops = scan_file( "dependencies/string_ops.hpp" );
|
|
|
|
Code printing = scan_file( "dependencies/printing.hpp" );
|
|
|
|
Code containers = scan_file( "dependencies/containers.hpp" );
|
|
|
|
Code hashing = scan_file( "dependencies/hashing.hpp" );
|
|
|
|
Code strings = scan_file( "dependencies/strings.hpp" );
|
|
|
|
Code filesystem = scan_file( "dependencies/filesystem.hpp" );
|
|
|
|
Code timing = scan_file( "dependencies/timing.hpp" );
|
2023-07-25 12:12:51 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-09 06:50:12 -07:00
|
|
|
header = Builder::open("gen/gen.dep.hpp");
|
|
|
|
header.print_fmt( generation_notice );
|
|
|
|
header.print_fmt( "// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)\n\n" );
|
|
|
|
header.print( header_start );
|
2023-08-21 17:30:13 -07:00
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n" );
|
2023-08-09 06:50:12 -07:00
|
|
|
|
|
|
|
header.print( macros );
|
|
|
|
header.print( basic_types );
|
|
|
|
header.print( debug );
|
|
|
|
header.print( memory );
|
|
|
|
header.print( string_ops );
|
|
|
|
header.print( printing );
|
|
|
|
header.print( containers );
|
|
|
|
header.print( hashing );
|
2023-08-09 15:47:59 -07:00
|
|
|
header.print( strings );
|
|
|
|
header.print( filesystem );
|
2023-08-09 06:50:12 -07:00
|
|
|
header.print( timing );
|
|
|
|
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "\nGEN_NS_END\n" );
|
2023-08-09 06:50:12 -07:00
|
|
|
header.write();
|
2023-07-24 19:19:21 -07:00
|
|
|
}
|
|
|
|
|
2023-07-25 12:12:51 -07:00
|
|
|
// gen_dep.cpp
|
2023-07-24 19:19:21 -07:00
|
|
|
{
|
2023-08-09 15:47:59 -07:00
|
|
|
Code src_start = scan_file( "dependencies/src_start.cpp" );
|
|
|
|
Code debug = scan_file( "dependencies/debug.cpp" );
|
|
|
|
Code string_ops = scan_file( "dependencies/string_ops.cpp" );
|
|
|
|
Code printing = scan_file( "dependencies/printing.cpp" );
|
|
|
|
Code memory = scan_file( "dependencies/memory.cpp" );
|
|
|
|
Code hashing = scan_file( "dependencies/hashing.cpp" );
|
|
|
|
Code strings = scan_file( "dependencies/strings.cpp" );
|
|
|
|
Code filesystem = scan_file( "dependencies/filesystem.cpp" );
|
|
|
|
Code timing = scan_file( "dependencies/timing.cpp" );
|
2023-07-25 12:12:51 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-09 06:50:12 -07:00
|
|
|
src = Builder::open( "gen/gen.dep.cpp" );
|
|
|
|
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 );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n" );
|
2023-08-09 06:50:12 -07:00
|
|
|
|
|
|
|
src.print( debug );
|
|
|
|
src.print( string_ops );
|
|
|
|
src.print( printing );
|
|
|
|
src.print( hashing );
|
|
|
|
src.print( memory );
|
2023-08-09 15:47:59 -07:00
|
|
|
src.print( strings );
|
|
|
|
src.print( filesystem );
|
2023-08-09 06:50:12 -07:00
|
|
|
src.print( timing );
|
|
|
|
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\nGEN_NS_END\n" );
|
2023-08-09 06:50:12 -07:00
|
|
|
src.write();
|
2023-07-24 19:19:21 -07:00
|
|
|
}
|
|
|
|
|
2023-09-25 13:42:29 -07:00
|
|
|
CodeBody gen_component_header = def_global_body( args(
|
|
|
|
def_preprocess_cond( PreprocessCond_IfDef, txt("GEN_INTELLISENSE_DIRECTIVES") ),
|
|
|
|
pragma_once,
|
|
|
|
def_include(txt("components/types.hpp")),
|
|
|
|
preprocess_endif,
|
|
|
|
fmt_newline,
|
|
|
|
untyped_str( to_str(generation_notice) )
|
|
|
|
));
|
|
|
|
|
2023-07-25 12:12:51 -07:00
|
|
|
// gen.hpp
|
2023-07-24 19:19:21 -07:00
|
|
|
{
|
2023-07-29 02:52:06 -07:00
|
|
|
Code header_start = scan_file( "components/header_start.hpp" );
|
|
|
|
Code types = scan_file( "components/types.hpp" );
|
2023-08-03 08:01:43 -07:00
|
|
|
Code ast = scan_file( "components/ast.hpp" );
|
|
|
|
Code ast_types = scan_file( "components/ast_types.hpp" );
|
2023-07-29 02:52:06 -07:00
|
|
|
Code interface = scan_file( "components/interface.hpp" );
|
2023-08-03 08:01:43 -07:00
|
|
|
Code inlines = scan_file( "components/inlines.hpp" );
|
2023-07-29 02:52:06 -07:00
|
|
|
Code header_end = scan_file( "components/header_end.hpp" );
|
2023-07-25 12:12:51 -07:00
|
|
|
|
2023-08-06 11:58:43 -07:00
|
|
|
CodeBody ecode = gen_ecode ( "enums/ECode.csv" );
|
|
|
|
CodeBody eoperator = gen_eoperator ( "enums/EOperator.csv" );
|
|
|
|
CodeBody especifier = gen_especifier( "enums/ESpecifier.csv" );
|
|
|
|
CodeBody ast_inlines = gen_ast_inlines();
|
2023-07-26 11:21:20 -07:00
|
|
|
|
2023-07-25 12:12:51 -07:00
|
|
|
Builder
|
2023-08-03 08:01:43 -07:00
|
|
|
header = Builder::open( "gen/gen.hpp" );
|
|
|
|
header.print_fmt( generation_notice );
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print_fmt( "#pragma once\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( push_ignores );
|
|
|
|
header.print( header_start );
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "#pragma region Types\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( types );
|
|
|
|
header.print( ecode );
|
|
|
|
header.print( eoperator );
|
|
|
|
header.print( especifier );
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print_fmt( "#pragma endregion Types\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "#pragma region AST\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( ast );
|
|
|
|
header.print( ast_types );
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "\n#pragma endregion AST\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
|
|
|
header.print( interface );
|
|
|
|
|
2023-08-21 23:09:20 -07:00
|
|
|
header.print_fmt( "\n#pragma region Inlines\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( inlines );
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print( fmt_newline );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( ast_inlines );
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "#pragma endregion Inlines\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
|
|
|
header.print( header_end );
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print_fmt( "GEN_NS_END\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( pop_ignores );
|
2023-07-25 12:12:51 -07:00
|
|
|
header.write();
|
2023-08-21 20:28:39 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
header_ecode = Builder::open( "components/gen/ecode.hpp" );
|
2023-08-28 20:46:50 -07:00
|
|
|
header_ecode.print( gen_component_header );
|
2023-08-21 20:28:39 -07:00
|
|
|
header_ecode.print( ecode );
|
|
|
|
header_ecode.write();
|
|
|
|
|
|
|
|
Builder
|
|
|
|
header_eoperator = Builder::open( "components/gen/eoperator.hpp" );
|
2023-08-28 20:46:50 -07:00
|
|
|
header_eoperator.print( gen_component_header );
|
2023-08-21 20:28:39 -07:00
|
|
|
header_eoperator.print( eoperator );
|
|
|
|
header_eoperator.write();
|
|
|
|
|
|
|
|
Builder
|
|
|
|
header_especifier = Builder::open( "components/gen/especifier.hpp" );
|
2023-08-28 20:46:50 -07:00
|
|
|
header_especifier.print( gen_component_header );
|
2023-08-21 20:28:39 -07:00
|
|
|
header_especifier.print( especifier );
|
|
|
|
header_especifier.write();
|
|
|
|
|
|
|
|
Builder
|
|
|
|
header_ast_inlines = Builder::open( "components/gen/ast_inlines.hpp" );
|
2023-08-28 20:46:50 -07:00
|
|
|
header_ast_inlines.print( gen_component_header );
|
2023-08-21 20:28:39 -07:00
|
|
|
header_ast_inlines.print( ast_inlines );
|
|
|
|
header_ast_inlines.write();
|
2023-07-24 19:19:21 -07:00
|
|
|
}
|
2023-07-24 15:51:49 -07:00
|
|
|
|
2023-07-25 12:12:51 -07:00
|
|
|
// gen.cpp
|
2023-07-24 19:19:21 -07:00
|
|
|
{
|
2023-11-19 17:34:46 -08:00
|
|
|
Code src_start = scan_file( "components/src_start.cpp" );
|
|
|
|
Code static_data = scan_file( "components/static_data.cpp" );
|
|
|
|
Code ast_case_macros = scan_file( "components/ast_case_macros.cpp" );
|
|
|
|
Code ast = scan_file( "components/ast.cpp" );
|
|
|
|
Code code_serialization = scan_file( "components/code_serialization.cpp" );
|
|
|
|
Code interface = scan_file( "components/interface.cpp" );
|
|
|
|
Code upfront = scan_file( "components/interface.upfront.cpp" );
|
|
|
|
Code parsing = scan_file( "components/interface.parsing.cpp" );
|
|
|
|
Code untyped = scan_file( "components/interface.untyped.cpp" );
|
2023-07-29 02:52:06 -07:00
|
|
|
|
2023-08-21 20:28:39 -07:00
|
|
|
CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
2023-11-19 17:34:46 -08:00
|
|
|
CodeNS nspaced_etoktype = def_namespace( name(parser), def_namespace_body( args(etoktype)) );
|
2023-07-26 23:51:36 -07:00
|
|
|
|
2023-08-03 08:01:43 -07:00
|
|
|
Builder
|
|
|
|
src = Builder::open( "gen/gen.cpp" );
|
|
|
|
src.print_fmt( generation_notice );
|
|
|
|
src.print( push_ignores );
|
|
|
|
src.print( src_start );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "GEN_NS_BEGIN\n");
|
2023-08-03 08:01:43 -07:00
|
|
|
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print( static_data );
|
|
|
|
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\n#pragma region AST\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print( ast_case_macros );
|
|
|
|
src.print( ast );
|
2023-11-19 17:34:46 -08:00
|
|
|
src.print( code );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\n#pragma endregion AST\n" );
|
2023-08-03 20:18:33 -07:00
|
|
|
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\n#pragma region Interface\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print( interface );
|
|
|
|
src.print( upfront );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\n#pragma region Parsing\n\n" );
|
2023-08-21 20:28:39 -07:00
|
|
|
src.print( nspaced_etoktype );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print( parsing );
|
|
|
|
src.print( untyped );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\n#pragma endregion Parsing\n\n" );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print_fmt( "#pragma endregion Interface\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
|
|
|
src.print_fmt( "GEN_NS_END\n\n");
|
|
|
|
src.print( pop_ignores );
|
|
|
|
src.write();
|
2023-08-21 20:28:39 -07:00
|
|
|
|
|
|
|
Builder
|
|
|
|
src_etoktype = Builder::open( "components/gen/etoktype.cpp" );
|
2023-09-25 13:42:29 -07:00
|
|
|
src_etoktype.print( gen_component_header );
|
2023-08-21 20:28:39 -07:00
|
|
|
src_etoktype.print( nspaced_etoktype );
|
|
|
|
src_etoktype.write();
|
2023-08-03 08:01:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// gen_builder.hpp
|
|
|
|
{
|
2023-08-21 20:28:39 -07:00
|
|
|
Code builder = scan_file( "auxillary/builder.hpp" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-04 13:12:13 -07:00
|
|
|
header = Builder::open( "gen/gen.builder.hpp" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print_fmt( generation_notice );
|
2023-08-04 13:12:13 -07:00
|
|
|
header.print_fmt( "#pragma once\n\n" );
|
2023-08-09 15:47:59 -07:00
|
|
|
header.print( def_include( txt("gen.hpp") ));
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( builder );
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "GEN_NS_END\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_builder.cpp
|
|
|
|
{
|
2023-08-21 20:28:39 -07:00
|
|
|
Code builder = scan_file( "auxillary/builder.cpp" );
|
2023-07-25 12:12:51 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-04 13:12:13 -07:00
|
|
|
src = Builder::open( "gen/gen.builder.cpp" );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print_fmt( generation_notice );
|
2023-08-09 15:47:59 -07:00
|
|
|
src.print( def_include( txt("gen.builder.hpp") ) );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print( builder );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\nGEN_NS_END\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.write();
|
2023-07-24 19:19:21 -07:00
|
|
|
}
|
2023-07-24 15:51:49 -07:00
|
|
|
|
2023-08-03 20:18:33 -07:00
|
|
|
// gen_scanner.hpp
|
|
|
|
{
|
|
|
|
Code parsing = scan_file( "dependencies/parsing.hpp" );
|
2023-08-21 20:28:39 -07:00
|
|
|
Code scanner = scan_file( "auxillary/scanner.hpp" );
|
2023-08-03 20:18:33 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-04 13:12:13 -07:00
|
|
|
header = Builder::open( "gen/gen.scanner.hpp" );
|
|
|
|
header.print_fmt( generation_notice );
|
|
|
|
header.print_fmt( "#pragma once\n\n" );
|
2023-08-09 15:47:59 -07:00
|
|
|
header.print( def_include( txt("gen.hpp") ) );
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n" );
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print( parsing );
|
|
|
|
header.print( scanner );
|
2023-08-21 22:51:59 -07:00
|
|
|
header.print_fmt( "GEN_NS_END\n" );
|
2023-08-03 20:18:33 -07:00
|
|
|
header.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_scanner.cpp
|
|
|
|
{
|
|
|
|
Code parsing = scan_file( "dependencies/parsing.cpp" );
|
2023-08-21 20:28:39 -07:00
|
|
|
Code scanner = scan_file( "auxillary/scanner.cpp" );
|
2023-08-03 20:18:33 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-04 13:12:13 -07:00
|
|
|
src = Builder::open( "gen/gen.scanner.cpp" );
|
|
|
|
src.print_fmt( generation_notice );
|
2023-08-09 15:47:59 -07:00
|
|
|
src.print( def_include( txt("gen.scanner.hpp") ) );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n" );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print( parsing );
|
2023-08-09 15:47:59 -07:00
|
|
|
src.print( scanner );
|
2023-08-21 22:51:59 -07:00
|
|
|
src.print_fmt( "GEN_NS_END\n" );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.write();
|
|
|
|
}
|
|
|
|
|
2023-07-24 19:19:21 -07:00
|
|
|
gen::deinit();
|
2023-07-24 15:51:49 -07:00
|
|
|
return 0;
|
|
|
|
}
|