Tok_Capture_* -> Tok_Paren_*

Was not a correct name for it
This commit is contained in:
Edward R. Gonzalez 2024-12-15 23:28:44 -05:00
parent 0b78b74fbc
commit e4f564b165
10 changed files with 137 additions and 112 deletions

View File

@ -28,27 +28,6 @@
"/FC" "/FC"
] ]
}, },
{
"name": "Win32 msvc c_library",
"includePath": [
"${workspaceFolder}/gen_c_library/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"GEN_TIME",
"GEN_IMPLEMENTATION",
// "GEN_DONT_USE_NAMESPACE"
"GEN_INTELLISENSE_DIRECTIVES",
"INTELLISENSE_DIRECTIVES"
],
"cppStandard": "c++17",
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
"intelliSenseMode": "msvc-x64",
"compileCommands": "${workspaceFolder}/.vscode/tasks.json"
},
{ {
"name": "Win32 clang", "name": "Win32 clang",
"includePath": [ "includePath": [
@ -64,10 +43,56 @@
"GEN_INTELLISENSE_DIRECTIVES", "GEN_INTELLISENSE_DIRECTIVES",
"INTELLISENSE_DIRECTIVES" "INTELLISENSE_DIRECTIVES"
], ],
"cStandard": "c11",
"cppStandard": "c++17",
"windowsSdkVersion": "10.0.19041.0", "windowsSdkVersion": "10.0.19041.0",
"compilerPath": "clang++.exe", "compilerPath": "clang++.exe",
"intelliSenseMode": "windows-clang-x64", "intelliSenseMode": "windows-clang-x64",
"compileCommands": "${workspaceFolder}/.vscode/tasks.json" "compileCommands": "${workspaceFolder}/.vscode/tasks.json"
},
{
"name": "Win32 msvc c_library",
"includePath": [
"${workspaceFolder}/gen_c_library/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"GEN_TIME",
"GEN_IMPLEMENTATION",
// "GEN_DONT_USE_NAMESPACE"
"GEN_INTELLISENSE_DIRECTIVES",
"INTELLISENSE_DIRECTIVES"
],
"cStandard": "c11",
"cppStandard": "c++17",
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
"intelliSenseMode": "msvc-x64",
"compileCommands": "${workspaceFolder}/.vscode/tasks.json"
},
{
"name": "Win32 msvc c_library test",
"includePath": [
"${workspaceFolder}/test/c_library/**",
"${workspaceFolder}/gen_c_library/gen/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE",
"GEN_TIME",
"GEN_IMPLEMENTATION",
// "GEN_DONT_USE_NAMESPACE"
"GEN_INTELLISENSE_DIRECTIVES",
"INTELLISENSE_DIRECTIVES"
],
"cStandard": "c11",
"windowsSdkVersion": "10.0.19041.0",
"compilerPath": "C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.29.30133/bin/HostX64/x64/cl.exe",
"intelliSenseMode": "msvc-x64",
"compileCommands": "${workspaceFolder}/.vscode/tasks.json"
} }
], ],
"version": 4 "version": 4

View File

@ -24,8 +24,8 @@ enum TokType : u32
Tok_BraceCurly_Close, Tok_BraceCurly_Close,
Tok_BraceSquare_Open, Tok_BraceSquare_Open,
Tok_BraceSquare_Close, Tok_BraceSquare_Close,
Tok_Capture_Start, Tok_Paren_Open,
Tok_Capture_End, Tok_Paren_Close,
Tok_Comment, Tok_Comment,
Tok_Comment_End, Tok_Comment_End,
Tok_Comment_Start, Tok_Comment_Start,

View File

