mirror of
https://github.com/Ed94/gencpp.git
synced 2024-11-10 02:54:53 -08:00
WIP: getting function parameter parse to work
Will continue prob next week or two
This commit is contained in:
parent
6da615e6da
commit
9df177edf4
@ -3140,7 +3140,7 @@ namespace gen
|
|||||||
Entry( Type_Long, "long" ) \
|
Entry( Type_Long, "long" ) \
|
||||||
Entry( Type_char, "char" ) \
|
Entry( Type_char, "char" ) \
|
||||||
Entry( Type_int, "int" ) \
|
Entry( Type_int, "int" ) \
|
||||||
Entry( Type_double, "double" ) \
|
Entry( Type_double, "double" )
|
||||||
|
|
||||||
enum class TokType : u32
|
enum class TokType : u32
|
||||||
{
|
{
|
||||||
@ -3175,18 +3175,21 @@ namespace gen
|
|||||||
TokType get_tok_type( char const* word, s32 length )
|
TokType get_tok_type( char const* word, s32 length )
|
||||||
{
|
{
|
||||||
local_persist
|
local_persist
|
||||||
char const* lookup[(u32)TokType::Num] =
|
StrC lookup[(u32)TokType::Num] =
|
||||||
{
|
{
|
||||||
# define Entry( Name_, Str_ ) Str_,
|
# define Entry( Name_, Str_ ) { sizeof(Str_), Str_ },
|
||||||
Define_TokType
|
Define_TokType
|
||||||
# undef Entry
|
# undef Entry
|
||||||
|
|
||||||
Attribute::Keyword,
|
{ sizeof(Attribute::Keyword), Attribute::Keyword },
|
||||||
};
|
};
|
||||||
|
|
||||||
for ( u32 index = 0; index < (u32)TokType::Num; index++ )
|
for ( u32 index = 0; index < (u32)TokType::Num; index++ )
|
||||||
{
|
{
|
||||||
if ( str_compare( word, lookup[index], length ) == 0 )
|
s32 lookup_len = lookup[index].Len - 1;
|
||||||
|
char const* lookup_str = lookup[index].Ptr;
|
||||||
|
|
||||||
|
if ( str_compare( word, lookup_str, lookup_len ) == 0 )
|
||||||
return scast(TokType, index);
|
return scast(TokType, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3940,7 +3943,9 @@ namespace gen
|
|||||||
param->add_entry( value );
|
param->add_entry( value );
|
||||||
|
|
||||||
result->add_entry( param );
|
result->add_entry( param );
|
||||||
eat( TokType::Comma );
|
|
||||||
|
if ( check( TokType::Comma ) )
|
||||||
|
eat( TokType::Comma );
|
||||||
}
|
}
|
||||||
eat( TokType::Capture_End );
|
eat( TokType::Capture_End );
|
||||||
|
|
||||||
@ -4735,7 +4740,7 @@ namespace gen
|
|||||||
if ( toks.Arr == nullptr )
|
if ( toks.Arr == nullptr )
|
||||||
return Code::Invalid;
|
return Code::Invalid;
|
||||||
|
|
||||||
return parse_extern_link( toks, txt(parse_export_body) );
|
return parse_export_body( toks, txt(parse_export_body) );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal
|
internal
|
||||||
|
@ -172,14 +172,13 @@ u32 gen_sanity()
|
|||||||
gen_sanity_file.print_fmt("\n");
|
gen_sanity_file.print_fmt("\n");
|
||||||
|
|
||||||
// Parameters
|
// Parameters
|
||||||
if (0)
|
|
||||||
{
|
{
|
||||||
Code fwd = parse_function( code(
|
Code fwd = parse_function( code(
|
||||||
void test_function( int a );
|
void test_function_param( int a );
|
||||||
));
|
));
|
||||||
|
|
||||||
Code def = parse_function( code(
|
Code def = parse_function( code(
|
||||||
void test_function( int a, int b )
|
void test_function_param2( int a, int b )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user