Changeset 296 in dev
- Timestamp:
- Aug 23, 2007, 3:20:12 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/Compile.cpp
r288 r296 31 31 // トークンを取得 32 32 /////////////////////////////////////////////////// 33 void GetIdentifierToken( char *token, const char *source, int &pos ){ 33 void GetIdentifierToken( char *token, const char *source, int &pos ) 34 { 34 35 for( int i=0; ; i++, pos++ ){ 35 36 if( ! IsVariableChar( source[pos] ) ){ … … 39 40 token[i] = source[pos]; 40 41 } 42 } 43 void GetCommandToken( char *token, const char *source, int &pos ) 44 { 45 for( int i=0; ; i++, pos++ ){ 46 if( IsCommandDelimitation( source[pos] ) ){ 47 token[i] = 0; 48 break; 49 } 50 token[i] = source[pos]; 51 } 52 } 53 54 55 /////////////////////////////////////////////////// 56 // ジェネリクスのクラス型記述を分析 57 /////////////////////////////////////////////////// 58 void SplitGenericClassInstance( const char *fullName, char *className, std::vector<std::string> &typeParameters ) 59 { 60 int i = 0; 61 typeParameters.clear(); 62 63 //クラス名を取得 64 GetIdentifierToken( className, fullName, i ); 65 66 67 ///////////////////////////////////////////////////////// 68 // ☆★☆ ジェネリクスサポート ☆★☆ 69 if( fullName[i] == '<' ) 70 { 71 while( true ) 72 { 73 i++; 74 75 // 型パラメータを取得 76 char temporary[VN_SIZE]; 77 GetIdentifierToken( temporary, fullName, i ); 78 if( temporary[0] == '\0' ) 79 { 80 extern int cp; 81 SetError(1,NULL,cp); 82 } 83 84 typeParameters.push_back( temporary ); 85 86 if( fullName[i] == ',' ) 87 { 88 continue; 89 } 90 else if( fullName[i] == '>' ) 91 { 92 break; 93 } 94 else 95 { 96 extern int cp; 97 SetError(1,NULL,cp); 98 } 99 } 100 } 101 ///////////////////////////////////////////////////////// 41 102 } 42 103 -
trunk/abdev/BasicCompiler_Common/common.h
r292 r296 374 374 //Compile.cpp 375 375 void GetIdentifierToken( char *token, const char *source, int &pos ); 376 void GetCommandToken( char *token, const char *source, int &pos ); 377 void SplitGenericClassInstance( const char *fullName, char *className, std::vector<std::string> &typeParameters ); 376 378 int JumpStatement(const char *source, int &pos); 377 379 void DebugVariable(void); -
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r290 r296 1259 1259 1260 1260 //クラス名を取得 1261 GetIdentifierToken( temporary, basbuf, i ); 1262 1263 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, temporary) ); 1261 GetCommandToken( temporary, basbuf, i ); 1262 1263 char className[VN_SIZE]; 1264 std::vector<std::string> typeParameters; 1265 SplitGenericClassInstance( temporary, className, typeParameters ); 1266 1267 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, className) ); 1264 1268 if(!pobj_c) continue; 1265 1269 … … 1281 1285 ///////////////////////////////////////////////////////// 1282 1286 // ☆★☆ ジェネリクスサポート ☆★☆ 1283 if( basbuf[i] == '<')1287 BOOST_FOREACH( const std::string &typeParameter, typeParameters ) 1284 1288 { 1285 // 型パラメータを取得 1286 i++; 1287 GetIdentifierToken( temporary, basbuf, i ); 1288 1289 pobj_c->AddFormalGenericType( GenericType( temporary, Type(DEF_OBJECT,*GetObjectClassPtr()) ) ); 1290 1291 if( basbuf[i] == '>' ) 1292 { 1293 i++; 1294 } 1295 else 1296 { 1297 SetError(); 1298 } 1289 pobj_c->AddFormalGenericType( GenericType( typeParameter, Type(DEF_OBJECT,*GetObjectClassPtr()) ) ); 1299 1290 } 1300 1291 ///////////////////////////////////////////////////////// … … 1330 1321 isInherits = true; 1331 1322 1332 for(i+=3,i2=0;;i++,i2++){ 1333 if(IsCommandDelimitation(basbuf[i])){ 1334 temporary[i2]=0; 1335 break; 1336 } 1337 temporary[i2]=basbuf[i]; 1338 } 1323 i += 3; 1324 GetCommandToken( temporary, basbuf, i ); 1339 1325 1340 1326 if(lstrcmpi(temporary,pobj_c->GetName().c_str())==0){
Note:
See TracChangeset
for help on using the changeset viewer.