compiles agian...

This commit is contained in:
Edward R. Gonzalez 2023-08-21 21:40:23 -04:00
parent 4a2ed6de4e
commit 5c47777972
45 changed files with 70 additions and 66 deletions

View File

@ -1,3 +1,5 @@
#include "builder.hpp"
Builder Builder::open( char const* path ) Builder Builder::open( char const* path )
{ {
Builder result; Builder result;

View File

@ -1,3 +1,6 @@
#pragma once
#include "gen.hpp"
struct Builder struct Builder
{ {
FileInfo File; FileInfo File;

View File

@ -1,9 +1,6 @@
#pragma once #pragma once
#include "gen.scanner.hpp" #include "gen.scanner.hpp"
namespace gen {
struct Policy struct Policy
{ {
// Nothing for now. // Nothing for now.
@ -68,6 +65,3 @@ struct Editor
bool process_requests( Array<Receipt> out_receipts ); bool process_requests( Array<Receipt> out_receipts );
}; };
// namespace gen
};

View File

@ -1 +1 @@
#include "scanner.hpp"

View File

@ -1,3 +1,6 @@
#pragma once
#include "gen.hpp"
// This is a simple file reader that reads the entire file into memory. // This is a simple file reader that reads the entire file into memory.
// It has an extra option to skip the first few lines for undesired includes. // It has an extra option to skip the first few lines for undesired includes.
// This is done so that includes can be kept in dependency and component files so that intellisense works. // This is done so that includes can be kept in dependency and component files so that intellisense works.
@ -48,7 +51,7 @@ Code scan_file( char const* path, bool skip_header_includes = true )
} }
// Skip the line // Skip the line
sptr skip_size = sptr( scanner - str ); sptr skip_size = sptr( scanner - str.Data );
if ( current == '\r' ) if ( current == '\r' )
{ {
skip_size += 2; skip_size += 2;

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "static_data.cpp" // #include "static_data.cpp"
Code Code::Global; Code Code::Global;
Code Code::Invalid; Code Code::Invalid;

View File

@ -1,8 +1,8 @@
#pragma once #pragma once
#include "types.hpp" // #include "types.hpp"
#include "temp/ecode.hpp" // #include "temp/ecode.hpp"
#include "temp/eoperator.hpp" // #include "temp/eoperator.hpp"
#include "temp/especifier.hpp" // #include "temp/especifier.hpp"
struct AST; struct AST;
struct AST_Body; struct AST_Body;

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "ast.hpp" // #include "ast.hpp"
#pragma region AST Types #pragma region AST Types
/* /*

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "inlines.hpp" // #include "inlines.hpp"
#include "temp/ast_inlines.hpp" // #include "temp/ast_inlines.hpp"
#pragma region Constants #pragma region Constants
@ -77,7 +77,7 @@ extern CodeSpecifiers spec_constexpr;
extern CodeSpecifiers spec_constinit; extern CodeSpecifiers spec_constinit;
extern CodeSpecifiers spec_extern_linkage; extern CodeSpecifiers spec_extern_linkage;
extern CodeSpecifiers spec_final; extern CodeSpecifiers spec_final;
extern CodeSpeciifers spec_forceinline; extern CodeSpecifiers spec_forceinline;
extern CodeSpecifiers spec_global; extern CodeSpecifiers spec_global;
extern CodeSpecifiers spec_inline; extern CodeSpecifiers spec_inline;
extern CodeSpecifiers spec_internal_linkage; extern CodeSpecifiers spec_internal_linkage;
@ -144,11 +144,11 @@ extern CodeType t_typename;
# define args( ... ) num_args( __VA_ARGS__ ), __VA_ARGS__ # define args( ... ) num_args( __VA_ARGS__ ), __VA_ARGS__
# define code_str( ... ) gen::untyped_str( code( __VA_ARGS__ ) ) # define code_str( ... ) GEN_NS untyped_str( code( __VA_ARGS__ ) )
# define code_fmt( ... ) gen::untyped_str( token_fmt( __VA_ARGS__ ) ) # define code_fmt( ... ) GEN_NS untyped_str( token_fmt( __VA_ARGS__ ) )
// Takes a format string (char const*) and a list of tokens (StrC) and returns a StrC of the formatted string. // Takes a format string (char const*) and a list of tokens (StrC) and returns a StrC of the formatted string.
# define token_fmt( ... ) gen::token_fmt_impl( (num_args( __VA_ARGS__ ) + 1) / 2, __VA_ARGS__ ) # define token_fmt( ... ) GEN_NS token_fmt_impl( (num_args( __VA_ARGS__ ) + 1) / 2, __VA_ARGS__ )
#pragma endregion Macros #pragma endregion Macros

View File

@ -20,9 +20,11 @@
#ifndef GEN_NS_BEGIN #ifndef GEN_NS_BEGIN
# ifdef GEN_DONT_USE_NAMESPACE # ifdef GEN_DONT_USE_NAMESPACE
# define GEN_NS
# define GEN_NS_BEGIN # define GEN_NS_BEGIN
# define GEN_NS_END # define GEN_NS_END
# else # else
# define GEN_NS gen::
# define GEN_NS_BEGIN namespace gen { # define GEN_NS_BEGIN namespace gen {
# define GEN_NS_END } # define GEN_NS_END }
# endif # endif

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "interface.hpp" // #include "interface.hpp"
void AST::append( AST* other ) void AST::append( AST* other )
{ {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "ast.cpp" // #include "ast.cpp"
internal void init_parser(); internal void init_parser();
internal void deinit_parser(); internal void deinit_parser();

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "ast_types.hpp" // #include "ast_types.hpp"
#pragma region Gen Interface #pragma region Gen Interface

View File

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "temp/etoktype.cpp" // #include "temp/etoktype.cpp"
#include "interface.upfront.cpp" // #include "interface.upfront.cpp"
namespace Parser namespace Parser
{ {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "interface.parsing.cpp" // #include "interface.parsing.cpp"
sw token_fmt_va( char* buf, uw buf_size, s32 num_tokens, va_list va ) sw token_fmt_va( char* buf, uw buf_size, s32 num_tokens, va_list va )
{ {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "interface.cpp" // #include "interface.cpp"
#pragma region Upfront #pragma region Upfront

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "src_start.cpp" // #include "src_start.cpp"
#pragma region StaticData #pragma region StaticData
@ -50,7 +50,7 @@ global CodeSpecifiers spec_constexpr;
global CodeSpecifiers spec_constinit; global CodeSpecifiers spec_constinit;
global CodeSpecifiers spec_extern_linkage; global CodeSpecifiers spec_extern_linkage;
global CodeSpecifiers spec_final; global CodeSpecifiers spec_final;
global CodeSpeciifers spec_forceinline; global CodeSpecifiers spec_forceinline;
global CodeSpecifiers spec_global; global CodeSpecifiers spec_global;
global CodeSpecifiers spec_inline; global CodeSpecifiers spec_inline;
global CodeSpecifiers spec_internal_linkage; global CodeSpecifiers spec_internal_linkage;

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "header_start.hpp" // #include "header_start.hpp"
using LogFailType = sw(*)(char const*, ...); using LogFailType = sw(*)(char const*, ...);

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "macros.hpp" // #include "macros.hpp"
#pragma region Basic Types #pragma region Basic Types

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "printing.hpp" // #include "printing.hpp"
#pragma region Containers #pragma region Containers

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "src_start.cpp" // #include "src_start.cpp"
#pragma region Debug #pragma region Debug

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "basic_types.hpp" // #include "basic_types.hpp"
#pragma region Debug #pragma region Debug

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "strings.cpp" // #include "strings.cpp"
#pragma region File Handling #pragma region File Handling

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "strings.hpp" // #include "strings.hpp"
#pragma region File Handling #pragma region File Handling

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "memory.cpp" // #include "memory.cpp"
#pragma region Hashing #pragma region Hashing

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "containers.hpp" // #include "containers.hpp"
#pragma region Hashing #pragma region Hashing

View File

@ -116,9 +116,11 @@
#pragma endregion Mandatory Includes #pragma endregion Mandatory Includes
#ifdef GEN_DONT_USE_NAMESPACE #ifdef GEN_DONT_USE_NAMESPACE
# define GEN_NS
# define GEN_NS_BEGIN # define GEN_NS_BEGIN
# define GEN_NS_END # define GEN_NS_END
#else #else
# define GEN_NS gen::
# define GEN_NS_BEGIN namespace gen { # define GEN_NS_BEGIN namespace gen {
# define GEN_NS_END } # define GEN_NS_END }
#endif #endif

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "header_start.hpp" // #include "header_start.hpp"
#pragma region Macros #pragma region Macros

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "printing.cpp" // #include "printing.cpp"
#pragma region Memory #pragma region Memory

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "debug.hpp" // #include "debug.hpp"
#pragma region Memory #pragma region Memory

View File

@ -1,3 +1,5 @@
#pragma once
#pragma region ADT #pragma region ADT
#define _adt_fprintf( s_, fmt_, ... ) \ #define _adt_fprintf( s_, fmt_, ... ) \

View File

@ -1,3 +1,5 @@
#pragma once
#pragma region ADT #pragma region ADT
enum ADT_Type : u32 enum ADT_Type : u32

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "string_ops.cpp" // #include "string_ops.cpp"
#pragma region Printing #pragma region Printing

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "string_ops.hpp" // #include "string_ops.hpp"
#pragma region Printing #pragma region Printing

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "debug.cpp" // #include "debug.cpp"
#pragma region String Ops #pragma region String Ops

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "memory.hpp" // #include "memory.hpp"
#pragma region String Ops #pragma region String Ops

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "hashing.cpp" // #include "hashing.cpp"
#pragma region String #pragma region String

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "hashing.hpp" // #include "hashing.hpp"
#pragma region Strings #pragma region Strings

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "filesystem.cpp" // #include "filesystem.cpp"
#pragma region Timing #pragma region Timing

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#include "filesystem.hpp" // #include "filesystem.hpp"
#pragma region Timing #pragma region Timing

View File

@ -14,7 +14,7 @@
# include "gen.dep.cpp" # include "gen.dep.cpp"
#endif #endif
GEN_NS_BEGIN namespace gen {
#include "components/static_data.cpp" #include "components/static_data.cpp"
@ -27,6 +27,6 @@ GEN_NS_BEGIN
#include "components/interface.parsing.cpp" #include "components/interface.parsing.cpp"
#include "components/interface.untyped.cpp" #include "components/interface.untyped.cpp"
GEN_NS_END }
#include "helpers/pop_ignores.inline.hpp" #include "helpers/pop_ignores.inline.hpp"

View File

@ -3,7 +3,7 @@
#include "dependencies/src_start.cpp" #include "dependencies/src_start.cpp"
GEN_NS_BEGIN namespace gen {
#include "dependencies/debug.cpp" #include "dependencies/debug.cpp"
#include "dependencies/string_ops.cpp" #include "dependencies/string_ops.cpp"
@ -14,4 +14,4 @@ GEN_NS_BEGIN
#include "dependencies/filesystem.cpp" #include "dependencies/filesystem.cpp"
#include "dependencies/timing.cpp" #include "dependencies/timing.cpp"
GEN_NS_END }

View File

@ -3,7 +3,7 @@
#include "dependencies/header_start.hpp" #include "dependencies/header_start.hpp"
GEN_NS_BEGIN namespace gen {
#include "dependencies/macros.hpp" #include "dependencies/macros.hpp"
#include "dependencies/basic_types.hpp" #include "dependencies/basic_types.hpp"
@ -17,4 +17,4 @@ GEN_NS_BEGIN
#include "dependencies/filesystem.hpp" #include "dependencies/filesystem.hpp"
#include "dependencies/timing.hpp" #include "dependencies/timing.hpp"
GEN_NS_END }

View File

@ -11,7 +11,7 @@
#include "helpers/push_ignores.inline.hpp" #include "helpers/push_ignores.inline.hpp"
#include "components/header_start.hpp" #include "components/header_start.hpp"
GEN_NS_BEGIN namespace gen {
#include "components/types.hpp" #include "components/types.hpp"
#include "components/temp/ecode.hpp" #include "components/temp/ecode.hpp"
@ -27,6 +27,6 @@ GEN_NS_BEGIN
#include "components/temp/ast_inlines.hpp" #include "components/temp/ast_inlines.hpp"
#include "components/header_end.hpp" #include "components/header_end.hpp"
GEN_NS_END }
#include "helpers/pop_ignores.inline.hpp" #include "helpers/pop_ignores.inline.hpp"

View File

@ -2,9 +2,9 @@
#include "gen.hpp" #include "gen.hpp"
GEN_NS_BEGIN namespace gen {
#include "dependencies/parsing.hpp" #include "dependencies/parsing.hpp"
GEN_NS_END }
using namespace gen; using namespace gen;
@ -30,13 +30,7 @@ CodeBody gen_ecode( char const* path )
to_str_entries.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", code, code ); to_str_entries.append_fmt( "{ sizeof(\"%s\"), \"%s\" },\n", code, code );
} }
CodeEnum enum_code = parse_enum( token_fmt( "entries", (StrC)enum_entries, stringize( CodeEnum enum_code = parse_enum(gen::token_fmt_impl((3 + 1) / 2, "entries", (StrC)enum_entries, "enum Type : u32 { <entries> NumTypes };"));
enum Type : u32
{
<entries>
NumTypes
};
)));
#pragma push_macro( "local_persist" ) #pragma push_macro( "local_persist" )
#undef local_persist #undef local_persist