Ignore:
Timestamp:
May 2, 2008, 2:56:06 PM (16 years ago)
Author:
dai_9181
Message:

SourceTemplateクラスをLexicalAnalyzerクラスのインナークラスにした

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer.cpp

    r511 r531  
    22
    33using namespace ActiveBasic::Compiler;
     4
     5LexicalAnalyzer::SourceTemplate::SourceTemplate( const std::string &filePath )
     6{
     7    Jenga::Common::File file = Jenga::Common::File( GetApplicationBaseFullPath( filePath ) );
     8    source = file.Read();
     9}
     10std::string LexicalAnalyzer::SourceTemplate::GetResult( const std::map<std::string,std::string> &values )
     11{
     12    std::string result = source;
     13
     14    std::map<std::string,std::string>::const_iterator it = values.begin();
     15    while( it != values.end() )
     16    {
     17        while( true )
     18        {
     19            std::string::size_type index = result.find( it->first );
     20            if( index == std::string::npos )
     21            {
     22                break;
     23            }
     24
     25            result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() );
     26        }
     27        it++;
     28    }
     29
     30    return result;
     31}
     32
    433
    534bool LexicalAnalyzer::CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection )
Note: See TracChangeset for help on using the changeset viewer.