- Timestamp:
- Aug 25, 2008, 5:38:29 PM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/StrOperation.cpp
r727 r736 391 391 if( esc == ESC_OPERATOR ) 392 392 { 393 extern char *calcNames[256];393 extern char const *calcNames[256]; 394 394 unsigned char calcId = temporary[i+2]; 395 395 if( calcNames[calcId] ) -
trunk/ab5.0/abdev/ab_common/src/Lexical/Namespace.cpp
r700 r736 1 1 #include "stdafx.h" 2 2 #include <algorithm> 3 3 4 4 using namespace ActiveBasic::Common::Lexical; … … 28 28 NamespaceScopes NamespaceScopes::operator+ ( const NamespaceScopes &namespaceScopes ) const 29 29 { 30 NamespaceScopes result = *this; 31 BOOST_FOREACH( const std::string &name, namespaceScopes ) 32 { 33 result.push_back( name ); 34 } 30 NamespaceScopes result; 31 result.reserve( this->size() + namespaceScopes.size() ); 32 result = *this; 33 result.append( namespaceScopes ); 35 34 return result; 36 35 } … … 42 41 return false; 43 42 } 44 45 for( int i=static_cast<int>(this->size()-1); i>=0; i-- ) 46 { 47 if( (*this)[i] != namespaceScopes[i] ) 48 { 49 return false; 50 } 51 } 52 53 return true; 43 return std::equal(begin(), end(), namespaceScopes.begin() ); 54 44 } 55 45 -
trunk/ab5.0/abdev/ab_common/src/Lexical/NamespaceSupporter.cpp
r670 r736 31 31 32 32 // 現在の名前空間とのマッチングを試みる 33 NamespaceScopes tempCurrent = this->livingNamespaceScopes; 34 while( !tempCurrent.empty() ) 33 typedef NamespaceScopes::const_iterator cnsit_t; 34 cnsit_t first = livingNamespaceScopes.begin(); 35 cnsit_t last = livingNamespaceScopes.end(); 36 NamespaceScopes temp; 37 while( first != last ) 35 38 { 36 if( base.IsEqual( tempCurrent + entry ) ) 39 temp.assign( first, last ); 40 temp.append( entry ); 41 if( base.IsEqual( temp ) ) 37 42 { 38 43 return true; 39 44 } 40 41 tempCurrent.pop_back(); 45 --last; 42 46 } 43 47 -
trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp
r632 r736 5 5 const NamespaceSupporter *Symbol::namespaceSupporter = NULL; 6 6 7 char *calcNames[256] = {8 "xor",7 char const *calcNames[256] = { 8 0, 9 9 }; 10 10 void InitCalcNames() … … 14 14 return; 15 15 } 16 17 memset( calcNames, 0, 255 * sizeof(char *) );18 16 calcNames[CALC_XOR] = "xor"; 19 17 calcNames[CALC_OR] = "or"; … … 106 104 if( namespaceScopes.size() ) 107 105 { 108 return namespaceScopes.ToString() + "."+ name;106 return namespaceScopes.ToString() + '.' + name; 109 107 } 110 108 … … 123 121 bool Symbol::IsEqualSymbol( const Symbol &symbol ) const 124 122 { 125 if( IsEqualSymbol( symbol.GetNamespaceScopes(), symbol.GetName() ) ) 123 const NamespaceScopes &symbolNS = symbol.GetNamespaceScopes(); 124 if( IsEqualSymbol( symbolNS, symbol.GetName() ) ) 126 125 { 127 126 return true; 128 127 } 129 128 130 if( symbol.GetNamespaceScopes().size() >= 1)129 if( !symbolNS.empty() ) 131 130 { 132 131 // 静的メンバを考慮 133 NamespaceScopes namespaceScopes( symbol.GetNamespaceScopes());134 std::string name = namespaceScopes[namespaceScopes.size()-1] + "." + symbol.GetName();135 namespaceScopes.pop_back();136 137 return IsEqualSymbol( namespaceScopes, name );132 std::string name = symbolNS.back() + '.' + symbol.GetName(); 133 if( GetName() != name ){ 134 return false; 135 } 136 return IsEqualSymbol( NamespaceScopes( symbolNS.begin(), symbolNS.end() - 1 ), name ); 138 137 } 139 138 return false;
Note:
See TracChangeset
for help on using the changeset viewer.