mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
WIP : better AST::debug_str()
Now its more contexually rich to the ast type, however I need to hookup tokens from parsing to the AST. There needs to be a way for the debug string to lookup the token and provide the contexual line. Can either pass it ( TokArray* toks ) from the parser on failure (or `CodeFile`).. Technically there is more than enough room for another Token* ptr. I could add another and specifiers would still have at minimum 14 slots before needing to extended to next specs. **************... yeah
This commit is contained in:
parent
9495fc2985
commit
4b48b96a79
@ -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
|
||||
|
@ -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.
|
||||
|
||||
|
19
gencpp.10x
19
gencpp.10x
@ -8,21 +8,22 @@
|
||||
<ShowEmptyFolders>true</ShowEmptyFolders>
|
||||
<IsVirtual>false</IsVirtual>
|
||||
<IsFolder>false</IsFolder>
|
||||
<BuildCommand>powershell ./scripts/test.gen_run.ps1</BuildCommand>
|
||||
<BuildCommand>pwsh ./scripts/build.ps1 msvc debug bootstrap</BuildCommand>
|
||||
<RebuildCommand></RebuildCommand>
|
||||
<BuildFileCommand></BuildFileCommand>
|
||||
<CleanCommand>powershell ./scripts/clean.ps1</CleanCommand>
|
||||
<CleanCommand>psh ./scripts/clean.ps1</CleanCommand>
|
||||
<BuildWorkingDirectory></BuildWorkingDirectory>
|
||||
<CancelBuild></CancelBuild>
|
||||
<RunCommand>./test/gen/build/gencpp.exe</RunCommand>
|
||||
<RunCommandWorkingDirectory></RunCommandWorkingDirectory>
|
||||
<DebugCommand>powershell ./scripts/build.ps1</DebugCommand>
|
||||
<DebugCommand>pwsh ./scripts/build.ps1</DebugCommand>
|
||||
<ExePathCommand>./test/gen/build/gencpp.exe</ExePathCommand>
|
||||
<DebugSln>gencpp.sln</DebugSln>
|
||||
<DebugSln></DebugSln>
|
||||
<UseVisualStudioEnvBat>false</UseVisualStudioEnvBat>
|
||||
<Configurations>
|
||||
<Configuration>Debug</Configuration>
|
||||
<Configuration>Release</Configuration>
|
||||
<Configuration>bootstrap debug</Configuration>
|
||||
</Configurations>
|
||||
<Platforms>
|
||||
<Platform>x64</Platform>
|
||||
@ -41,6 +42,7 @@
|
||||
<Defines>
|
||||
<Define>GEN_TIME</Define>
|
||||
<Define>GEN_SYSTEM_WINDOWS</Define>
|
||||
<Define>GEN_INTELLISENSE_DIRECTIVES</Define>
|
||||
</Defines>
|
||||
<ConfigProperties>
|
||||
<ConfigAndPlatform>
|
||||
@ -48,10 +50,19 @@
|
||||
<Defines></Defines>
|
||||
<ForceIncludes></ForceIncludes>
|
||||
</ConfigAndPlatform>
|
||||
<ConfigAndPlatform>
|
||||
<Name>bootstrap debug:x64</Name>
|
||||
<Defines></Defines>
|
||||
<ForceIncludes></ForceIncludes>
|
||||
</ConfigAndPlatform>
|
||||
<Config>
|
||||
<Name>Debug</Name>
|
||||
<Defines></Defines>
|
||||
</Config>
|
||||
<Config>
|
||||
<Name>bootstrap debug</Name>
|
||||
<Defines></Defines>
|
||||
</Config>
|
||||
<Platform>
|
||||
<Name>x64</Name>
|
||||
<Defines></Defines>
|
||||
|
41
gencpp.sln
41
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
|
||||
|
227
gencpp.vcxproj
227
gencpp.vcxproj
@ -1,20 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<ProjectConfiguration Include="bootstrap debug|Win32">
|
||||
<Configuration>bootstrap debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<ProjectConfiguration Include="bootstrap debug|x64">
|
||||
<Configuration>bootstrap debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<ProjectConfiguration Include="bootstrap release|Win32">
|
||||
<Configuration>bootstrap release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="bootstrap release|x64">
|
||||
<Configuration>bootstrap release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="singleheader debug|Win32">
|
||||
<Configuration>singleheader debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="singleheader debug|x64">
|
||||
<Configuration>singleheader debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="singleheader release|Win32">
|
||||
<Configuration>singleheader release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="singleheader release|x64">
|
||||
<Configuration>singleheader release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="test debug|Win32">
|
||||
<Configuration>test debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="test debug|x64">
|
||||
<Configuration>test debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
@ -25,24 +49,54 @@
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='test debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='test debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Makefile</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
@ -50,48 +104,132 @@
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='test debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='test debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|Win32'">
|
||||
<NMakeBuildCommandLine>./scripts/build.ps1</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>./scripts/clean.ps1</NMakeCleanCommandLine>
|
||||
<NMakeReBuildCommandLine>./scripts/build.ps1</NMakeReBuildCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='test debug|Win32'">
|
||||
<NMakeBuildCommandLine>./scripts/build.ps1</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>./scripts/clean.ps1</NMakeCleanCommandLine>
|
||||
<NMakeReBuildCommandLine>./scripts/build.ps1</NMakeReBuildCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;NDEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<NMakeBuildCommandLine>powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine>powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine>powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>GEN_TIME;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<IncludePath>$(ProjectDir)thirdparty;$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(ProjectDir)project;$(ProjectDir)test;$(SourcePath)</SourcePath>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|Win32'">
|
||||
<NMakeBuildCommandLine>./scripts/build.ps1</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>./scripts/clean.ps1</NMakeCleanCommandLine>
|
||||
<NMakeReBuildCommandLine>./scripts/build.ps1</NMakeReBuildCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<NMakeBuildCommandLine>powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine>powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1"</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine>powershell.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>GEN_TIME;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<IncludePath>$(ProjectDir)thirdparty;$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(ProjectDir)project;$(ProjectDir)test;$(SourcePath)</SourcePath>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|Win32'">
|
||||
<NMakeBuildCommandLine>./scripts/build.ps1</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>./scripts/clean.ps1</NMakeCleanCommandLine>
|
||||
<NMakeReBuildCommandLine>./scripts/build.ps1</NMakeReBuildCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|Win32'">
|
||||
<NMakeBuildCommandLine>./scripts/build.ps1</NMakeBuildCommandLine>
|
||||
<NMakeCleanCommandLine>./scripts/clean.ps1</NMakeCleanCommandLine>
|
||||
<NMakeReBuildCommandLine>./scripts/build.ps1</NMakeReBuildCommandLine>
|
||||
<NMakePreprocessorDefinitions>WIN32;_DEBUG;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|x64'">
|
||||
<NMakeBuildCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc debug bootstrap</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine>
|
||||
</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<IncludePath>$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(ProjectDir)project;$(SourcePath)</SourcePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='test debug|x64'">
|
||||
<NMakeBuildCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc debug test</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine />
|
||||
<NMakeCleanCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<IncludePath>$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(ProjectDir)project;$(SourcePath)</SourcePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|x64'">
|
||||
<NMakeBuildCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc debug singleheader</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine>
|
||||
</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<IncludePath>$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(ProjectDir)project;$(SourcePath)</SourcePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|x64'">
|
||||
<NMakeBuildCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc release singleheader</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine>
|
||||
</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<IncludePath>$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(ProjectDir)project;$(SourcePath)</SourcePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|x64'">
|
||||
<NMakeBuildCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\build.ps1" msvc release bootstrap</NMakeBuildCommandLine>
|
||||
<NMakeReBuildCommandLine>
|
||||
</NMakeReBuildCommandLine>
|
||||
<NMakeCleanCommandLine>pwsh.exe -ExecutionPolicy Unrestricted -File "$(ProjectDir)scripts\clean.ps1"</NMakeCleanCommandLine>
|
||||
<NMakePreprocessorDefinitions>GEN_INTELLISENSE_DIRECTIVES;GEN_TIME;$(NMakePreprocessorDefinitions)</NMakePreprocessorDefinitions>
|
||||
<IncludePath>$(ProjectDir)project;$(ProjectDir)test;$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(ProjectDir)project;$(SourcePath)</SourcePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|x64'">
|
||||
<ClCompile>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='test debug|x64'">
|
||||
<ClCompile>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|x64'">
|
||||
<ClCompile>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|x64'">
|
||||
<ClCompile>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|x64'">
|
||||
<ClCompile>
|
||||
<LanguageStandard_C>stdc11</LanguageStandard_C>
|
||||
</ClCompile>
|
||||
@ -105,6 +243,7 @@
|
||||
<None Include="project\enums\ESpecifier.csv" />
|
||||
<None Include="project\enums\ETokType.csv" />
|
||||
<None Include="Readme.md" />
|
||||
<None Include="scripts\.clang-format" />
|
||||
<None Include="scripts\build.ci.ps1" />
|
||||
<None Include="scripts\build.ps1" />
|
||||
<None Include="scripts\clean.ps1" />
|
||||
@ -124,6 +263,10 @@
|
||||
<ClInclude Include="project\auxillary\scanner.hpp" />
|
||||
<ClInclude Include="project\components\ast.hpp" />
|
||||
<ClInclude Include="project\components\ast_types.hpp" />
|
||||
<ClInclude Include="project\components\gen\ast_inlines.hpp" />
|
||||
<ClInclude Include="project\components\gen\ecode.hpp" />
|
||||
<ClInclude Include="project\components\gen\eoperator.hpp" />
|
||||
<ClInclude Include="project\components\gen\especifier.hpp" />
|
||||
<ClInclude Include="project\components\header_end.hpp" />
|
||||
<ClInclude Include="project\components\header_start.hpp" />
|
||||
<ClInclude Include="project\components\inlines.hpp" />
|
||||
@ -153,6 +296,7 @@
|
||||
<ClInclude Include="project\helpers\push_ignores.inline.hpp" />
|
||||
<ClInclude Include="project\helpers\undef.macros.hpp" />
|
||||
<ClInclude Include="singleheader\components\header_start.hpp" />
|
||||
<ClInclude Include="test\CURSED_TYPEDEF.h" />
|
||||
<ClInclude Include="test\DummyInclude.hpp" />
|
||||
<ClInclude Include="test\Parsed\Buffer.Parsed.hpp" />
|
||||
<ClInclude Include="test\Parsed\HashTable.Parsed.hpp" />
|
||||
@ -174,6 +318,7 @@
|
||||
<ClCompile Include="project\bootstrap.cpp" />
|
||||
<ClCompile Include="project\components\ast.cpp" />
|
||||
<ClCompile Include="project\components\ast_case_macros.cpp" />
|
||||
<ClCompile Include="project\components\gen\etoktype.cpp" />
|
||||
<ClCompile Include="project\components\interface.cpp" />
|
||||
<ClCompile Include="project\components\interface.parsing.cpp" />
|
||||
<ClCompile Include="project\components\interface.untyped.cpp" />
|
||||
|
@ -129,6 +129,9 @@
|
||||
<ClCompile Include="project\components\interface.untyped.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="project\components\gen\etoktype.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="project\gen.hpp">
|
||||
@ -275,6 +278,21 @@
|
||||
<ClInclude Include="singleheader\components\header_start.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen\ast_inlines.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen\ecode.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen\eoperator.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="project\components\gen\especifier.hpp">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="test\CURSED_TYPEDEF.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include=".editorconfig" />
|
||||
@ -297,6 +315,7 @@
|
||||
<None Include="scripts\helpers\target_arch.psm1" />
|
||||
<None Include="scripts\package_release.ps1" />
|
||||
<None Include="scripts\refactor.ps1" />
|
||||
<None Include="scripts\.clang-format" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Natvis Include=".vscode\gencpp.natvis" />
|
||||
|
@ -3,14 +3,29 @@
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap debug|x64'">
|
||||
<LocalDebuggerAttach>false</LocalDebuggerAttach>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>C:\projects\gencpp\test\gen\build\gencpp.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommand>$(ProjectDir)project\build\bootstrap.exe</LocalDebuggerCommand>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='test debug|x64'">
|
||||
<LocalDebuggerAttach>false</LocalDebuggerAttach>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>C:\projects\gencpp\test\gen\build\gencpp.exe</LocalDebuggerCommand>
|
||||
<LocalDebuggerCommand>$(ProjectDir)project\build\bootstrap.exe</LocalDebuggerCommand>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader debug|x64'">
|
||||
<LocalDebuggerAttach>false</LocalDebuggerAttach>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>$(ProjectDir)project\build\bootstrap.exe</LocalDebuggerCommand>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='singleheader release|x64'">
|
||||
<LocalDebuggerAttach>false</LocalDebuggerAttach>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>$(ProjectDir)project\build\bootstrap.exe</LocalDebuggerCommand>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='bootstrap release|x64'">
|
||||
<LocalDebuggerAttach>false</LocalDebuggerAttach>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
<LocalDebuggerCommand>$(ProjectDir)project\build\bootstrap.exe</LocalDebuggerCommand>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -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<ParseFailure> 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<FileInfo> Files;
|
||||
String Buffer;
|
||||
Array<RequestEntry> 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<Receipt> out_receipts );
|
||||
};
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -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) )
|
||||
|
@ -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 ))
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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 )
|
||||
|
@ -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 );
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user