@ -15,7 +15,7 @@
| \_____|\___}_l |_|\___} ,__/| ,__/ (_____/ \__\__/_|\__, |\___}\__,_l | | \_____|\___}_l |_|\___} ,__/| ,__/ (_____/ \__\__/_|\__, |\___}\__,_l |
| | | | | __} | | | | | | | __} | |
| l_l l_l {___/ | | l_l l_l {___/ |
! ----------------------------------------------------------------------- VERSION: v0.20-Alpha | ! ----------------------------------------------------------------------- VERSION: v0.23-Alpha |
! ============================================================================================ | ! ============================================================================================ |
! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION | ! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION |
! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL | ! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL |

View File

@ -151,7 +151,7 @@ s32 lex_preprocessor_define( LexContext* ctx )
macro.Flags |= MF_Functional; macro.Flags |= MF_Functional;
} }
Token opening_paren = { { ctx->scanner, 1 }, Tok_Capture_Start, ctx->line, ctx->column, TF_Preprocess }; Token opening_paren = { { ctx->scanner, 1 }, Tok_Paren_Open, ctx->line, ctx->column, TF_Preprocess };
array_append( _ctx->Lexer_Tokens, opening_paren ); array_append( _ctx->Lexer_Tokens, opening_paren );
move_forward(); move_forward();
@ -242,7 +242,7 @@ s32 lex_preprocessor_define( LexContext* ctx )
); );
return Lex_ReturnNull; return Lex_ReturnNull;
} }
Token closing_paren = { { ctx->scanner, 1 }, Tok_Capture_End, ctx->line, ctx->column, TF_Preprocess }; Token closing_paren = { { ctx->scanner, 1 }, Tok_Paren_Close, ctx->line, ctx->column, TF_Preprocess };
array_append(_ctx->Lexer_Tokens, closing_paren); array_append(_ctx->Lexer_Tokens, closing_paren);
move_forward(); move_forward();
} }
@ -797,7 +797,7 @@ TokArray lex( Str content )
{ {
Str text = { c.scanner, 1 }; Str text = { c.scanner, 1 };
c.token.Text = text; c.token.Text = text;
c.token.Type = Tok_Capture_Start; c.token.Type = Tok_Paren_Open;
if (c.left) if (c.left)
move_forward(); move_forward();
@ -807,7 +807,7 @@ TokArray lex( Str content )
{ {
Str text = { c.scanner, 1 }; Str text = { c.scanner, 1 };
c.token.Text = text; c.token.Text = text;
c.token.Type = Tok_Capture_End; c.token.Type = Tok_Paren_Close;
if (c.left) if (c.left)
move_forward(); move_forward();

View File

@ -601,18 +601,18 @@ CodeAttributes parse_attributes()
else if ( check( Tok_Decl_GNU_Attribute ) ) else if ( check( Tok_Decl_GNU_Attribute ) )
{ {
eat( Tok_Decl_GNU_Attribute ); eat( Tok_Decl_GNU_Attribute );
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
// __attribute__(( // __attribute__((
while ( left && currtok.Type != Tok_Capture_End ) while ( left && currtok.Type != Tok_Paren_Close )
{ {
eat( currtok.Type ); eat( currtok.Type );
} }
// __attribute__(( <Content> // __attribute__(( <Content>
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// __attribute__(( <Content> )) // __attribute__(( <Content> ))
len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )start.Text.Ptr; len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )start.Text.Ptr;
@ -620,16 +620,16 @@ CodeAttributes parse_attributes()
else if ( check( Tok_Decl_MSVC_Attribute ) ) else if ( check( Tok_Decl_MSVC_Attribute ) )
{ {
eat( Tok_Decl_MSVC_Attribute ); eat( Tok_Decl_MSVC_Attribute );
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
// __declspec( // __declspec(
while ( left && currtok.Type != Tok_Capture_End ) while ( left && currtok.Type != Tok_Paren_Close )
{ {
eat( currtok.Type ); eat( currtok.Type );
} }
// __declspec( <Content> // __declspec( <Content>
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// __declspec( <Content> ) // __declspec( <Content> )
len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )start.Text.Ptr; len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )start.Text.Ptr;
@ -640,20 +640,20 @@ CodeAttributes parse_attributes()
// <Attribute> // <Attribute>
// If its a macro based attribute, this could be a functional macro such as Unreal's UE_DEPRECATED(...) // If its a macro based attribute, this could be a functional macro such as Unreal's UE_DEPRECATED(...)
if ( check( Tok_Capture_Start)) if ( check( Tok_Paren_Open))
{ {
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
s32 level = 0; s32 level = 0;
while (left && currtok.Type != Tok_Capture_End && level == 0) while (left && currtok.Type != Tok_Paren_Close && level == 0)
{ {
if (currtok.Type == Tok_Capture_Start) if (currtok.Type == Tok_Paren_Open)
++ level; ++ level;
if (currtok.Type == Tok_Capture_End) if (currtok.Type == Tok_Paren_Close)
--level; --level;
eat(currtok.Type); eat(currtok.Type);
} }
eat(Tok_Capture_End); eat(Tok_Paren_Close);
} }
len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )start.Text.Ptr; len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )start.Text.Ptr;
@ -1078,7 +1078,7 @@ CodeBody parse_class_struct_body( TokType which, Token name )
case Tok_Type_int: case Tok_Type_int:
case Tok_Type_double: case Tok_Type_double:
{ {
if ( nexttok.Type == Tok_Capture_Start && name.Text.Len && currtok.Type == Tok_Identifier ) if ( nexttok.Type == Tok_Paren_Open && name.Text.Len && currtok.Type == Tok_Identifier )
{ {
if ( c_str_compare_len( name.Text.Ptr, currtok.Text.Ptr, name.Text.Len ) == 0 ) if ( c_str_compare_len( name.Text.Ptr, currtok.Text.Ptr, name.Text.Len ) == 0 )
{ {
@ -1183,7 +1183,7 @@ Code parse_complicated_definition( TokType which )
spec = tokens.Arr[spec_idx]; spec = tokens.Arr[spec_idx];
} }
if ( tokens.Arr[spec_idx].Type == Tok_Capture_End ) if ( tokens.Arr[spec_idx].Type == Tok_Paren_Close )
{ {
// Forward declaration with trailing specifiers for a procedure // Forward declaration with trailing specifiers for a procedure
tok = tokens.Arr[spec_idx]; tok = tokens.Arr[spec_idx];
@ -1318,9 +1318,9 @@ Code parse_assignment_expression()
level++; level++;
if (currtok.Type == Tok_BraceCurly_Close ) if (currtok.Type == Tok_BraceCurly_Close )
level--; level--;
if (currtok.Type == Tok_Capture_Start) if (currtok.Type == Tok_Paren_Open)
level++; level++;
else if (currtok.Type == Tok_Capture_End) else if (currtok.Type == Tok_Paren_Close)
level--; level--;
eat( currtok.Type ); eat( currtok.Type );
@ -1873,7 +1873,7 @@ Code parse_global_nspace_constructor_destructor( CodeSpecifiers specifiers )
if (nav.Type == Tok_Operator && nav.Text.Ptr[1] == '>') if (nav.Type == Tok_Operator && nav.Text.Ptr[1] == '>')
-- template_level; -- template_level;
if ( nav.Type == Tok_Capture_Start) if ( nav.Type == Tok_Paren_Open)
{ {
if (template_level != 0 ) if (template_level != 0 )
++ capture_level; ++ capture_level;
@ -1881,12 +1881,12 @@ Code parse_global_nspace_constructor_destructor( CodeSpecifiers specifiers )
break; break;
} }
if ( template_level != 0 && nav.Type == Tok_Capture_End) if ( template_level != 0 && nav.Type == Tok_Paren_Close)
-- capture_level; -- capture_level;
} }
} }
if ( nav.Type == Tok_Capture_Start ) if ( nav.Type == Tok_Paren_Open )
break; break;
} }
@ -1932,10 +1932,10 @@ Code parse_global_nspace_constructor_destructor( CodeSpecifiers specifiers )
if (tok_left.Type == Tok_Operator && tok_left.Text.Ptr[1] == '>') if (tok_left.Type == Tok_Operator && tok_left.Text.Ptr[1] == '>')
-- template_level; -- template_level;
if ( template_level != 0 && tok_left.Type == Tok_Capture_Start) if ( template_level != 0 && tok_left.Type == Tok_Paren_Open)
++ capture_level; ++ capture_level;
if ( template_level != 0 && tok_left.Type == Tok_Capture_End) if ( template_level != 0 && tok_left.Type == Tok_Paren_Close)
-- capture_level; -- capture_level;
if ( capture_level == 0 && template_level == 0 && tok_left.Type == Tok_Identifier ) if ( capture_level == 0 && template_level == 0 && tok_left.Type == Tok_Identifier )
@ -2483,7 +2483,7 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
Token name = parse_identifier(nullptr); Token name = parse_identifier(nullptr);
_ctx->parser.Scope->Name = name.Text; _ctx->parser.Scope->Name = name.Text;
bool detected_capture = check( Tok_Capture_Start ); bool detected_capture = check( Tok_Paren_Open );
// Check three tokens ahead to make sure that were not dealing with a constructor initialization... // Check three tokens ahead to make sure that were not dealing with a constructor initialization...
// ( 350.0f , <--- Could be the scenario // ( 350.0f , <--- Could be the scenario
@ -2508,11 +2508,11 @@ Code parse_operator_function_or_variable( bool expects_function, CodeAttributes
{ {
Token tok = _ctx->parser.Tokens.Arr[ idx ]; Token tok = _ctx->parser.Tokens.Arr[ idx ];
if ( tok.Type == Tok_Capture_Start ) if ( tok.Type == Tok_Paren_Open )
level++; level++;
else if ( tok.Type == Tok_Capture_End && level > 0 ) else if ( tok.Type == Tok_Paren_Close && level > 0 )
level--; level--;
if (level == 0 && tok.Type == Tok_Capture_End) if (level == 0 && tok.Type == Tok_Paren_Close)
break; break;
} }
++ idx; // Will incremnt to possible comma position ++ idx; // Will incremnt to possible comma position
@ -2609,7 +2609,7 @@ CodeParams parse_params( bool use_template_capture )
push_scope(); push_scope();
if ( ! use_template_capture ) { if ( ! use_template_capture ) {
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
// ( // (
} }
else { else {
@ -2618,9 +2618,9 @@ CodeParams parse_params( bool use_template_capture )
// < // <
} }
if ( ! use_template_capture && check( Tok_Capture_End ) ) if ( ! use_template_capture && check( Tok_Paren_Close ) )
{ {
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// ) // )
parser_pop(& _ctx->parser); parser_pop(& _ctx->parser);
return NullCode; return NullCode;
@ -2651,7 +2651,7 @@ CodeParams parse_params( bool use_template_capture )
} }
#define CheckEndParams() \ #define CheckEndParams() \
(use_template_capture ? (currtok.Text.Ptr[ 0 ] != '>') : (currtok.Type != Tok_Capture_End)) (use_template_capture ? (currtok.Text.Ptr[ 0 ] != '>') : (currtok.Type != Tok_Paren_Close))
// TODO(Ed): Use expression macros or this? macro as attribute? // TODO(Ed): Use expression macros or this? macro as attribute?
// Ex: Unreal has this type of macro: vvvvvvvvv // Ex: Unreal has this type of macro: vvvvvvvvv
@ -2719,10 +2719,10 @@ CodeParams parse_params( bool use_template_capture )
if (currtok.Type == Tok_Operator && currtok.Text.Ptr[1] == '>') if (currtok.Type == Tok_Operator && currtok.Text.Ptr[1] == '>')
-- template_level; -- template_level;
if ( currtok.Type == Tok_Capture_Start) if ( currtok.Type == Tok_Paren_Open)
++ capture_level; ++ capture_level;
if ( currtok.Type == Tok_Capture_End) if ( currtok.Type == Tok_Paren_Close)
-- capture_level; -- capture_level;
value_tok.Text.Len = ( ( sptr )currtok.Text.Ptr + currtok.Text.Len ) - ( sptr )value_tok.Text.Ptr; value_tok.Text.Len = ( ( sptr )currtok.Text.Ptr + currtok.Text.Len ) - ( sptr )value_tok.Text.Ptr;
@ -2833,10 +2833,10 @@ CodeParams parse_params( bool use_template_capture )
if (currtok.Type == Tok_Operator && currtok.Text.Ptr[1] == '>') if (currtok.Type == Tok_Operator && currtok.Text.Ptr[1] == '>')
-- template_level; -- template_level;
if ( currtok.Type == Tok_Capture_Start) if ( currtok.Type == Tok_Paren_Open)
++ capture_level; ++ capture_level;
if ( currtok.Type == Tok_Capture_End) if ( currtok.Type == Tok_Paren_Close)
-- capture_level; -- capture_level;
value_tok.Text.Len = ( ( sptr )currtok.Text.Ptr + currtok.Text.Len ) - ( sptr )value_tok.Text.Ptr; value_tok.Text.Len = ( ( sptr )currtok.Text.Ptr + currtok.Text.Len ) - ( sptr )value_tok.Text.Ptr;
@ -2868,7 +2868,7 @@ CodeParams parse_params( bool use_template_capture )
if ( ! use_template_capture ) if ( ! use_template_capture )
{ {
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// ( <Macro> <ValueType> <Name> <PostNameMacro> = <Expression>, <Macro> <ValueType> <Name> <PostNameMacro> = <Expression>, .. ) // ( <Macro> <ValueType> <Name> <PostNameMacro> = <Expression>, <Macro> <ValueType> <Name> <PostNameMacro> = <Expression>, .. )
} }
else else
@ -2941,20 +2941,20 @@ Code parse_simple_preprocess( TokType which )
// TODO(Ed) : Parse this properly later (expression and statement support) // TODO(Ed) : Parse this properly later (expression and statement support)
if ( macro && macro_is_functional(* macro) ) if ( macro && macro_is_functional(* macro) )
{ {
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
s32 level = 0; s32 level = 0;
while ( left && ( currtok.Type != Tok_Capture_End || level > 0 ) ) while ( left && ( currtok.Type != Tok_Paren_Close || level > 0 ) )
{ {
if ( currtok.Type == Tok_Capture_Start ) if ( currtok.Type == Tok_Paren_Open )
level++; level++;
else if ( currtok.Type == Tok_Capture_End && level > 0 ) else if ( currtok.Type == Tok_Paren_Close && level > 0 )
level--; level--;
eat( currtok.Type ); eat( currtok.Type );
} }
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// <Macro> ( <params> ) // <Macro> ( <params> )
full_macro.Text.Len = ( (sptr)prevtok.Text.Ptr + prevtok.Text.Len ) - (sptr)full_macro.Text.Ptr; full_macro.Text.Len = ( (sptr)prevtok.Text.Ptr + prevtok.Text.Len ) - (sptr)full_macro.Text.Ptr;
@ -3067,21 +3067,21 @@ Code parse_static_assert()
_ctx->parser.Scope->Name = content.Text; _ctx->parser.Scope->Name = content.Text;
eat( Tok_StaticAssert ); eat( Tok_StaticAssert );
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
// static_assert( // static_assert(
// TODO(Ed) : Parse this properly. // TODO(Ed) : Parse this properly.
s32 level = 0; s32 level = 0;
while ( left && ( currtok.Type != Tok_Capture_End || level > 0 ) ) while ( left && ( currtok.Type != Tok_Paren_Close || level > 0 ) )
{ {
if ( currtok.Type == Tok_Capture_Start ) if ( currtok.Type == Tok_Paren_Open )
level++; level++;
else if ( currtok.Type == Tok_Capture_End ) else if ( currtok.Type == Tok_Paren_Close )
level--; level--;
eat( currtok.Type ); eat( currtok.Type );
} }
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
eat( Tok_Statement_End ); eat( Tok_Statement_End );
// static_assert( <Content> ); // static_assert( <Content> );
@ -3183,9 +3183,9 @@ CodeVar parse_variable_after_name(
// <Attributes> <Specifiers> <ValueType> <Name> = { <Expression> } // <Attributes> <Specifiers> <ValueType> <Name> = { <Expression> }
} }
if ( currtok.Type == Tok_Capture_Start ) if ( currtok.Type == Tok_Paren_Open )
{ {
eat( Tok_Capture_Start); eat( Tok_Paren_Open);
// <Attributes> <Specifiers> <ValueType> <Name> ( // <Attributes> <Specifiers> <ValueType> <Name> (
Token expr_token = currtok; Token expr_token = currtok;
@ -3193,12 +3193,12 @@ CodeVar parse_variable_after_name(
using_constructor_initializer = true; using_constructor_initializer = true;
s32 level = 0; s32 level = 0;
while ( left && ( currtok.Type != Tok_Capture_End || level > 0 ) ) while ( left && ( currtok.Type != Tok_Paren_Close || level > 0 ) )
{ {
if ( currtok.Type == Tok_Capture_Start ) if ( currtok.Type == Tok_Paren_Open )
level++; level++;
else if ( currtok.Type == Tok_Capture_End && level > 0 ) else if ( currtok.Type == Tok_Paren_Close && level > 0 )
level--; level--;
eat( currtok.Type ); eat( currtok.Type );
@ -3206,7 +3206,7 @@ CodeVar parse_variable_after_name(
expr_token.Text.Len = ( (sptr)prevtok.Text.Ptr + prevtok.Text.Len ) - (sptr)expr_token.Text.Ptr; expr_token.Text.Len = ( (sptr)prevtok.Text.Ptr + prevtok.Text.Len ) - (sptr)expr_token.Text.Ptr;
expr = untyped_str( tok_to_str(expr_token) ); expr = untyped_str( tok_to_str(expr_token) );
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// <Attributes> <Specifiers> <ValueType> <Name> ( <Expression> ) // <Attributes> <Specifiers> <ValueType> <Name> ( <Expression> )
} }
@ -3406,9 +3406,9 @@ CodeConstructor parser_parse_constructor( CodeSpecifiers specifiers )
s32 level = 0; s32 level = 0;
while ( left && ( currtok.Type != Tok_BraceCurly_Open || level > 0 ) ) while ( left && ( currtok.Type != Tok_BraceCurly_Open || level > 0 ) )
{ {
if (currtok.Type == Tok_Capture_Start) if (currtok.Type == Tok_Paren_Open)
level++; level++;
else if ( currtok.Type == Tok_Capture_End ) else if ( currtok.Type == Tok_Paren_Close )
level--; level--;
eat( currtok.Type ); eat( currtok.Type );
@ -3498,7 +3498,7 @@ CodeDefine parser_parse_define()
Macro* macro = lookup_macro(define->Name); Macro* macro = lookup_macro(define->Name);
if (macro_is_functional(* macro)) { if (macro_is_functional(* macro)) {
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
// #define <Name> ( // #define <Name> (
// We provide the define params even if empty to make sure '()' are serialized. // We provide the define params even if empty to make sure '()' are serialized.
@ -3506,7 +3506,7 @@ CodeDefine parser_parse_define()
params = (CodeDefineParams) make_code(); params = (CodeDefineParams) make_code();
params->Type = CT_Parameters_Define; params->Type = CT_Parameters_Define;
if ( left && currtok.Type != Tok_Capture_End ) { if ( left && currtok.Type != Tok_Paren_Close ) {
params->Name = currtok.Text; params->Name = currtok.Text;
params->NumEntries ++; params->NumEntries ++;
@ -3514,7 +3514,7 @@ CodeDefine parser_parse_define()
// #define <Name> ( <param> // #define <Name> ( <param>
} }
while( left && currtok.Type != Tok_Capture_End ) { while( left && currtok.Type != Tok_Paren_Close ) {
eat( Tok_Comma ); eat( Tok_Comma );
// #define <Name> ( <param>, // #define <Name> ( <param>,
@ -3527,7 +3527,7 @@ CodeDefine parser_parse_define()
eat( Tok_Preprocess_Define_Param ); eat( Tok_Preprocess_Define_Param );
} }
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// #define <Name> ( <params> ) // #define <Name> ( <params> )
define->Params = params; define->Params = params;
@ -3595,8 +3595,8 @@ CodeDestructor parser_parse_destructor( CodeSpecifiers specifiers )
CodeComment inline_cmt = NullCode; CodeComment inline_cmt = NullCode;
// <Virtual Specifier> ~<Name> // <Virtual Specifier> ~<Name>
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// <Virtual Specifier> ~<Name>() // <Virtual Specifier> ~<Name>()
bool pure_virtual = false; bool pure_virtual = false;
@ -4286,8 +4286,8 @@ CodeOpCast parser_parse_operator_cast( CodeSpecifiers specifiers )
Token scope_name_tok = { scope_name, Tok_Identifier, 0, 0, TF_Null }; Token scope_name_tok = { scope_name, Tok_Identifier, 0, 0, TF_Null };
_ctx->parser.Scope->Name = scope_name_tok.Text; _ctx->parser.Scope->Name = scope_name_tok.Text;
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// <Specifiers> <Qualifier> :: ... operator <UnderlyingType>() // <Specifiers> <Qualifier> :: ... operator <UnderlyingType>()
// TODO(Ed) : operator cast can have const, volatile, l-value, r-value noexecept qualifying specifiers. // TODO(Ed) : operator cast can have const, volatile, l-value, r-value noexecept qualifying specifiers.
@ -4638,18 +4638,18 @@ else if ( currtok.Type == Tok_DeclType )
eat( Tok_DeclType ); eat( Tok_DeclType );
// <Attributes> <Specifiers> decltype // <Attributes> <Specifiers> decltype
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
while ( left && currtok.Type != Tok_Capture_End ) while ( left && currtok.Type != Tok_Paren_Close )
{ {
if ( currtok.Type == Tok_Capture_Start ) if ( currtok.Type == Tok_Paren_Open )
level++; level++;
if ( currtok.Type == Tok_Capture_End ) if ( currtok.Type == Tok_Paren_Close )
level--; level--;
eat( currtok.Type ); eat( currtok.Type );
} }
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
name.Length = ( (sptr)currtok.Text + currtok.Length ) - (sptr)name.Text; name.Length = ( (sptr)currtok.Text + currtok.Length ) - (sptr)name.Text;
_ctx->parser.Scope->Name = name; _ctx->parser.Scope->Name = name;
@ -4758,7 +4758,7 @@ else if ( currtok.Type == Tok_DeclType )
is_function_typename = true; is_function_typename = true;
++scanner; ++scanner;
} }
is_function_typename = scanner->Type == Tok_Capture_Start; is_function_typename = scanner->Type == Tok_Paren_Open;
Token* first_capture = scanner; Token* first_capture = scanner;
if ( is_function_typename ) if ( is_function_typename )
@ -4768,7 +4768,7 @@ else if ( currtok.Type == Tok_DeclType )
++scanner; ++scanner;
// Go back to the first capture start found // Go back to the first capture start found
while ( scanner->Type != Tok_Capture_Start ) while ( scanner->Type != Tok_Paren_Open )
--scanner; --scanner;
last_capture = scanner; last_capture = scanner;
@ -4822,7 +4822,7 @@ else if ( currtok.Type == Tok_DeclType )
name = NullToken; name = NullToken;
// The next token can either be a capture for the identifier or it could be the identifier exposed. // The next token can either be a capture for the identifier or it could be the identifier exposed.
if ( ! check( Tok_Capture_Start ) ) if ( ! check( Tok_Paren_Open ) )
{ {
// Started with an identifier immeidately, which means its of the format: <ReturnType> <identifier> <capture>; // Started with an identifier immeidately, which means its of the format: <ReturnType> <identifier> <capture>;
name = parse_identifier(nullptr); name = parse_identifier(nullptr);
@ -4842,7 +4842,7 @@ else if ( currtok.Type == Tok_DeclType )
// Parse immeidate capture which would be with parse_params() // Parse immeidate capture which would be with parse_params()
// Eat Capture End // Eat Capture End
#ifdef GEN_USE_NEW_TYPENAME_PARSING #ifdef GEN_USE_NEW_TYPENAME_PARSING
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
// <Attributes> <ReturnType> ( // <Attributes> <ReturnType> (
// Binding specifiers // Binding specifiers
@ -4875,11 +4875,11 @@ else if ( currtok.Type == Tok_DeclType )
// Immeidate parameters // Immeidate parameters
if ( check( Tok_Capture_Start ) ) if ( check( Tok_Paren_Open ) )
params_nested = parse_params(); params_nested = parse_params();
// <Attributes> <ReturnType> ( <Specifiers> <Identifier> ( <Parameters> ) // <Attributes> <ReturnType> ( <Specifiers> <Identifier> ( <Parameters> )
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// <Attributes> <ReturnType> ( <Specifiers> <Identifier> ( <Parameters> ) ) // <Attributes> <ReturnType> ( <Specifiers> <Identifier> ( <Parameters> ) )
#else #else
@ -4887,21 +4887,21 @@ else if ( currtok.Type == Tok_DeclType )
// Everything within this capture will just be shoved into the name field including the capture tokens themselves. // Everything within this capture will just be shoved into the name field including the capture tokens themselves.
name = currtok; name = currtok;
eat( Tok_Capture_Start ); eat( Tok_Paren_Open );
// <Attributes> <ReturnType> ( // <Attributes> <ReturnType> (
s32 level = 0; s32 level = 0;
while ( left && ( currtok.Type != Tok_Capture_End || level > 0 ) ) while ( left && ( currtok.Type != Tok_Paren_Close || level > 0 ) )
{ {
if ( currtok.Type == Tok_Capture_Start ) if ( currtok.Type == Tok_Paren_Open )
level++; level++;
if ( currtok.Type == Tok_Capture_End ) if ( currtok.Type == Tok_Paren_Close )
level--; level--;
eat( currtok.Type ); eat( currtok.Type );
} }
eat( Tok_Capture_End ); eat( Tok_Paren_Close );
// <Attributes> <ReturnType> ( <Expression> ) // <Attributes> <ReturnType> ( <Expression> )
name.Text.Len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )name.Text.Ptr; name.Text.Len = ( ( sptr )prevtok.Text.Ptr + prevtok.Text.Len ) - ( sptr )name.Text.Ptr;

View File

@ -13,8 +13,8 @@ BraceCurly_Open, "{"
BraceCurly_Close, "}" BraceCurly_Close, "}"
BraceSquare_Open, "[" BraceSquare_Open, "["
BraceSquare_Close, "]" BraceSquare_Close, "]"
Capture_Start, "(" Paren_Open, "("
Capture_End, ")" Paren_Close, ")"
Comment, "__comment__" Comment, "__comment__"
Comment_End, "__comment_end__" Comment_End, "__comment_end__"
Comment_Start, "__comment_start__" Comment_Start, "__comment_start__"

1 Invalid __invalid__
13 BraceCurly_Close }
14 BraceSquare_Open [
15 BraceSquare_Close ]
16 Capture_Start Paren_Open (
17 Capture_End Paren_Close )
18 Comment __comment__
19 Comment_End __comment_end__
20 Comment_Start __comment_start__

View File

@ -13,7 +13,7 @@
| \_____|\___}_l |_|\___} .__/| .__/ {_____/ \__\__/_l\__. |\___/\__,_l \____}{_____}{_____} | | \_____|\___}_l |_|\___} .__/| .__/ {_____/ \__\__/_l\__. |\___/\__,_l \____}{_____}{_____} |
| | | | | __} | | | | | | | __} | |
| l_l l_l {___/ | | l_l l_l {___/ |
! ----------------------------------------------------------------------- VERSION: v0.20-Alpha | ! ----------------------------------------------------------------------- VERSION: v0.23-Alpha |
! ============================================================================================= | ! ============================================================================================= |
! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION | ! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION |
! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL | ! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL |

View File

@ -15,7 +15,7 @@
| \_____|\___}_l |_|\___} ,__/| ,__/ (_____/ \__\__/_|\__, |\___}\__,_l | | \_____|\___}_l |_|\___} ,__/| ,__/ (_____/ \__\__/_|\__, |\___}\__,_l |
| Singleheader | | | | __} | | | Singleheader | | | | __} | |
| l_l l_l {___/ | | l_l l_l {___/ |
! ----------------------------------------------------------------------- VERSION: v0.20-Alpha | ! ----------------------------------------------------------------------- VERSION: v0.23-Alpha |
! ============================================================================================ | ! ============================================================================================ |
! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION | ! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION |
! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL | ! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL |

View File

@ -16,7 +16,7 @@
| \_____|\___}_l |_|\___} ,__/| ,__/ (_____/ \__\__/_|\__, |\___}\__,_l | | \_____|\___}_l |_|\___} ,__/| ,__/ (_____/ \__\__/_|\__, |\___}\__,_l |
| Unreal Engine | | | | __} | | | Unreal Engine | | | | __} | |
| l_l l_l {___/ | | l_l l_l {___/ |
! ----------------------------------------------------------------------- VERSION: v0.20-Alpha | ! ----------------------------------------------------------------------- VERSION: v0.23-Alpha |
! ============================================================================================ | ! ============================================================================================ |
! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION | ! WARNING: THIS IS AN ALPHA VERSION OF THE LIBRARY, USE AT YOUR OWN DISCRETION |
! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL | ! NEVER DO CODE GENERATION WITHOUT AT LEAST HAVING CONTENT IN A CODEBASE UNDER VERSION CONTROL |

View File

@ -396,7 +396,7 @@ if ($test -and $true)
Push-Location $path_test_cpp Push-Location $path_test_cpp
if ( Test-Path( $executable ) ) { if ( Test-Path( $executable ) ) {
write-host "`nRunning c_library test" write-host "`nRunning cpp_library test"
$time_taken = Measure-Command { & $executable $time_taken = Measure-Command { & $executable
| ForEach-Object { | ForEach-Object {
write-host `t $_ -ForegroundColor Green write-host `t $_ -ForegroundColor Green