diff --git a/project/components/interface.parsing.cpp b/project/components/interface.parsing.cpp index 1ba4f21..9c89c97 100644 --- a/project/components/interface.parsing.cpp +++ b/project/components/interface.parsing.cpp @@ -4554,8 +4554,7 @@ CodeTemplate parse_template( StrC def ) AST_1->Name: (* A ( int (*) (short a,unsigned b,long c) ) ) AST_2->Name: (* A ( int(*)(short a, unsigned b, long c) ) ) - The excess whitespace can be stripped however, because there is no semantic awareness within the first capture group, - it cannot entirely remove the whitespaceto remove insignificant whitespace. + The excess whitespace cannot be stripped however, because there is no semantic awareness within the first capture group. */ internal CodeType parse_type( bool* typedef_is_function ) @@ -4894,9 +4893,10 @@ CodeType parse_type( bool* typedef_is_function ) result = (CodeType) make_code(); result->Type = Typename; + // Need to wait until were using the new parsing method to do this. String name_stripped = String::make( GlobalAllocator, name ); - name_stripped.strip_space(); + // name_stripped.strip_space(); #ifdef GEN_USE_NEW_TYPENAME_PARSING if ( params_nested ) diff --git a/scripts/build.ci.ps1 b/scripts/build.ci.ps1 index 6acb0fc..e1a4db6 100644 --- a/scripts/build.ci.ps1 +++ b/scripts/build.ci.ps1 @@ -396,6 +396,7 @@ if ( $test ) build-simple $includes $unit $executable Push-Location $path_test + Write-Host $path_test if ( Test-Path( $executable ) ) { write-host "`nRunning test generator" $time_taken = Measure-Command { & $executable @@ -458,7 +459,7 @@ if ( $singleheader -and (Test-Path (Join-Path $path_singleheader "gen/gen.hpp")) format-cpp $path_gen $include $exclude } -if ( $test ) +if ( $test -and $false ) { $path_gen = join-path $path_test gen $include = @( diff --git a/test/validate.singleheader.cpp b/test/validate.singleheader.cpp index fbfef34..b9d252b 100644 --- a/test/validate.singleheader.cpp +++ b/test/validate.singleheader.cpp @@ -7,34 +7,49 @@ #include "gen.scanner.hpp" using namespace gen; +#ifdef GEN_SYSTEM_WINDOWS + #include +#endif + void check_singleheader_ast() { - #define project_dir "../" + #define root_dir "../" gen::init(); log_fmt("\ncheck_singleheader_ast:\n"); - FileContents file = file_read_contents( GlobalAllocator, true, project_dir "singleheader/gen/gen.hpp" ); + FileContents file = file_read_contents( GlobalAllocator, true, root_dir "singleheader/gen/gen.hpp" ); u64 time_start = time_rel_ms(); CodeBody ast = parse_global_body( { file.size, (char const*)file.data } ); - log_fmt("\nAst generated. Time taken: %llu ms\n", time_rel_ms() - time_start); log_fmt("\nSerializng ast:\n"); time_start = time_rel_ms(); - Builder builder = Builder::open( "gen/singleheader_copy.gen.hpp" ); builder.print( ast ); builder.write(); - log_fmt("Serialized. Time taken: %llu ms\n", time_rel_ms() - time_start); + // Need to execute clang format on the generated file to get it to match the original. + #define script_path root_dir "scripts/" + #define clang_format "clang-format " + #define cf_format_inplace "-i " + #define cf_style "-style=file:" "C:/projects/gencpp/scripts/.clang-format " + #define cf_verbose "-verbose " + + log_fmt("\nRunning clang-format on generated file:\n"); + system( clang_format cf_format_inplace cf_style cf_verbose "gen/singleheader_copy.gen.hpp" ); + log_fmt("clang-format finished reformatting.\n"); + #undef script_path + #undef cf_cmd + #undef cf_format_inplace + #undef cf_style + #undef cf_verbse + FileContents file_gen = file_read_contents( GlobalAllocator, true, "gen/singleheader_copy.gen.hpp" ); - log_fmt("\nReconstructing from generated file:\n"); - time_start = time_rel_ms(); - CodeBody ast_gen = parse_global_body( { file_gen.size, (char const*)file_gen.data } ); - + time_start = time_rel_ms(); + CodeBody ast_gen = parse_global_body( { file_gen.size, (char const*)file_gen.data } ); log_fmt("\nAst generated. Time taken: %llu ms\n\n", time_rel_ms() - time_start); time_start = time_rel_ms();