mirror of
https://github.com/Ed94/gencpp.git
synced 2025-06-15 03:01:47 -07:00
Bug fixes and updates to package_release.ps1
- Incrased size of the defines_map_arena to 256KB - Various fixes for the parser - Various fixes for code serialization - Fix for is_equal member func in Code types - Fixes for hasthable container - Added are_equal static func to String type for use against StrC - Added starts_with functions to String type - package_release.ps1 now packages all docs (forgot to update it with last release)
This commit is contained in:
@ -139,7 +139,7 @@ void CodeConstructor::to_string_fwd( String& result )
|
||||
if ( ast->InlineCmt )
|
||||
result.append_fmt( "; // %S\n", ast->InlineCmt->Content );
|
||||
else
|
||||
result.append( ";" );
|
||||
result.append( ";\n" );
|
||||
}
|
||||
|
||||
String CodeClass::to_string()
|
||||
@ -183,7 +183,7 @@ void CodeClass::to_string_def( String& result )
|
||||
while ( interface )
|
||||
{
|
||||
result.append_fmt( ", %S", interface.to_string() );
|
||||
interface = interface->Next ? interface->Next->cast< CodeType >() : Code { nullptr };
|
||||
interface = interface->Next ? interface->Next->cast< CodeType >() : CodeType { nullptr };
|
||||
}
|
||||
}
|
||||
else if ( ast->Name )
|
||||
@ -480,6 +480,7 @@ void CodeFn::to_string_def( String& result )
|
||||
if ( ast->Attributes )
|
||||
result.append_fmt( " %S ", ast->Attributes.to_string() );
|
||||
|
||||
b32 prefix_specs = false;
|
||||
if ( ast->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : ast->Specs )
|
||||
@ -488,11 +489,13 @@ void CodeFn::to_string_def( String& result )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
result.append_fmt( " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
|
||||
prefix_specs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ast->Attributes || ast->Specs )
|
||||
if ( ast->Attributes || prefix_specs )
|
||||
result.append( "\n" );
|
||||
|
||||
if ( ast->ReturnType )
|
||||
@ -530,19 +533,22 @@ void CodeFn::to_string_fwd( String& result )
|
||||
if ( ast->Attributes )
|
||||
result.append_fmt( "%S ", ast->Attributes.to_string() );
|
||||
|
||||
b32 prefix_specs = false;
|
||||
if ( ast->Specs )
|
||||
{
|
||||
for ( SpecifierT spec : ast->Specs )
|
||||
{
|
||||
if ( ESpecifier::is_trailing( spec ) && ! (spec != ESpecifier::Pure) )
|
||||
if ( ! ESpecifier::is_trailing( spec ) || ! (spec != ESpecifier::Pure) )
|
||||
{
|
||||
StrC spec_str = ESpecifier::to_str( spec );
|
||||
result.append_fmt( " %.*s", spec_str.Len, spec_str.Ptr );
|
||||
|
||||
prefix_specs = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ast->Attributes || ast->Specs )
|
||||
if ( ast->Attributes || prefix_specs )
|
||||
{
|
||||
result.append("\n" );
|
||||
}
|
||||
@ -571,7 +577,7 @@ void CodeFn::to_string_fwd( String& result )
|
||||
}
|
||||
}
|
||||
|
||||
if ( ast->Specs.has( ESpecifier::Pure ) >= 0 )
|
||||
if ( ast->Specs && ast->Specs.has( ESpecifier::Pure ) >= 0 )
|
||||
result.append( " = 0;" );
|
||||
else if (ast->Body)
|
||||
result.append_fmt( " = %S;", ast->Body.to_string() );
|
||||
@ -983,7 +989,7 @@ void CodeStruct::to_string_def( String& result )
|
||||
while ( interface )
|
||||
{
|
||||
result.append_fmt( ", %S", interface.to_string() );
|
||||
interface = interface->Next ? interface->Next->cast< CodeType >() : Code { nullptr };
|
||||
interface = interface->Next ? interface->Next->cast< CodeType >() : CodeType { nullptr };
|
||||
}
|
||||
}
|
||||
else if ( ast->Name )
|
||||
@ -1247,7 +1253,7 @@ void CodeVar::to_string( String& result )
|
||||
|
||||
result.append( ast->Name );
|
||||
|
||||
if ( ast->ValueType->ArrExpr )
|
||||
if ( ast->ValueType && ast->ValueType->ArrExpr )
|
||||
{
|
||||
result.append_fmt( "[ %S ]", ast->ValueType->ArrExpr.to_string() );
|
||||
|
||||
|
@ -28,8 +28,7 @@ bool Code::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -96,8 +95,7 @@ bool CodeBody::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -164,8 +162,7 @@ bool CodeAttributes::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -252,8 +249,7 @@ bool CodeComment::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -340,8 +336,7 @@ bool CodeConstructor::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -428,8 +423,7 @@ bool CodeClass::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -496,8 +490,7 @@ bool CodeDefine::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -584,8 +577,7 @@ bool CodeDestructor::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -672,8 +664,7 @@ bool CodeEnum::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -760,8 +751,7 @@ bool CodeExec::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -848,8 +838,7 @@ bool CodeExtern::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -936,8 +925,7 @@ bool CodeFriend::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1024,8 +1012,7 @@ bool CodeFn::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1112,8 +1099,7 @@ bool CodeInclude::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1200,8 +1186,7 @@ bool CodeModule::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1288,8 +1273,7 @@ bool CodeNS::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1376,8 +1360,7 @@ bool CodeOperator::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1464,8 +1447,7 @@ bool CodeOpCast::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1552,8 +1534,7 @@ bool CodeParam::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1620,8 +1601,7 @@ bool CodePragma::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1708,8 +1688,7 @@ bool CodePreprocessCond::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1796,8 +1775,7 @@ bool CodeSpecifiers::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1864,8 +1842,7 @@ bool CodeStruct::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -1932,8 +1909,7 @@ bool CodeTemplate::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2020,8 +1996,7 @@ bool CodeType::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2108,8 +2083,7 @@ bool CodeTypedef::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2196,8 +2170,7 @@ bool CodeUnion::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2284,8 +2257,7 @@ bool CodeUsing::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
@ -2372,8 +2344,7 @@ bool CodeVar::is_equal( Code other )
|
||||
{
|
||||
if ( ast == nullptr || other.ast == nullptr )
|
||||
{
|
||||
log_failure( "Code::is_equal: Cannot compare code, AST is null!" );
|
||||
return false;
|
||||
return rcast( AST*, ast ) == other.ast;
|
||||
}
|
||||
return rcast( AST*, ast )->is_equal( other.ast );
|
||||
}
|
||||
|
@ -88,17 +88,17 @@ void define_constants()
|
||||
|
||||
access_private = make_code();
|
||||
access_private->Type = ECode::Access_Private;
|
||||
access_private->Name = get_cached_string( txt("private:") );
|
||||
access_private->Name = get_cached_string( txt("private:\n") );
|
||||
access_private.set_global();
|
||||
|
||||
access_protected = make_code();
|
||||
access_protected->Type = ECode::Access_Protected;
|
||||
access_protected->Name = get_cached_string( txt("protected:") );
|
||||
access_protected->Name = get_cached_string( txt("protected:\n") );
|
||||
access_protected.set_global();
|
||||
|
||||
access_public = make_code();
|
||||
access_public->Type = ECode::Access_Public;
|
||||
access_public->Name = get_cached_string( txt("public:") );
|
||||
access_public->Name = get_cached_string( txt("public:\n") );
|
||||
access_public.set_global();
|
||||
|
||||
attrib_api_export = def_attributes( code(GEN_API_Export_Code));
|
||||
|
@ -159,7 +159,7 @@ struct TokArray
|
||||
}
|
||||
};
|
||||
|
||||
global Arena_128KB defines_map_arena;
|
||||
global Arena_256KB defines_map_arena;
|
||||
global HashTable<StrC> defines;
|
||||
global Array<Token> Tokens;
|
||||
|
||||
@ -374,6 +374,16 @@ s32 lex_preprocessor_directive(
|
||||
move_forward();
|
||||
preprocess_content.Length++;
|
||||
|
||||
if ( current == '\r' && scanner[1] == '\n' )
|
||||
{
|
||||
move_forward();
|
||||
move_forward();
|
||||
}
|
||||
else if ( current == '\n' )
|
||||
{
|
||||
move_forward();
|
||||
}
|
||||
|
||||
Tokens.append( preprocess_content );
|
||||
return Lex_Continue; // Skip found token, its all handled here.
|
||||
}
|
||||
@ -576,7 +586,7 @@ TokArray lex( StrC content )
|
||||
{
|
||||
s32 length = 0;
|
||||
char const* scanner = entry.Data;
|
||||
while ( entry.length() > length && char_is_alphanumeric( *scanner ) || *scanner == '_' )
|
||||
while ( entry.length() > length && (char_is_alphanumeric( *scanner ) || *scanner == '_') )
|
||||
{
|
||||
scanner++;
|
||||
length ++;
|
||||
|
@ -136,8 +136,8 @@ void init()
|
||||
, ( LexAllocator_Size - sizeof( Array<Token>::Header ) ) / sizeof(Token)
|
||||
);
|
||||
|
||||
defines_map_arena = Arena_128KB::init();
|
||||
defines = HashTable<StrC>::init( defines_map_arena );
|
||||
defines_map_arena = Arena_256KB::init();
|
||||
defines = HashTable<StrC>::init_reserve( defines_map_arena, 256 );
|
||||
}
|
||||
|
||||
internal
|
||||
@ -481,7 +481,7 @@ Code parse_array_decl()
|
||||
|
||||
if ( check( TokType::Operator ) && currtok.Text[0] == '[' && currtok.Text[1] == ']' )
|
||||
{
|
||||
Code array_expr = untyped_str( currtok );
|
||||
Code array_expr = untyped_str( get_cached_string(txt(" ")) );
|
||||
eat( TokType::Operator );
|
||||
// []
|
||||
|
||||
@ -574,6 +574,10 @@ Code parse_assignment_expression()
|
||||
s32 level = 0;
|
||||
while ( left && currtok.Type != TokType::Statement_End && (currtok.Type != TokType::Comma || level > 0) )
|
||||
{
|
||||
if (currtok.Type == TokType::BraceCurly_Open )
|
||||
level++;
|
||||
if (currtok.Type == TokType::BraceCurly_Close )
|
||||
level--;
|
||||
if (currtok.Type == TokType::Capture_Start)
|
||||
level++;
|
||||
else if (currtok.Type == TokType::Capture_End)
|
||||
@ -1539,18 +1543,18 @@ Code parse_function_body()
|
||||
result->Type = Function_Body;
|
||||
|
||||
// TODO : Support actual parsing of function body
|
||||
Token start = currtok;
|
||||
Token start = currtok_noskip;
|
||||
|
||||
s32 level = 0;
|
||||
while ( left && ( currtok.Type != TokType::BraceCurly_Close || level > 0 ) )
|
||||
while ( left && ( currtok_noskip.Type != TokType::BraceCurly_Close || level > 0 ) )
|
||||
{
|
||||
if ( currtok.Type == TokType::BraceCurly_Open )
|
||||
if ( currtok_noskip.Type == TokType::BraceCurly_Open )
|
||||
level++;
|
||||
|
||||
else if ( currtok.Type == TokType::BraceCurly_Close && level > 0 )
|
||||
else if ( currtok_noskip.Type == TokType::BraceCurly_Close && level > 0 )
|
||||
level--;
|
||||
|
||||
eat( currtok.Type );
|
||||
eat( currtok_noskip.Type );
|
||||
}
|
||||
|
||||
Token previous = prevtok;
|
||||
@ -1751,6 +1755,7 @@ CodeBody parse_global_nspace( CodeT which )
|
||||
case TokType::Spec_Internal_Linkage:
|
||||
case TokType::Spec_NeverInline:
|
||||
case TokType::Spec_Static:
|
||||
case TokType::Spec_ThreadLocal:
|
||||
{
|
||||
SpecifierT specs_found[16] { ESpecifier::NumSpecifiers };
|
||||
s32 NumSpecifiers = 0;
|
||||
@ -1774,6 +1779,7 @@ CodeBody parse_global_nspace( CodeT which )
|
||||
case ESpecifier::NeverInline:
|
||||
case ESpecifier::Static:
|
||||
case ESpecifier::Volatile:
|
||||
case ESpecifier::Thread_Local:
|
||||
break;
|
||||
|
||||
case ESpecifier::Consteval:
|
||||
@ -2294,7 +2300,7 @@ CodeOperator parse_operator_after_ret_type(
|
||||
case '<':
|
||||
{
|
||||
if ( currtok.Text[1] == '=' )
|
||||
op = LEqual;
|
||||
op = LesserEqual;
|
||||
|
||||
else if ( currtok.Text[1] == '<' )
|
||||
{
|
||||
@ -2683,7 +2689,7 @@ CodeParam parse_params( bool use_template_capture )
|
||||
|
||||
s32 capture_level = 0;
|
||||
s32 template_level = 0;
|
||||
while ( left && (currtok.Type != TokType::Comma) && template_level >= 0 && CheckEndParams() || capture_level > 0 || template_level > 0 )
|
||||
while ( left && (currtok.Type != TokType::Comma) && template_level >= 0 && (CheckEndParams() || capture_level > 0 || template_level > 0) )
|
||||
{
|
||||
if (currtok.Text[ 0 ] == '<')
|
||||
++ template_level;
|
||||
@ -2789,8 +2795,7 @@ CodeParam parse_params( bool use_template_capture )
|
||||
while ( left
|
||||
&& currtok.Type != TokType::Comma
|
||||
&& template_level >= 0
|
||||
&& CheckEndParams()
|
||||
|| capture_level > 0 || template_level > 0 )
|
||||
&& (CheckEndParams() || capture_level > 0 || template_level > 0) )
|
||||
{
|
||||
if (currtok.Text[ 0 ] == '<')
|
||||
++ template_level;
|
||||
@ -2867,7 +2872,7 @@ CodePreprocessCond parse_preprocess_cond()
|
||||
|
||||
CodePreprocessCond
|
||||
cond = (CodePreprocessCond) make_code();
|
||||
cond->Type = scast(CodeT, currtok.Type - (ETokType::Preprocess_If - ECode::Preprocess_If) );
|
||||
cond->Type = scast(CodeT, currtok.Type - (s32(ETokType::Preprocess_If) - s32(ECode::Preprocess_If)) );
|
||||
eat( currtok.Type );
|
||||
// #<Conditional>
|
||||
|
||||
@ -3241,6 +3246,8 @@ CodeVar parse_variable_declaration_list()
|
||||
break;
|
||||
}
|
||||
|
||||
eat(currtok.Type);
|
||||
|
||||
if ( specifiers )
|
||||
specifiers.append( spec );
|
||||
else
|
||||
@ -3642,6 +3649,13 @@ CodeEnum parse_enum( bool inplace_def )
|
||||
// <Name> = <Expression> <Macro>,
|
||||
}
|
||||
|
||||
// Consume inline comments
|
||||
if ( currtok.Type == TokType::Comment && prevtok.Line == currtok.Line )
|
||||
{
|
||||
eat( TokType::Comment );
|
||||
// <Name> = <Expression> <Macro>, // <Inline Comment>
|
||||
}
|
||||
|
||||
entry.Length = ( (sptr)prevtok.Text + prevtok.Length ) - (sptr)entry.Text;
|
||||
|
||||
member = untyped_str( entry );
|
||||
@ -4385,10 +4399,13 @@ CodeType parse_type( bool from_template, bool* typedef_is_function )
|
||||
else if ( currtok.Type == TokType::Decl_Class || currtok.Type == TokType::Decl_Enum || currtok.Type == TokType::Decl_Struct
|
||||
|| currtok.Type == TokType::Decl_Union )
|
||||
{
|
||||
Token fwd_key = currtok;
|
||||
eat( currtok.Type );
|
||||
// <Attributes> <Specifiers> <class, enum, struct, union>
|
||||
|
||||
name = parse_identifier();
|
||||
name = parse_identifier();
|
||||
fwd_key.Length = sptr(name.Text + name.Length) - sptr(fwd_key.Text);
|
||||
name = fwd_key;
|
||||
|
||||
// name.Length = ( ( sptr )currtok.Text + currtok.Length ) - ( sptr )name.Text;
|
||||
// eat( TokType::Identifier );
|
||||
|
Reference in New Issue
Block a user