2023-07-30 15:55:57 -07:00
|
|
|
#define GEN_DEFINE_LIBRARY_CODE_CONSTANTS
|
|
|
|
#define GEN_ENFORCE_STRONG_CODE_TYPES
|
|
|
|
#define GEN_EXPOSE_BACKEND
|
|
|
|
#define GEN_BENCHMARK
|
2023-08-20 09:31:24 -07:00
|
|
|
#include "gen.hpp"
|
|
|
|
#include "gen.builder.hpp"
|
|
|
|
#include "gen.scanner.hpp"
|
2023-07-30 15:55:57 -07:00
|
|
|
using namespace gen;
|
|
|
|
|
|
|
|
void check_singleheader_ast()
|
|
|
|
{
|
2023-08-20 12:45:06 -07:00
|
|
|
#define project_dir "../"
|
2023-07-30 15:55:57 -07:00
|
|
|
gen::init();
|
|
|
|
log_fmt("\ncheck_singleheader_ast:\n");
|
|
|
|
|
2023-08-06 14:46:17 -07:00
|
|
|
FileContents file = file_read_contents( GlobalAllocator, true, project_dir "singleheader/gen/gen.hpp" );
|
|
|
|
u64 time_start = time_rel_ms();
|
|
|
|
CodeBody ast = parse_global_body( { file.size, (char const*)file.data } );
|
2023-07-30 15:55:57 -07:00
|
|
|
|
2023-08-06 14:46:17 -07:00
|
|
|
log_fmt("\nAst generated. Time taken: %llu ms\n", time_rel_ms() - time_start);
|
2023-07-30 15:55:57 -07:00
|
|
|
|
2023-08-06 14:46:17 -07:00
|
|
|
log_fmt("\nSerializng ast:\n");
|
|
|
|
time_start = time_rel_ms();
|
2023-08-01 11:02:54 -07:00
|
|
|
|
2023-08-06 14:46:17 -07:00
|
|
|
Builder
|
2023-08-20 10:02:50 -07:00
|
|
|
builder = Builder::open( "gen/singleheader_copy.gen.hpp" );
|
2023-07-30 15:55:57 -07:00
|
|
|
builder.print( ast );
|
|
|
|
builder.write();
|
|
|
|
|
2023-08-06 14:46:17 -07:00
|
|
|
log_fmt("passed!! Time taken: %llu ms\n", time_rel_ms() - time_start);
|
|
|
|
|
2023-07-30 15:55:57 -07:00
|
|
|
gen::deinit();
|
|
|
|
}
|