diff --git a/Readme.md b/Readme.md
index 3c6cc67..d15ac94 100644
--- a/Readme.md
+++ b/Readme.md
@@ -5,8 +5,7 @@ An attempt at simple staged metaprogramming for c/c++.
The library API is a composition of code element constructors.
These build up a code AST to then serialize with a file builder.
-This code base attempts follow the [handmade philosophy](https://handmade.network/manifesto).
-
+This code base attempts follow the [handmade philosophy](https://handmade.network/manifesto).
Its not meant to be a black box metaprogramming utility, it should be easy to intergrate into a user's project domain.
## Notes
diff --git a/docs/Parsing.md b/docs/Parsing.md
index 62c84df..39010dd 100644
--- a/docs/Parsing.md
+++ b/docs/Parsing.md
@@ -2,7 +2,7 @@
The library features a naive parser tailored for only what the library needs to construct the supported syntax of C++ into its AST.
-This parser does not, and should not do the compiler's job. By only supporting this minimal set of features, the parser is kept (so far) around 5000 loc.
+This parser does not, and should not do the compiler's job. By only supporting this minimal set of features, the parser is kept (so far) around 5500 loc. I hope to keep it under 10k loc worst case.
You can think of this parser of a frontend parser vs a semantic parser. Its intuitively similar to WYSIWYG. What you precerive as the syntax from the user-side before the compiler gets a hold of it, is what you get.
diff --git a/gencpp.10x b/gencpp.10x
index c8d06e3..29874bd 100644
--- a/gencpp.10x
+++ b/gencpp.10x
@@ -8,21 +8,22 @@
true
false
false
- powershell ./scripts/test.gen_run.ps1
+ pwsh ./scripts/build.ps1 msvc debug bootstrap
- powershell ./scripts/clean.ps1
+ psh ./scripts/clean.ps1
./test/gen/build/gencpp.exe
- powershell ./scripts/build.ps1
+ pwsh ./scripts/build.ps1
./test/gen/build/gencpp.exe
- gencpp.sln
+
false
Debug
Release
+ bootstrap debug
x64
@@ -41,6 +42,7 @@
GEN_TIME
GEN_SYSTEM_WINDOWS
+ GEN_INTELLISENSE_DIRECTIVES
@@ -48,10 +50,19 @@
+
+ bootstrap debug:x64
+
+
+
Debug
+
+ bootstrap debug
+
+
x64
diff --git a/gencpp.sln b/gencpp.sln
index 720de80..ea81492 100644
--- a/gencpp.sln
+++ b/gencpp.sln
@@ -7,20 +7,37 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gencpp", "gencpp.vcxproj",
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
+ bootstrap debug|x64 = bootstrap debug|x64
+ bootstrap debug|x86 = bootstrap debug|x86
+ bootstrap release|x64 = bootstrap release|x64
+ bootstrap release|x86 = bootstrap release|x86
+ singleheader debug|x64 = singleheader debug|x64
+ singleheader debug|x86 = singleheader debug|x86
+ singleheader release|x64 = singleheader release|x64
+ singleheader release|x86 = singleheader release|x86
+ test debug|x64 = test debug|x64
+ test debug|x86 = test debug|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Debug|x64.ActiveCfg = Debug|x64
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Debug|x64.Build.0 = Debug|x64
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Debug|x86.ActiveCfg = Debug|Win32
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Debug|x86.Build.0 = Debug|Win32
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Release|x64.ActiveCfg = Release|x64
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Release|x64.Build.0 = Release|x64
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Release|x86.ActiveCfg = Release|Win32
- {53AF600D-C09C-4F39-83E0-E022AA9479F2}.Release|x86.Build.0 = Release|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.bootstrap debug|x64.ActiveCfg = bootstrap release|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.bootstrap debug|x64.Build.0 = bootstrap release|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.bootstrap debug|x86.ActiveCfg = bootstrap debug|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.bootstrap debug|x86.Build.0 = bootstrap debug|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.bootstrap release|x64.ActiveCfg = bootstrap release|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.bootstrap release|x86.ActiveCfg = bootstrap release|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.bootstrap release|x86.Build.0 = bootstrap release|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader debug|x64.ActiveCfg = singleheader debug|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader debug|x64.Build.0 = singleheader debug|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader debug|x86.ActiveCfg = singleheader debug|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader debug|x86.Build.0 = singleheader debug|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader release|x64.ActiveCfg = bootstrap debug|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader release|x64.Build.0 = bootstrap debug|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader release|x86.ActiveCfg = singleheader release|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.singleheader release|x86.Build.0 = singleheader release|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.test debug|x64.ActiveCfg = test debug|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.test debug|x64.Build.0 = test debug|x64
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.test debug|x86.ActiveCfg = test debug|Win32
+ {53AF600D-C09C-4F39-83E0-E022AA9479F2}.test debug|x86.Build.0 = test debug|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/gencpp.vcxproj b/gencpp.vcxproj
index 957f357..33bde5a 100644
--- a/gencpp.vcxproj
+++ b/gencpp.vcxproj
@@ -1,20 +1,44 @@
-
- Debug
+
+ bootstrap debug
Win32
-
- Release
- Win32
-
-
- Debug
+
+ bootstrap debug
x64
-
- Release
+
+ bootstrap release
+ Win32
+
+
+ bootstrap release
+ x64
+
+
+ singleheader debug
+ Win32
+
+
+ singleheader debug
+ x64
+
+
+ singleheader release
+ Win32
+
+
+ singleheader release
+ x64
+
+
+ test debug
+ Win32
+
+
+ test debug
x64
@@ -25,24 +49,54 @@
10.0
-
+
Makefile
true
v143
-
- Makefile
- false
- v143
-
-
+
Makefile
true
v143
-
+
Makefile
- false
+ true
+ v143
+
+
+ Makefile
+ true
+ v143
+
+
+ Makefile
+ true
+ v143
+
+
+ Makefile
+ true
+ v143
+
+
+ Makefile
+ true
+ v143
+
+
+ Makefile
+ true
+ v143
+
+
+ Makefile
+ true
+ v143
+
+
+ Makefile
+ true
v143
@@ -50,48 +104,132 @@
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
./scripts/build.ps1
./scripts/clean.ps1
./scripts/build.ps1
WIN32;_DEBUG;$(NMakePreprocessorDefinitions)
-
+
./scripts/build.ps1
./scripts/clean.ps1
./scripts/build.ps1
- WIN32;NDEBUG;$(NMakePreprocessorDefinitions)
+ WIN32;_DEBUG;$(NMakePreprocessorDefinitions)
-
- powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"
- powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"
- powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"
- GEN_TIME;$(NMakePreprocessorDefinitions)
- $(ProjectDir)thirdparty;$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)
- $(ProjectDir)project;$(ProjectDir)test;$(SourcePath)
+
+ ./scripts/build.ps1
+ ./scripts/clean.ps1
+ ./scripts/build.ps1
+ WIN32;_DEBUG;$(NMakePreprocessorDefinitions)
-
- powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"
- powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"
- powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"
- GEN_TIME;$(NMakePreprocessorDefinitions)
- $(ProjectDir)thirdparty;$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)
- $(ProjectDir)project;$(ProjectDir)test;$(SourcePath)
+
+ ./scripts/build.ps1
+ ./scripts/clean.ps1
+ ./scripts/build.ps1
+ WIN32;_DEBUG;$(NMakePreprocessorDefinitions)
-
+
+ ./scripts/build.ps1
+ ./scripts/clean.ps1
+ ./scripts/build.ps1
+ WIN32;_DEBUG;$(NMakePreprocessorDefinitions)
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc debug bootstrap
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"
+ GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)
+ $(ProjectDir)project;$(ProjectDir)test;$(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)
+ $(ProjectDir)project;$(ProjectDir)test;$(IncludePath)
+ $(ProjectDir)project;$(SourcePath)
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc debug singleheader
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"
+ GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)
+ $(ProjectDir)project;$(ProjectDir)test;$(IncludePath)
+ $(ProjectDir)project;$(SourcePath)
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc release singleheader
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"
+ GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)
+ $(ProjectDir)project;$(ProjectDir)test;$(IncludePath)
+ $(ProjectDir)project;$(SourcePath)
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc release bootstrap
+
+
+ pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"
+ GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)
+ $(ProjectDir)project;$(ProjectDir)test;$(IncludePath)
+ $(ProjectDir)project;$(SourcePath)
+
+
+
+ stdc11
+
+
+
+
+ stdc11
+
+
+
+
+ stdc11
+
+
+
+
+ stdc11
+
+
+
stdc11
@@ -105,6 +243,7 @@
+
@@ -124,6 +263,10 @@
+
+
+
+
@@ -153,6 +296,7 @@
+
@@ -174,6 +318,7 @@
+
diff --git a/gencpp.vcxproj.filters b/gencpp.vcxproj.filters
index cd9c640..7c5e189 100644
--- a/gencpp.vcxproj.filters
+++ b/gencpp.vcxproj.filters
@@ -129,6 +129,9 @@
Source Files
+
+ Source Files
+
@@ -275,6 +278,21 @@
Header Files
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
+
+ Header Files
+
@@ -297,6 +315,7 @@
+
diff --git a/gencpp.vcxproj.user b/gencpp.vcxproj.user
index 568a826..4b348cc 100644
--- a/gencpp.vcxproj.user
+++ b/gencpp.vcxproj.user
@@ -3,14 +3,29 @@
true
-
+
false
WindowsLocalDebugger
- C:\projects\gencpp\test\gen\build\gencpp.exe
+ $(ProjectDir)project\build\bootstrap.exe
-
+
false
WindowsLocalDebugger
- C:\projects\gencpp\test\gen\build\gencpp.exe
+ $(ProjectDir)project\build\bootstrap.exe
+
+
+ false
+ WindowsLocalDebugger
+ $(ProjectDir)project\build\bootstrap.exe
+
+
+ false
+ WindowsLocalDebugger
+ $(ProjectDir)project\build\bootstrap.exe
+
+
+ false
+ WindowsLocalDebugger
+ $(ProjectDir)project\build\bootstrap.exe
\ No newline at end of file
diff --git a/project/auxillary/scanner.hpp b/project/auxillary/scanner.hpp
index 6b6b435..242ff51 100644
--- a/project/auxillary/scanner.hpp
+++ b/project/auxillary/scanner.hpp
@@ -120,45 +120,40 @@ Code scan_file( char const* path )
}
#if 0
-struct Policy
+struct CodeFile
{
- // Nothing for now.
+ using namespace Parser;
+
+ String FilePath;
+ TokArray Tokens;
+ Array ParseFailures;
+ Code CodeRoot;
};
-struct SymbolInfo
+namespace Parser
{
- StringCached File;
- char const* Marker;
- Code Signature;
-};
-
-struct Scanner
-{
- struct RequestEntry
+ struct ParseFailure
{
- SymbolInfo Info;
+ String Reason;
+ Code Node;
};
+}
- struct Receipt
- {
- StringCached File;
- Code Defintion;
- bool Result;
- };
+CodeFile scan_file( char const* path )
+{
+ using namespace Parser;
- AllocatorInfo MemAlloc;
+ CodeFile
+ result = {};
+ result.FilePath = String::make( GlobalAllocator, path );
- static void set_allocator( AllocatorInfo allocator );
+ Code code = scan_file( path );
+ result.CodeRoot = code;
- Array Files;
- String Buffer;
- Array Requests;
+ ParseContext context = parser_get_last_context();
+ result.Tokens = context.Tokens;
+ result.ParseFailures = context.Failures;
- void add_files( s32 num, char const** files );
-
- void add( SymbolInfo signature, Policy policy );
-
- bool process_requests( Array out_receipts );
-};
+ return result;
+}
#endif
-
diff --git a/project/bootstrap.cpp b/project/bootstrap.cpp
index 6e661ed..facf3c9 100644
--- a/project/bootstrap.cpp
+++ b/project/bootstrap.cpp
@@ -148,6 +148,7 @@ int gen_main()
CodeBody gen_component_header = def_global_body( args(
def_preprocess_cond( PreprocessCond_IfDef, txt("GEN_INTELLISENSE_DIRECTIVES") ),
pragma_once,
+ def_include(txt("types.hpp")),
preprocess_endif,
fmt_newline,
untyped_str( to_str(generation_notice) )
diff --git a/project/components/ast.cpp b/project/components/ast.cpp
index 837da3f..11f8fc9 100644
--- a/project/components/ast.cpp
+++ b/project/components/ast.cpp
@@ -6,32 +6,276 @@
Code Code::Global;
Code Code::Invalid;
+// This serializes all the data-members in a "debug" format, where each member is printed with its associated value.
char const* AST::debug_str()
{
+ String result = String::make_reserve( GlobalAllocator, kilobytes(1) );
+
+#if 1
if ( Parent )
+ result.append_fmt( "\n\tParent : %S %S", Parent->type_str(), Name ? Name : "" );
+ else
+ result.append_fmt( "\n\tParent : %S", "Null" );
+
+ result.append_fmt( "\n\tName : %S", Name ? Name : "Null" );
+ result.append_fmt( "\n\tType : %S", type_str() );
+ result.append_fmt( "\n\tModule Flags : %S", to_str( ModuleFlags ) );
+ result.append_fmt( "\n\tToken : %d", Token );
+
+ switch ( Type )
{
- String
- result = String::make_reserve( GlobalAllocator, kilobytes(1) );
- result.append_fmt(
- "\n\tType : %s"
- "\n\tParent : %s %s"
- "\n\tName : %s"
- , type_str()
- , Parent->type_str()
- , Parent->Name, Name ? Name : ""
- );
+ using namespace ECode;
- return result;
+ case Invalid:
+ case NewLine:
+ case Access_Private:
+ case Access_Protected:
+ case Access_Public:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+ break;
+
+ case Untyped:
+ case Execution:
+ case Comment:
+ case PlatformAttributes:
+ case Preprocess_Define:
+ case Preprocess_Include:
+ case Preprocess_Pragma:
+ case Preprocess_If:
+ case Preprocess_ElIf:
+ case Preprocess_Else:
+ case Preprocess_IfDef:
+ case Preprocess_IfNotDef:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ result.append_fmt( "\n\tContent: %S", Content );
+ break;
+
+ case Class:
+ case Struct:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ result.append_fmt( "\n\tInlineCmd : %S", InlineCmt ? InlineCmt->Content : "Null" );
+ result.append_fmt( "\n\tAttributes : %S", Attributes ? Attributes->to_string() : "Null" );
+ result.append_fmt( "\n\tParentAccess: %s", ParentType ? to_str( ParentAccess ) : "No Parent" );
+ result.append_fmt( "\n\tParentType : %s", ParentType ? ParentType->type_str() : "Null" );
+ result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" );
+ break;
+
+ case Constructor:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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\tInitializerList: %S", InitializerList ? InitializerList->to_string() : "Null" );
+ result.append_fmt( "\n\tParams : %S", Params ? Params->to_string() : "Null" );
+ result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" );
+ break;
+
+ case Destructor:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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\tBody : %S", Body ? Body->debug_str() : "Null" );
+ break;
+
+ case Enum:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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" );
+ result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" );
+ break;
+
+ case Extern_Linkage:
+ case Namespace:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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 );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" );
+ result.append_fmt( "\n\tDeclaration: %S", Declaration ? Declaration->to_string() : "Null" );
+ break;
+
+ case Function:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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\tBody : %S", Body ? Body->debug_str() : "Null" );
+ break;
+
+ case Module:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+ break;
+
+ case Operator:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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\tBody : %S", Body ? Body->debug_str() : "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 );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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" );
+ result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" );
+ break;
+
+ case Parameters:
+ result.append_fmt( "\n\tNumEntries: %d", NumEntries );
+ result.append_fmt( "\n\tLast : %S", Last->Name );
+ result.append_fmt( "\n\tNext : %S", Next->Name );
+ result.append_fmt( "\n\tValueType : %S", ValueType ? ValueType->to_string() : "Null" );
+ result.append_fmt( "\n\tValue : %S", Value ? Value->to_string() : "Null" );
+ break;
+
+ case Specifiers:
+ {
+ result.append_fmt( "\n\tNumEntries: %d", NumEntries );
+ result.append( "\n\tArrSpecs: " );
+
+ s32 idx = 0;
+ s32 left = NumEntries;
+ while ( left-- )
+ {
+ StrC spec = ESpecifier::to_str( ArrSpecs[idx] );
+ result.append_fmt( "%.*s, ", spec.Len, spec.Ptr );
+ idx++;
+ }
+ result.append_fmt( "\n\tNextSpecs: %S", NextSpecs ? NextSpecs->debug_str() : "Null" );
+ }
+ break;
+
+ case Template:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ result.append_fmt( "\n\tParams : %S", Params ? Params->to_string() : "Null" );
+ result.append_fmt( "\n\tDeclaration: %S", Declaration ? Declaration->to_string() : "Null" );
+ break;
+
+ case Typedef:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ result.append_fmt( "\n\tInlineCmt : %S", InlineCmt ? InlineCmt->Content : "Null" );
+ result.append_fmt( "\n\tUnderlyingType: %S", UnderlyingType ? UnderlyingType->to_string() : "Null" );
+ break;
+
+ case Typename:
+ 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\tArrExpr : %S", ArrExpr ? ArrExpr->to_string() : "Null" );
+ break;
+
+ case Union:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ result.append_fmt( "\n\tAttributes: %S", Attributes ? Attributes->to_string() : "Null" );
+ result.append_fmt( "\n\tBody : %S", Body ? Body->debug_str() : "Null" );
+ break;
+
+ case Using:
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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\tUnderlyingType: %S", UnderlyingType ? UnderlyingType->to_string() : "Null" );
+ break;
+
+ case Variable:
+
+ if ( Parent && Parent->Type == Variable )
+ {
+ // Its a NextVar
+ result.append_fmt( "\n\tSpecs : %S", Specs ? Specs->to_string() : "Null" );
+ result.append_fmt( "\n\tValue : %S", Value ? Value->to_string() : "Null" );
+ result.append_fmt( "\n\tBitfieldSize: %S", BitfieldSize ? BitfieldSize->to_string() : "Null" );
+ result.append_fmt( "\n\tNextVar : %S", NextVar ? NextVar->debug_str() : "Null" );
+ break;
+ }
+
+ if ( Prev )
+ result.append_fmt( "\n\tPrev: %S %S", Prev->type_str(), Prev->Name );
+ if ( Next )
+ result.append_fmt( "\n\tNext: %S %S", Prev->type_str(), Prev->Name );
+
+ 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\tValueType : %S", ValueType ? ValueType->to_string() : "Null" );
+ result.append_fmt( "\n\tBitfieldSize: %S", BitfieldSize ? BitfieldSize->to_string() : "Null" );
+ result.append_fmt( "\n\tValue : %S", Value ? Value->to_string() : "Null" );
+ result.append_fmt( "\n\tNextVar : %S", NextVar ? NextVar->debug_str() : "Null" );
+ break;
}
-
- String
- result = String::make_reserve( GlobalAllocator, kilobytes(1) );
- result.append_fmt(
- "\n\tType : %s"
- "\n\tName : %s"
- , type_str()
- , Name ? Name : ""
- );
+#endif
return result;
}
@@ -61,7 +305,11 @@ String AST::to_string()
using namespace ECode;
case Invalid:
+ #ifdef GEN_DONT_ALLOW_INVALID_CODE
log_failure("Attempted to serialize invalid code! - %S", Parent ? Parent->debug_str() : Name );
+ #else
+ result.append_fmt( "Invalid Code!" );
+ #endif
break;
case NewLine:
@@ -71,6 +319,7 @@ String AST::to_string()
case Untyped:
case Execution:
case Comment:
+ case PlatformAttributes:
result.append( Content );
break;
@@ -80,9 +329,6 @@ String AST::to_string()
result.append( Name );
break;
- case PlatformAttributes:
- result.append( Content );
-
case Class:
{
if ( bitfield_is_equal( u32, ModuleFlags, ModuleFlag::Export ))
diff --git a/project/components/ast.hpp b/project/components/ast.hpp
index c1468ba..9169404 100644
--- a/project/components/ast.hpp
+++ b/project/components/ast.hpp
@@ -41,10 +41,10 @@ struct CodeBody;
// These are to offer ease of use and optionally strong type safety for the AST.
struct CodeAttributes;
struct CodeComment;
-struct CodeConstructor;
-struct CodeDestructor;
struct CodeClass;
+struct CodeConstructor;
struct CodeDefine;
+struct CodeDestructor;
struct CodeEnum;
struct CodeExec;
struct CodeExtern;
@@ -217,14 +217,14 @@ struct AST
uw ArrSpecs_Cap =
(
AST_POD_Size
- - sizeof(AST*) * 3
+ - sizeof(AST*) * 4
- sizeof(StringCached)
- sizeof(CodeT)
- sizeof(ModuleFlag)
- sizeof(u32)
- sizeof(s32)
)
- / sizeof(SpecifierT) - 1; // -1 for 4 extra bytes
+ / sizeof(SpecifierT); // -1 for 4 extra bytes
union {
struct
@@ -255,7 +255,10 @@ struct AST
};
};
StringCached Content; // Attributes, Comment, Execution, Include
- SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
+ struct {
+ SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
+ AST* NextSpecs; // Specifiers
+ };
};
union {
AST* Prev;
@@ -310,8 +313,11 @@ struct AST_POD
AST* SpecsFuncSuffix; // Only used with typenames, to store the function suffix if typename is function signature.
};
};
- StringCached Content; // Attributes, Comment, Execution, Include
- SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
+ StringCached Content; // Attributes, Comment, Execution, Include
+ struct {
+ SpecifierT ArrSpecs[AST::ArrSpecs_Cap]; // Specifiers
+ AST* NextSpecs; // Specifiers
+ };
};
union {
AST* Prev;
diff --git a/project/components/ast_types.hpp b/project/components/ast_types.hpp
index 03ed5d0..228e429 100644
--- a/project/components/ast_types.hpp
+++ b/project/components/ast_types.hpp
@@ -12,7 +12,7 @@
struct AST_Body
{
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
Code Front;
Code Back;
Code Parent;
@@ -27,7 +27,7 @@ static_assert( sizeof(AST_Body) == sizeof(AST), "ERROR: AST_Filtered is not the
struct AST_Attributes
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
StringCached Content;
};
Code Prev;
@@ -43,7 +43,7 @@ static_assert( sizeof(AST_Attributes) == sizeof(AST), "ERROR: AST_Attributes is
struct AST_Comment
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
StringCached Content;
};
Code Prev;
@@ -59,7 +59,7 @@ static_assert( sizeof(AST_Comment) == sizeof(AST), "ERROR: AST_Comment is not th
struct AST_Class
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt; // Only supported by forward declarations
@@ -71,7 +71,7 @@ struct AST_Class
char _PAD_PROPERTIES_2_[ sizeof(AST*) ];
};
};
- CodeType Last;
+ CodeType Prev;
CodeType Next;
Code Parent;
StringCached Name;
@@ -85,7 +85,7 @@ static_assert( sizeof(AST_Class) == sizeof(AST), "ERROR: AST_Class is not the sa
struct AST_Constructor
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt; // Only supported by forward declarations
@@ -110,7 +110,7 @@ static_assert( sizeof(AST_Constructor) == sizeof(AST), "ERROR: AST_Constructor i
struct AST_Define
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
StringCached Content;
};
Code Prev;
@@ -126,7 +126,7 @@ static_assert( sizeof(AST_Define) == sizeof(AST), "ERROR: AST_Define is not the
struct AST_Destructor
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -150,7 +150,7 @@ static_assert( sizeof(AST_Destructor) == sizeof(AST), "ERROR: AST_Destructor is
struct AST_Enum
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -176,7 +176,7 @@ static_assert( sizeof(AST_Enum) == sizeof(AST), "ERROR: AST_Enum is not the same
struct AST_Exec
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
StringCached Content;
};
Code Prev;
@@ -192,7 +192,7 @@ static_assert( sizeof(AST_Exec) == sizeof(AST), "ERROR: AST_Exec is not the same
struct AST_Extern
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
char _PAD_PROPERTIES_[ sizeof(AST*) * 5 ];
@@ -213,7 +213,7 @@ static_assert( sizeof(AST_Extern) == sizeof(AST), "ERROR: AST_Extern is not the
struct AST_Include
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
StringCached Content;
};
Code Prev;
@@ -229,7 +229,7 @@ static_assert( sizeof(AST_Include) == sizeof(AST), "ERROR: AST_Include is not th
struct AST_Friend
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -251,7 +251,7 @@ static_assert( sizeof(AST_Friend) == sizeof(AST), "ERROR: AST_Friend is not the
struct AST_Fn
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -276,7 +276,7 @@ static_assert( sizeof(AST_Fn) == sizeof(AST), "ERROR: AST_Fn is not the same siz
struct AST_Module
{
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
Code Prev;
Code Next;
Code Parent;
@@ -291,7 +291,7 @@ static_assert( sizeof(AST_Module) == sizeof(AST), "ERROR: AST_Module is not the
struct AST_NS
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct {
char _PAD_PROPERTIES_[ sizeof(AST*) * 5 ];
CodeBody Body;
@@ -312,7 +312,7 @@ static_assert( sizeof(AST_NS) == sizeof(AST), "ERROR: AST_NS is not the same siz
struct AST_Operator
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -338,7 +338,7 @@ static_assert( sizeof(AST_Operator) == sizeof(AST), "ERROR: AST_Operator is not
struct AST_OpCast
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -363,7 +363,7 @@ static_assert( sizeof(AST_OpCast) == sizeof(AST), "ERROR: AST_OpCast is not the
struct AST_Param
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
char _PAD_PROPERTIES_2_[ sizeof(AST*) * 3 ];
@@ -387,7 +387,7 @@ static_assert( sizeof(AST_Param) == sizeof(AST), "ERROR: AST_Param is not the sa
struct AST_Pragma
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
StringCached Content;
};
Code Prev;
@@ -403,7 +403,7 @@ static_assert( sizeof(AST_Pragma) == sizeof(AST), "ERROR: AST_Pragma is not the
struct AST_PreprocessCond
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
StringCached Content;
};
Code Prev;
@@ -419,6 +419,7 @@ static_assert( sizeof(AST_PreprocessCond) == sizeof(AST), "ERROR: AST_Preprocess
struct AST_Specifiers
{
SpecifierT ArrSpecs[ AST::ArrSpecs_Cap ];
+ CodeSpecifiers NextSpecs;
Code Prev;
Code Next;
Code Parent;
@@ -433,7 +434,7 @@ struct AST_Specifiers
struct AST_Struct
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -445,7 +446,7 @@ struct AST_Struct
char _PAD_PROPERTIES_2_[ sizeof(AST*) ];
};
};
- CodeType Last;
+ CodeType Prev;
CodeType Next;
Code Parent;
StringCached Name;
@@ -459,7 +460,7 @@ static_assert( sizeof(AST_Struct) == sizeof(AST), "ERROR: AST_Struct is not the
struct AST_Template
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
char _PAD_PROPERTIES_[ sizeof(AST*) * 4 ];
@@ -482,7 +483,7 @@ static_assert( sizeof(AST_Template) == sizeof(AST), "ERROR: AST_Template is not
struct AST_Type
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
char _PAD_INLINE_CMT_[ sizeof(AST*) ];
@@ -508,7 +509,7 @@ static_assert( sizeof(AST_Type) == sizeof(AST), "ERROR: AST_Type is not the same
struct AST_Typedef
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -531,7 +532,7 @@ static_assert( sizeof(AST_Typedef) == sizeof(AST), "ERROR: AST_Typedef is not th
struct AST_Union
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
char _PAD_INLINE_CMT_[ sizeof(AST*) ];
@@ -555,7 +556,7 @@ static_assert( sizeof(AST_Union) == sizeof(AST), "ERROR: AST_Union is not the sa
struct AST_Using
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
@@ -579,7 +580,7 @@ static_assert( sizeof(AST_Using) == sizeof(AST), "ERROR: AST_Using is not the sa
struct AST_Var
{
union {
- char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap ];
+ char _PAD_[ sizeof(SpecifierT) * AST::ArrSpecs_Cap + sizeof(AST*) ];
struct
{
CodeComment InlineCmt;
diff --git a/project/components/gen/ast_inlines.hpp b/project/components/gen/ast_inlines.hpp
index de72dbf..20846b4 100644
--- a/project/components/gen/ast_inlines.hpp
+++ b/project/components/gen/ast_inlines.hpp
@@ -1,5 +1,6 @@
#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
+#include "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 ee46c90..678c476 100644
--- a/project/components/gen/ecode.hpp
+++ b/project/components/gen/ecode.hpp
@@ -1,5 +1,6 @@
#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
+#include "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/eoperator.hpp b/project/components/gen/eoperator.hpp
index 3feb117..b1ab7c9 100644
--- a/project/components/gen/eoperator.hpp
+++ b/project/components/gen/eoperator.hpp
@@ -1,5 +1,6 @@
#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
+#include "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/especifier.hpp b/project/components/gen/especifier.hpp
index e94dfd1..7e53adc 100644
--- a/project/components/gen/especifier.hpp
+++ b/project/components/gen/especifier.hpp
@@ -1,5 +1,6 @@
#ifdef GEN_INTELLISENSE_DIRECTIVES
#pragma once
+#include "types.hpp"
#endif
// This file was generated automatially by gencpp's bootstrap.cpp (See: https://github.com/Ed94/gencpp)
diff --git a/project/components/header_end.hpp b/project/components/header_end.hpp
index efc2424..01ebf53 100644
--- a/project/components/header_end.hpp
+++ b/project/components/header_end.hpp
@@ -86,6 +86,7 @@ extern CodeSpecifiers spec_internal_linkage;
extern CodeSpecifiers spec_local_persist;
extern CodeSpecifiers spec_mutable;
extern CodeSpecifiers spec_neverinline;
+extern CodeSpecifiers spec_noexcept;
extern CodeSpecifiers spec_override;
extern CodeSpecifiers spec_ptr;
extern CodeSpecifiers spec_pure;
diff --git a/project/components/interface.cpp b/project/components/interface.cpp
index 8050ca1..44d41cd 100644
--- a/project/components/interface.cpp
+++ b/project/components/interface.cpp
@@ -203,6 +203,7 @@ void define_constants()
def_constant_spec( local_persist, ESpecifier::Local_Persist );
def_constant_spec( mutable, ESpecifier::Mutable );
def_constant_spec( neverinline, ESpecifier::NeverInline );
+ def_constant_spec( noexcept, ESpecifier::NoExceptions );
def_constant_spec( override, ESpecifier::Override );
def_constant_spec( ptr, ESpecifier::Ptr );
def_constant_spec( pure, ESpecifier::Pure )
diff --git a/project/components/interface.parsing.cpp b/project/components/interface.parsing.cpp
index 8089f90..b0f6b46 100644
--- a/project/components/interface.parsing.cpp
+++ b/project/components/interface.parsing.cpp
@@ -5050,8 +5050,9 @@ CodeType parse_type( bool* typedef_is_function )
using namespace ECode;
CodeType
- result = (CodeType) make_code();
- result->Type = Typename;
+ result = (CodeType) make_code();
+ result->Type = Typename;
+ result->Token = Context.Scope->Start;
// Need to wait until were using the new parsing method to do this.
String name_stripped = strip_formatting( name, strip_formatting_dont_preserve_newlines );
diff --git a/project/components/interface.upfront.cpp b/project/components/interface.upfront.cpp
index 0fca812..5b602f7 100644
--- a/project/components/interface.upfront.cpp
+++ b/project/components/interface.upfront.cpp
@@ -861,8 +861,8 @@ CodeInclude def_include( StrC path, bool foreign )
}
StrC content = foreign ?
- to_str( str_fmt_buf( "<%.*s>\n", path.Len, path.Ptr ))
- : to_str( str_fmt_buf( "\"%.*s\"\n", path.Len, path.Ptr ));
+ to_str( str_fmt_buf( "<%.*s>", path.Len, path.Ptr ))
+ : to_str( str_fmt_buf( "\"%.*s\"", path.Len, path.Ptr ));
Code
result = make_code();
diff --git a/project/components/static_data.cpp b/project/components/static_data.cpp
index c5e9eab..cf08c6c 100644
--- a/project/components/static_data.cpp
+++ b/project/components/static_data.cpp
@@ -58,6 +58,7 @@ global CodeSpecifiers spec_inline;
global CodeSpecifiers spec_internal_linkage;
global CodeSpecifiers spec_local_persist;
global CodeSpecifiers spec_mutable;
+global CodeSpecifiers spec_noexcept;
global CodeSpecifiers spec_neverinline;
global CodeSpecifiers spec_override;
global CodeSpecifiers spec_ptr;
diff --git a/project/components/types.hpp b/project/components/types.hpp
index bd8e760..460145e 100644
--- a/project/components/types.hpp
+++ b/project/components/types.hpp
@@ -56,12 +56,26 @@ enum class ModuleFlag : u32
None = 0,
Export = bit(0),
Import = bit(1),
- // Private = bit(2),
Num_ModuleFlags,
Invalid,
};
+StrC to_str( ModuleFlag flag )
+{
+ local_persist
+ StrC lookup[ (u32)ModuleFlag::Num_ModuleFlags ] = {
+ { sizeof("__none__"), "__none__" },
+ { sizeof("export"), "export" },
+ { sizeof("import"), "import" },
+ };
+
+ if ( flag > ModuleFlag::Import )
+ return { sizeof("invalid"), "invalid" };
+
+ return lookup[ (u32)flag ];
+}
+
ModuleFlag operator|( ModuleFlag A, ModuleFlag B)
{
return (ModuleFlag)( (u32)A | (u32)B );