#include "stdafx.h" using namespace ActiveBasic::Compiler; void LexicalAnalyzer::CollectDelegates( const char *source, Delegates &delegates ) { int i2; char temporary[VN_SIZE]; // 名前空間管理 NamespaceScopes &namespaceScopes = compiler.GetNamespaceSupporter().GetLivingNamespaceScopes(); namespaceScopes.clear(); // Importsされた名前空間の管理 NamespaceScopesCollection &importedNamespaces = compiler.GetNamespaceSupporter().GetImportedNamespaces(); importedNamespaces.clear(); int length = lstrlen( source ); for( int i=0; i values; if( dg.GetNamespaceScopes().size() ) { std::string namespaceScopesCommandStr = ""; std::string endNamespaceScopesCommandStr = ""; BOOST_FOREACH( const std::string &namespaceStr, dg.GetNamespaceScopes() ) { if( namespaceScopesCommandStr.size() ) { namespaceScopesCommandStr += ":"; endNamespaceScopesCommandStr += ":"; } namespaceScopesCommandStr += "Namespace " + namespaceStr; endNamespaceScopesCommandStr += "End Namespace"; } values.insert( std::map::value_type( "#namespace_begin#", namespaceScopesCommandStr ) ); values.insert( std::map::value_type( "#namespace_end#", endNamespaceScopesCommandStr ) ); } else { values.insert( std::map::value_type( "#namespace_begin#", "" ) ); values.insert( std::map::value_type( "#namespace_end#", "" ) ); } values.insert( std::map::value_type( "#name#", dg.GetName() ) ); if( dg.IsFunction() ) { values.insert( std::map::value_type( "#call_method_begin#", (std::string)"Function Call(" + dg.GetParamStr() + ") As " + dg.GetReturnTypeName() ) ); values.insert( std::map::value_type( "#call_method_end#", "End Function" ) ); values.insert( std::map::value_type( "#result#", "Call=" ) ); } else { values.insert( std::map::value_type( "#call_method_begin#", (std::string)"Sub Call(" + dg.GetParamStr() + ")" ) ); values.insert( std::map::value_type( "#call_method_end#", "End Sub" ) ); values.insert( std::map::value_type( "#result#", "" ) ); } values.insert( std::map::value_type( "#params#", dg.GetParamStr() ) ); destSource += sourceTemplate.GetResult( values ); } /* std::ofstream ofs( ( Jenga::Common::Environment::GetAppDir() + "\\generated_delegate_code.log" ).c_str() ); ofs << destSource; ofs.close(); */ return destSource; } void LexicalAnalyzer::RefleshDelegatesParameterAndReturnType( Delegates &delegates ) { delegates.Iterator_Reset(); while( delegates.Iterator_HasNext() ) { Delegate &dg = *delegates.Iterator_GetNext(); dg.RefleshParameterAndReturnType(); } }