Changeset 531 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/src
- Timestamp:
- May 2, 2008, 2:56:06 PM (17 years ago)
- Location:
- trunk/ab5.0/abdev/BasicCompiler_Common/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/src/LexicalAnalyzer.cpp
r511 r531 2 2 3 3 using namespace ActiveBasic::Compiler; 4 5 LexicalAnalyzer::SourceTemplate::SourceTemplate( const std::string &filePath ) 6 { 7 Jenga::Common::File file = Jenga::Common::File( GetApplicationBaseFullPath( filePath ) ); 8 source = file.Read(); 9 } 10 std::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 4 33 5 34 bool LexicalAnalyzer::CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection ) -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Source.cpp
r523 r531 1023 1023 return 1; 1024 1024 } 1025 1026 1027 SourceTemplate::SourceTemplate( const std::string &filePath )1028 {1029 Jenga::Common::File file = Jenga::Common::File( GetApplicationBaseFullPath( filePath ) );1030 source = file.Read();1031 }1032 std::string SourceTemplate::GetResult( const std::map<std::string,std::string> &values )1033 {1034 std::string result = source;1035 1036 std::map<std::string,std::string>::const_iterator it = values.begin();1037 while( it != values.end() )1038 {1039 while( true )1040 {1041 std::string::size_type index = result.find( it->first );1042 if( index == std::string::npos )1043 {1044 break;1045 }1046 1047 result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() );1048 }1049 it++;1050 }1051 1052 return result;1053 }
Note:
See TracChangeset
for help on using the changeset viewer.