From 754bcfb31e2ddce01d1b91cc1781b093400be8f7 Mon Sep 17 00:00:00 2001 From: Ed_ Date: Mon, 25 Sep 2023 16:42:29 -0400 Subject: [PATCH] Fixes to get it back to where I was last at with the const specifier issue --- gencpp.10x | 10 +- gencpp.vcxproj | 19 +--- project/bootstrap.cpp | 21 ++-- project/components/ast.cpp | 136 ++++++++++++++++------- project/components/ast.hpp | 38 ++++--- project/components/gen/ast_inlines.hpp | 2 +- project/components/gen/ecode.hpp | 2 +- project/components/gen/etoktype.cpp | 7 +- project/components/interface.parsing.cpp | 2 +- project/dependencies/debug.cpp | 3 + project/dependencies/printing.cpp | 2 + project/dependencies/src_start.cpp | 4 + project/dependencies/string_ops.cpp | 1 + 13 files changed, 155 insertions(+), 92 deletions(-) diff --git a/gencpp.10x b/gencpp.10x index 3619e7e..5940354 100644 --- a/gencpp.10x +++ b/gencpp.10x @@ -32,11 +32,11 @@ C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.36.32532\include C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.36.32532\ATLMFC\include C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\VS\include - C:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt - C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\um - C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\shared - C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\winrt - C:\Program Files (x86)\Windows Kits\10\\include\10.0.19041.0\\cppwinrt + C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt + C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um + C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared + C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt + C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um diff --git a/gencpp.vcxproj b/gencpp.vcxproj index 33bde5a..9567848 100644 --- a/gencpp.vcxproj +++ b/gencpp.vcxproj @@ -170,15 +170,15 @@ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1" - GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions) - $(ProjectDir)project;$(ProjectDir)test;$(IncludePath) + GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;GEN_BENCHMARK;$(NMakePreprocessorDefinitions) + $(ProjectDir)project;$(IncludePath) $(ProjectDir)project;$(SourcePath) pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc debug test pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1" - GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions) + GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;GEN_BENCHMARK;$(NMakePreprocessorDefinitions) $(ProjectDir)project;$(ProjectDir)test;$(IncludePath) $(ProjectDir)project;$(SourcePath) @@ -187,7 +187,7 @@ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1" - GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions) + GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;GEN_BENCHMARK;$(NMakePreprocessorDefinitions) $(ProjectDir)project;$(ProjectDir)test;$(IncludePath) $(ProjectDir)project;$(SourcePath) @@ -196,7 +196,7 @@ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1" - GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions) + GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;GEN_BENCHMARK;$(NMakePreprocessorDefinitions) $(ProjectDir)project;$(ProjectDir)test;$(IncludePath) $(ProjectDir)project;$(SourcePath) @@ -205,7 +205,7 @@ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1" - GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions) + GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;GEN_BENCHMARK;$(NMakePreprocessorDefinitions) $(ProjectDir)project;$(ProjectDir)test;$(IncludePath) $(ProjectDir)project;$(SourcePath) @@ -236,7 +236,6 @@ - @@ -271,10 +270,6 @@ - - - - @@ -325,8 +320,6 @@ - - diff --git a/project/bootstrap.cpp b/project/bootstrap.cpp index 6e05e92..ad7f698 100644 --- a/project/bootstrap.cpp +++ b/project/bootstrap.cpp @@ -97,6 +97,15 @@ int gen_main() src.write(); } + 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) ) + )); + // gen.hpp { Code header_start = scan_file( "components/header_start.hpp" ); @@ -145,15 +154,6 @@ int gen_main() header.print( pop_ignores ); header.write(); - 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) ) - )); - Builder header_ecode = Builder::open( "components/gen/ecode.hpp" ); header_ecode.print( gen_component_header ); @@ -223,8 +223,7 @@ int gen_main() Builder src_etoktype = Builder::open( "components/gen/etoktype.cpp" ); - src_etoktype.print_fmt( generation_notice ); - src_etoktype.print( pragma_once ); + src_etoktype.print( gen_component_header ); src_etoktype.print( nspaced_etoktype ); src_etoktype.write(); } diff --git a/project/components/ast.cpp b/project/components/ast.cpp index 9f9d49d..e5b82b4 100644 --- a/project/components/ast.cpp +++ b/project/components/ast.cpp @@ -30,9 +30,9 @@ char const* AST::debug_str() case Access_Protected: case Access_Public: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); break; case Untyped: @@ -48,9 +48,9 @@ char const* AST::debug_str() case Preprocess_IfDef: case Preprocess_IfNotDef: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tContent: %S", Content ); break; @@ -58,9 +58,9 @@ char const* AST::debug_str() case Class: case Struct: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmd : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tAttributes : %S", Attributes ? Attributes->to_string() : "Null" ); @@ -72,9 +72,9 @@ char const* AST::debug_str() case Class_Fwd: case Struct_Fwd: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmd : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tAttributes : %S", Attributes ? Attributes->to_string() : "Null" ); @@ -84,9 +84,9 @@ char const* AST::debug_str() case Constructor: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" ); @@ -97,9 +97,9 @@ char const* AST::debug_str() case Constructor_Fwd: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" ); @@ -109,9 +109,9 @@ char const* AST::debug_str() case Destructor: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" ); @@ -124,9 +124,9 @@ char const* AST::debug_str() case Enum: case Enum_Class: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tAttributes : %S", Attributes ? Attributes->to_string() : "Null" ); @@ -134,25 +134,33 @@ char const* AST::debug_str() result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" ); break; + case Enum_Fwd: case Enum_Class_Fwd: - + if ( Prev ) + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + if ( Next ) + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + + result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); + result.append_fmt( "\n\tAttributes : %S", Attributes ? Attributes->to_string() : "Null" ); + result.append_fmt( "\n\tUnderlying Type : %S", UnderlyingType ? UnderlyingType->to_string() : "Null" ); break; case Extern_Linkage: case Namespace: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tBody: %S", Body ? Body->debug_str() : "Null" ); break; case Friend: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tDeclaration: %S", Declaration ? Declaration->to_string() : "Null" ); @@ -160,9 +168,9 @@ char const* AST::debug_str() case Function: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tAttributes: %S", Attributes ? Attributes->to_string() : "Null" ); @@ -172,18 +180,32 @@ char const* AST::debug_str() result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" ); break; + case Function_Fwd: + if ( Prev ) + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + if ( Next ) + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + + result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); + result.append_fmt( "\n\tAttributes: %S", Attributes ? Attributes->to_string() : "Null" ); + result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" ); + result.append_fmt( "\n\tReturnType: %S", ReturnType ? ReturnType->to_string() : "Null" ); + result.append_fmt( "\n\tParams : %S", Params ? Params->to_string() : "Null" ); + break; + case Module: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); break; case Operator: + case Operator_Member: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tAttributes: %S", Attributes ? Attributes->to_string() : "Null" ); @@ -194,11 +216,26 @@ char const* AST::debug_str() result.append_fmt( "\n\tOp : %S", to_str( Op ) ); break; + case Operator_Fwd: + case Operator_Member_Fwd: + if ( Prev ) + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + if ( Next ) + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + + result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); + result.append_fmt( "\n\tAttributes: %S", Attributes ? Attributes->to_string() : "Null" ); + result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" ); + result.append_fmt( "\n\tReturnType: %S", ReturnType ? ReturnType->to_string() : "Null" ); + result.append_fmt( "\n\tParams : %S", Params ? Params->to_string() : "Null" ); + result.append_fmt( "\n\tOp : %S", to_str( Op ) ); + break; + case Operator_Cast: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" ); @@ -206,6 +243,17 @@ char const* AST::debug_str() result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" ); break; + case Operator_Cast_Fwd: + if ( Prev ) + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + if ( Next ) + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); + + result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); + result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" ); + result.append_fmt( "\n\tValueType : %S", ValueType ? ValueType->to_string() : "Null" ); + break; + case Parameters: result.append_fmt( "\n\tNumEntries: %d", NumEntries ); result.append_fmt( "\n\tLast : %S", Last->Name ); @@ -233,9 +281,9 @@ char const* AST::debug_str() case Template: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tParams : %S", Params ? Params->to_string() : "Null" ); result.append_fmt( "\n\tDeclaration: %S", Declaration ? Declaration->to_string() : "Null" ); @@ -243,12 +291,12 @@ char const* AST::debug_str() case Typedef: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); - result.append_fmt( "\n\tUnderlyingType: %S", UnderlyingType ? UnderlyingType->to_string() : "Null" ); + result.append_fmt( "\n\tUnderlyingType: %S", UnderlyingType ? UnderlyingType->to_string() : "Null" ); break; case Typename: @@ -261,9 +309,9 @@ char const* AST::debug_str() case Union: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tAttributes: %S", Attributes ? Attributes->to_string() : "Null" ); result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" ); @@ -271,9 +319,9 @@ char const* AST::debug_str() case Using: if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tAttributes : %S", Attributes ? Attributes->to_string() : "Null" ); @@ -293,9 +341,9 @@ char const* AST::debug_str() } if ( Prev ) - result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); if ( Next ) - result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ); + result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name ? Prev->Name : "Null" ); result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" ); result.append_fmt( "\n\tAttributes : %S", Attributes ? Attributes->to_string() : "Null" ); @@ -387,6 +435,10 @@ String AST::to_string() interface = interface->Next ? interface->Next->cast< CodeType >() : Code { nullptr }; } } + else if ( Name ) + { + result.append( Name ); + } if ( InlineCmt ) { @@ -980,6 +1032,10 @@ String AST::to_string() interface = interface->Next ? interface->Next->cast< CodeType >() : Code { nullptr }; } } + else if ( Name ) + { + result.append( Name ); + } if ( InlineCmt ) { diff --git a/project/components/ast.hpp b/project/components/ast.hpp index a986b88..46a8311 100644 --- a/project/components/ast.hpp +++ b/project/components/ast.hpp @@ -67,10 +67,10 @@ struct CodeUnion; struct CodeUsing; struct CodeVar; -// namespace Parser -// { -// struct Token; -// } +namespace Parser +{ + struct Token; +} /* AST* wrapper @@ -162,7 +162,7 @@ struct Code_POD static_assert( sizeof(Code) == sizeof(Code_POD), "ERROR: Code is not POD" ); // Desired width of the AST data structure. -constexpr int AST_POD_Size = 128; +constexpr int const AST_POD_Size = 128; /* Simple AST POD with functionality to seralize into C++ syntax. @@ -220,19 +220,17 @@ struct AST constexpr static int ArrSpecs_Cap = - #if 1 ( AST_POD_Size - - sizeof(void*) * 4 - // - sizeof(Parser::Token*) - // - sizeof(AST*) - - sizeof(void*) - - sizeof(int) + - sizeof(AST*) * 3 + - sizeof(Parser::Token*) + - sizeof(AST*) + - sizeof(StringCached) + - sizeof(CodeT) - sizeof(ModuleFlag) - sizeof(int) ) - / sizeof(SpecifierT); // -1 for 4 extra bytes - #endif + / sizeof(int) - 1; // -1 for 4 extra bytes union { struct @@ -264,7 +262,7 @@ struct AST }; StringCached Content; // Attributes, Comment, Execution, Include struct { - SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers + SpecifierT ArrSpecs[ArrSpecs_Cap]; // Specifiers AST* NextSpecs; // Specifiers; If ArrSpecs is full, then NextSpecs is used. }; }; @@ -277,7 +275,7 @@ struct AST AST* Next; AST* Back; }; - // Parser::Token* Token; // Reference to starting token, only avaialble if it was derived from parsing. + Parser::Token* Token; // Reference to starting token, only avaialble if it was derived from parsing. AST* Parent; StringCached Name; CodeT Type; @@ -336,7 +334,7 @@ struct AST_POD AST* Next; AST* Back; }; - // Parser::Token* Token; // Reference to starting token, only avaialble if it was derived from parsing. + Parser::Token* Token; // Reference to starting token, only avaialble if it was derived from parsing. AST* Parent; StringCached Name; CodeT Type; @@ -350,8 +348,12 @@ struct AST_POD }; }; -constexpr int specifierT_size = sizeof(SpecifierT); -constexpr int AST_SIZE = sizeof(AST); +struct test { + SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers + AST* NextSpecs; // Specifiers; If ArrSpecs is full, then NextSpecs is used. +}; + +constexpr int pls = sizeof(test); // Its intended for the AST to have equivalent size to its POD. // All extra functionality within the AST namespace should just be syntatic sugar. diff --git a/project/components/gen/ast_inlines.hpp b/project/components/gen/ast_inlines.hpp index 20846b4..a7ff8c0 100644 --- a/project/components/gen/ast_inlines.hpp +++ b/project/components/gen/ast_inlines.hpp @@ -1,6 +1,6 @@ #ifdef GEN_INTELLISENSE_DIRECTIVES #pragma once -#include "types.hpp" +#include "components/types.hpp" #endif // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) diff --git a/project/components/gen/ecode.hpp b/project/components/gen/ecode.hpp index 68877f7..82cef85 100644 --- a/project/components/gen/ecode.hpp +++ b/project/components/gen/ecode.hpp @@ -1,6 +1,6 @@ #ifdef GEN_INTELLISENSE_DIRECTIVES #pragma once -#include "components/Types.hpp" +#include "components/types.hpp" #endif // This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) diff --git a/project/components/gen/etoktype.cpp b/project/components/gen/etoktype.cpp index db84d4c..bcab4ce 100644 --- a/project/components/gen/etoktype.cpp +++ b/project/components/gen/etoktype.cpp @@ -1,6 +1,9 @@ -// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) - +#ifdef GEN_INTELLISENSE_DIRECTIVES #pragma once +#include "components/types.hpp" +#endif + +// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp) namespace Parser { diff --git a/project/components/interface.parsing.cpp b/project/components/interface.parsing.cpp index c929f6b..2f86926 100644 --- a/project/components/interface.parsing.cpp +++ b/project/components/interface.parsing.cpp @@ -3921,7 +3921,7 @@ CodeEnum parse_enum( bool inplace_def ) while ( left && currtok_noskip.Type != TokType::BraceCurly_Close ) { - if ( currtok.Type == TokType::Preprocess_Hash ) + if ( currtok_noskip.Type == TokType::Preprocess_Hash ) eat( TokType::Preprocess_Hash ); switch ( currtok_noskip.Type ) diff --git a/project/dependencies/debug.cpp b/project/dependencies/debug.cpp index 3b5adef..c5aaf59 100644 --- a/project/dependencies/debug.cpp +++ b/project/dependencies/debug.cpp @@ -1,5 +1,8 @@ #ifdef GEN_INTELLISENSE_DIRECTIVES # pragma once +# include "debug.hpp" +# include "basic_types.hpp" +# include "src_start.cpp" #endif #pragma region Debug diff --git a/project/dependencies/printing.cpp b/project/dependencies/printing.cpp index f3fef3d..7589271 100644 --- a/project/dependencies/printing.cpp +++ b/project/dependencies/printing.cpp @@ -1,5 +1,7 @@ #ifdef GEN_INTELLISENSE_DIRECTIVES # pragma once +# include "filesystem.hpp" +# include "strings.hpp" # include "string_ops.cpp" #endif diff --git a/project/dependencies/src_start.cpp b/project/dependencies/src_start.cpp index dda2e1d..02d804e 100644 --- a/project/dependencies/src_start.cpp +++ b/project/dependencies/src_start.cpp @@ -1,3 +1,7 @@ +#ifdef GEN_INTELLISENSE_DIRECTIVES +# include "header_start.hpp" +#endif + #pragma region Macros and Includes # include diff --git a/project/dependencies/string_ops.cpp b/project/dependencies/string_ops.cpp index 28729da..e163e7d 100644 --- a/project/dependencies/string_ops.cpp +++ b/project/dependencies/string_ops.cpp @@ -1,5 +1,6 @@ #ifdef GEN_INTELLISENSE_DIRECTIVES # pragma once +# include "string_ops.hpp" # include "debug.cpp" #endif