- Timestamp:
- Aug 23, 2007, 10:57:00 PM (17 years ago)
- Location:
- trunk/jenga
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jenga/include/smoothie/LexicalAnalysis.h
r205 r300 23 23 int GetStringInPare(char *buffer,const char *ReadBuffer); 24 24 int GetStringInBracket(char *buffer,const char *ReadBuffer); 25 int GetStringInGenericBracket(char *buffer,const char *ReadBuffer); 25 26 int JumpStringInPare(const char *buffer,int pos); 26 27 int JumpStringInBracket(const char *buffer,int pos); … … 34 35 std::string Operator_NaturalStringToCalcMarkString( const std::string &name ); 35 36 std::string Operator_CalcMarkStringToNaturalString( const std::string &name ); 37 bool IsGenericTypeSourcePart( const char *buffer ); -
trunk/jenga/src/smoothie/LexicalAnalysis.cpp
r211 r300 1 #include <jenga/include/common/Exception.h> 1 2 #include <jenga/include/smoothie/SmoothieException.h> 2 3 #include <jenga/include/smoothie/LexicalAnalysis.h> … … 137 138 else if(ReadBuffer[i]=='['&&IsStr==0) PareNum++; 138 139 else if(ReadBuffer[i]==']'&&IsStr==0){ 140 PareNum--; 141 if(PareNum==0){ 142 i++; 143 buffer[i]=0; 144 break; 145 } 146 } 147 else if(ReadBuffer[i]=='\0') return 0; 148 } 149 return i; 150 } 151 int GetStringInGenericBracket(char *buffer,const char *ReadBuffer){ 152 int i,IsStr,PareNum; 153 for(i=0,IsStr=0,PareNum=0;;i++){ 154 buffer[i]=ReadBuffer[i]; 155 if(IsDBCSLeadByte(ReadBuffer[i])){ 156 i++; 157 buffer[i]=ReadBuffer[i]; 158 continue; 159 } 160 if(ReadBuffer[i]=='\"') IsStr^=1; 161 else if(ReadBuffer[i]=='<'&&IsStr==0) PareNum++; 162 else if(ReadBuffer[i]=='>'&&IsStr==0){ 139 163 PareNum--; 140 164 if(PareNum==0){ … … 349 373 return name; 350 374 } 375 376 bool IsGenericTypeSourcePart( const char *buffer ) 377 { 378 if( buffer[0] != '<' ) 379 { 380 Jenga::Throw( "意図しない文字列に対してIsGenericTypeSourcePart関数が呼ばれた" ); 381 return false; 382 } 383 384 int i=1, scopeCount=1; 385 for( ; ; i++ ) 386 { 387 if( buffer[i] == '\0' ) 388 { 389 break; 390 } 391 if( buffer[i] == '<' ) 392 { 393 scopeCount++; 394 } 395 else if( buffer[i] == '>' ) 396 { 397 scopeCount--; 398 399 if( scopeCount == 0 ) 400 { 401 break; 402 } 403 } 404 } 405 406 if( buffer[i] != '>' ) 407 { 408 return false; 409 } 410 411 412 ///////////////////////////////////////////////////////////////// 413 // '>'に続く文字を判定する 414 ///////////////////////////////////////////////////////////////// 415 416 i++; 417 while( IsBlank( buffer[i] ) ) 418 { 419 i++; 420 } 421 422 if( IsVariableChar( buffer[i] ) ) 423 { 424 return false; 425 } 426 427 return true; 428 }
Note:
See TracChangeset
for help on using the changeset viewer.