Library can now construct into AST and serialization itself (singleheader).

Still need to validate if they match.
This commit is contained in:
2023-08-04 16:12:13 -04:00
parent d36c3fa847
commit 34f286d218
23 changed files with 200 additions and 123 deletions

View File

@@ -5,6 +5,7 @@ namespace ECode
# define Define_Types \
Entry( Invalid ) \
Entry( Untyped ) \
Entry( NewLine ) \
Entry( Comment ) \
Entry( Access_Private ) \
Entry( Access_Protected ) \

View File

@@ -57,14 +57,14 @@ namespace EOperator
};
inline
char const* to_str( Type op )
StrC to_str( Type op )
{
local_persist
char const* lookup[ Num_Ops ] = {
# define Entry( Type_, Token_ ) stringize(Token_),
StrC lookup[ Num_Ops ] = {
# define Entry( Type_, Token_ ) { sizeof(stringize(Token_)), stringize(Token_) },
Define_Operators
# undef Entry
","
txt_StrC(",")
};
return lookup[ op ];

View File

@@ -50,10 +50,10 @@ namespace Parser
Entry( Decl_Typedef, "typedef" ) \
Entry( Decl_Using, "using" ) \
Entry( Decl_Union, "union" ) \
Entry( Empty_Line, "__empty_line__" ) \
Entry( Identifier, "__identifier__" ) \
Entry( Module_Import, "import" ) \
Entry( Module_Export, "export" ) \
Entry( NewLine, "__NewLine__" ) \
Entry( Number, "__number__" ) \
Entry( Operator, "__operator__" ) \
Entry( Preprocess_Define, "define") \
@@ -144,12 +144,12 @@ namespace Parser
}
internal inline
char const* to_str( Type type )
StrC to_str( Type type )
{
local_persist
char const* lookup[(u32)NumTokens] =
StrC lookup[(u32)NumTokens] =
{
# define Entry( Name_, Str_ ) Str_,
# define Entry( Name_, Str_ ) { sizeof(Str_), Str_ },
Define_TokType
GEN_DEFINE_ATTRIBUTE_TOKENS
# undef Entry