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-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
|
|
|
|
|
|
|
|
#include "file_processors/builder.hpp"
|
|
|
|
#include "file_processors/builder.cpp"
|
|
|
|
#include "file_processors/scanner.hpp"
|
|
|
|
|
2023-07-24 15:51:49 -07:00
|
|
|
using namespace gen;
|
|
|
|
|
2023-08-03 08:01:43 -07:00
|
|
|
constexpr char const* generation_notice =
|
|
|
|
"// This file was generated automatially by gen.bootstrap.cpp "
|
|
|
|
"(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-07-29 02:52:06 -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-07-29 02:52:06 -07:00
|
|
|
Code header_start = scan_file( "dependencies/header_start.hpp" );
|
|
|
|
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 string = scan_file( "dependencies/string.hpp" );
|
|
|
|
Code file_handling = scan_file( "dependencies/file_handling.hpp" );
|
2023-08-03 08:01:43 -07:00
|
|
|
Code timing = scan_file( "dependencies/timing.hpp" );
|
2023-07-25 12:12:51 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-04 13:12:13 -07:00
|
|
|
deps_header = Builder::open("gen/gen.dep.hpp");
|
2023-08-03 08:01:43 -07:00
|
|
|
deps_header.print_fmt( generation_notice );
|
2023-08-03 20:18:33 -07:00
|
|
|
deps_header.print_fmt( "// This file is intended to be included within gen.hpp (There is no pragma diagnostic ignores)\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
deps_header.print( header_start );
|
2023-08-03 20:18:33 -07:00
|
|
|
deps_header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
|
|
|
deps_header.print( macros );
|
|
|
|
deps_header.print( basic_types );
|
|
|
|
deps_header.print( debug );
|
|
|
|
deps_header.print( memory );
|
|
|
|
deps_header.print( string_ops );
|
|
|
|
deps_header.print( printing );
|
|
|
|
deps_header.print( containers );
|
|
|
|
deps_header.print( hashing );
|
|
|
|
deps_header.print( string );
|
|
|
|
deps_header.print( file_handling );
|
|
|
|
deps_header.print( timing );
|
|
|
|
|
2023-08-03 20:18:33 -07:00
|
|
|
deps_header.print_fmt( "GEN_NS_END\n\n" );
|
2023-07-25 12:12:51 -07:00
|
|
|
deps_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-03 20:18:33 -07:00
|
|
|
Code src_start = scan_file( "dependencies/src_start.cpp" );
|
2023-08-03 08:01:43 -07:00
|
|
|
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 string = scan_file( "dependencies/string.cpp" );
|
|
|
|
Code file_handling = scan_file( "dependencies/file_handling.cpp" );
|
|
|
|
Code timing = scan_file( "dependencies/timing.cpp" );
|
2023-07-25 12:12:51 -07:00
|
|
|
|
|
|
|
Builder
|
2023-08-04 13:12:13 -07:00
|
|
|
deps_impl = Builder::open( "gen/gen.dep.cpp" );
|
2023-08-03 08:01:43 -07:00
|
|
|
deps_impl.print_fmt( generation_notice );
|
2023-08-03 20:18:33 -07:00
|
|
|
deps_impl.print_fmt( "// This file is intended to be included within gen.cpp (There is no pragma diagnostic ignores)\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
deps_impl.print( src_start );
|
2023-08-03 20:18:33 -07:00
|
|
|
deps_impl.print_fmt( "GEN_NS_BEGIN\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
|
|
|
deps_impl.print( debug );
|
|
|
|
deps_impl.print( string_ops );
|
|
|
|
deps_impl.print( printing );
|
|
|
|
deps_impl.print( hashing );
|
|
|
|
deps_impl.print( memory );
|
|
|
|
deps_impl.print( string );
|
|
|
|
deps_impl.print( file_handling );
|
|
|
|
deps_impl.print( timing );
|
|
|
|
|
2023-08-03 20:18:33 -07:00
|
|
|
deps_impl.print_fmt( "GEN_NS_END\n\n" );
|
2023-07-25 12:12:51 -07:00
|
|
|
deps_impl.write();
|
2023-07-24 19:19:21 -07:00
|
|
|
}
|
|
|
|
|
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-03 20:18:33 -07:00
|
|
|
header.print_fmt( "GEN_NS_BEGIN\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print_fmt( "#pragma region Types\n\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-03 20:18:33 -07:00
|
|
|
header.print_fmt( "#pragma region AST\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( ast );
|
|
|
|
header.print( ast_types );
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print_fmt( "#pragma endregion AST\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
|
|
|
|
header.print( interface );
|
|
|
|
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print_fmt( "#pragma region Inlines\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
header.print( inlines );
|
|
|
|
header.print( ast_inlines );
|
2023-08-03 20:18:33 -07:00
|
|
|
header.print_fmt( "#pragma endregion Inlines\n\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-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-08-03 08:01:43 -07:00
|
|
|
Code src_start = scan_file( "components/src_start.cpp" );
|
2023-08-03 20:18:33 -07:00
|
|
|
Code static_data = scan_file( "components/static_data.cpp" );
|
2023-07-29 02:52:06 -07:00
|
|
|
Code ast_case_macros = scan_file( "components/ast_case_macros.cpp" );
|
|
|
|
Code ast = scan_file( "components/ast.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/untyped.cpp" );
|
|
|
|
|
2023-08-06 11:58:43 -07:00
|
|
|
CodeBody etoktype = gen_etoktype( "enums/ETokType.csv", "enums/AttributeTokens.csv" );
|
|
|
|
CodeNS parser_nspace = 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 );
|
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n\n");
|
|
|
|
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print( static_data );
|
|
|
|
|
|
|
|
src.print_fmt( "#pragma region AST\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print( ast_case_macros );
|
|
|
|
src.print( ast );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print_fmt( "#pragma endregion AST\n\n" );
|
|
|
|
|
|
|
|
src.print_fmt( "#pragma region Interface\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print( interface );
|
|
|
|
src.print( upfront );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print_fmt( "#pragma region Parsing\n\n" );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print( parser_nspace );
|
|
|
|
src.print( parsing );
|
|
|
|
src.print( untyped );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print_fmt( "#pragma endregion Parsing\n\n" );
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_builder.hpp
|
|
|
|
{
|
|
|
|
Code builder = scan_file( "file_processors/builder.hpp" );
|
|
|
|
|
|
|
|
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-03 08:01:43 -07:00
|
|
|
header.print( def_include( txt_StrC("gen.hpp") ));
|
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
|
|
|
header.print( builder );
|
|
|
|
header.print_fmt( "\nGEN_NS_END\n\n" );
|
|
|
|
header.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_builder.cpp
|
|
|
|
{
|
2023-07-29 09:25:38 -07:00
|
|
|
Code builder = scan_file( "file_processors/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-04 13:12:13 -07:00
|
|
|
src.print( def_include( txt_StrC("gen.builder.hpp") ) );
|
2023-08-03 08:01:43 -07:00
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
|
|
|
src.print( builder );
|
|
|
|
src.print_fmt( "\nGEN_NS_END\n\n" );
|
|
|
|
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" );
|
|
|
|
Code scanner = scan_file( "file_processors/scanner.hpp" );
|
|
|
|
|
|
|
|
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-03 20:18:33 -07:00
|
|
|
header.print( def_include( txt_StrC("gen.hpp") ) );
|
|
|
|
header.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
|
|
|
header.print( parsing );
|
|
|
|
header.print( scanner );
|
|
|
|
header.print_fmt( "\nGEN_NS_END\n\n" );
|
|
|
|
header.write();
|
|
|
|
}
|
|
|
|
|
|
|
|
// gen_scanner.cpp
|
|
|
|
{
|
|
|
|
Code parsing = scan_file( "dependencies/parsing.cpp" );
|
|
|
|
// Code scanner = scan_file( "file_processors/scanner.cpp" );
|
|
|
|
|
|
|
|
Builder
|
2023-08-04 13:12:13 -07:00
|
|
|
src = Builder::open( "gen/gen.scanner.cpp" );
|
|
|
|
src.print_fmt( generation_notice );
|
|
|
|
src.print( def_include( txt_StrC("gen.scanner.hpp") ) );
|
2023-08-03 20:18:33 -07:00
|
|
|
src.print_fmt( "\nGEN_NS_BEGIN\n\n" );
|
|
|
|
src.print( parsing );
|
|
|
|
// src.print( scanner );
|
|
|
|
src.print_fmt( "\nGEN_NS_END\n\n" );
|
|
|
|
src.write();
|
|
|
|
}
|
|
|
|
|
2023-07-24 19:19:21 -07:00
|
|
|
gen::deinit();
|
2023-07-24 15:51:49 -07:00
|
|
|
return 0;
|
|
|
|
}
|