Changeset 381 in dev
- Timestamp:
- Dec 19, 2007, 3:31:03 AM (17 years ago)
- Location:
- trunk/abdev
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler32/Compile_Statement.cpp
r380 r381 596 596 { 597 597 Type resultType; 598 int i; 599 char temporary[VN_SIZE],collectionVar[VN_SIZE]; 598 char temporary[VN_SIZE],variable[VN_SIZE],collectionVar[VN_SIZE]; 600 599 bool isError = false; 601 600 601 //レキシカルスコープをレベルアップ 602 compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR ); 603 602 604 //第1パラメータを取得 603 char variable[VN_SIZE];604 i=GetOneParameter(Parameter,0,variable);605 int i = 0; 606 GetCustomToken( variable, Parameter, i, ESC_IN, true ); 605 607 if(!Parameter[i]){ 606 608 SetError(12,"Foreach",cp); … … 608 610 goto ErrorStep; 609 611 } 612 i++; 610 613 611 614 //第2パラメータを取得(in~) 612 i=GetOneParameter(Parameter,i,collectionVar); 613 614 //レキシカルスコープをレベルアップ 615 compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR ); 615 lstrcpy( collectionVar, Parameter + i ); 616 616 617 617 if( !GetVarType( variable, resultType, false ) ) … … 651 651 const PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true ); 652 652 653 // Currentプロパティから現在の値を取得 654 sprintf( temporary, "%s=%s.Current", variable, collectionVar ); 655 Compile( temporary ); 653 if( !isError ) 654 { 655 // Currentプロパティから現在の値を取得 656 sprintf( temporary, "%s=%s.Current", variable, collectionVar ); 657 Compile( temporary ); 658 } 656 659 657 660 //For内をコンパイル … … 666 669 } 667 670 668 //jmp ... 669 compiler.codeGenerator.op_jmp_continue(); 671 if( !isError ) 672 { 673 //jmp ... 674 compiler.codeGenerator.op_jmp_continue(); 675 } 670 676 671 677 //レキシカルスコープをレベルダウン -
trunk/abdev/BasicCompiler64/Compile_Statement.cpp
r380 r381 473 473 { 474 474 Type resultType; 475 int i;476 475 char temporary[VN_SIZE],variable[VN_SIZE],collectionVar[VN_SIZE]; 477 476 bool isError = false; 478 477 478 //レキシカルスコープをレベルアップ 479 compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR ); 480 479 481 //第1パラメータを取得 480 i=GetOneParameter(Parameter,0,temporary); 482 int i = 0; 483 GetCustomToken( variable, Parameter, i, ESC_IN, true ); 481 484 if(!Parameter[i]){ 482 485 SetError(12,"Foreach",cp); … … 484 487 goto ErrorStep; 485 488 } 486 487 lstrcpy( variable, temporary ); 489 i++; 488 490 489 491 //第2パラメータを取得(in~) 490 i=GetOneParameter(Parameter,i,collectionVar); 491 492 //レキシカルスコープをレベルアップ 493 compiler.codeGenerator.lexicalScopes.Start( compiler.codeGenerator.GetNativeCodeSize(), LexicalScope::SCOPE_TYPE_FOR ); 492 lstrcpy( collectionVar, Parameter + i ); 494 493 495 494 if( !GetVarType( variable, resultType, false ) ) … … 527 526 const PertialSchedule *pTempPertialSchedule = compiler.codeGenerator.op_je( 0, sizeof(long), true ); 528 527 529 // Currentプロパティから現在の値を取得 530 sprintf( temporary, "%s=%s.Current", variable, collectionVar ); 531 Compile( temporary ); 528 if( !isError ) 529 { 530 // Currentプロパティから現在の値を取得 531 sprintf( temporary, "%s=%s.Current", variable, collectionVar ); 532 Compile( temporary ); 533 } 532 534 533 535 //For内をコンパイル … … 542 544 } 543 545 544 //jmp ... 545 compiler.codeGenerator.op_jmp_continue(); 546 if( !isError ) 547 { 548 //jmp ... 549 compiler.codeGenerator.op_jmp_continue(); 550 } 546 551 547 552 //レキシカルスコープをレベルダウン -
trunk/abdev/BasicCompiler_Common/Compile.cpp
r372 r381 49 49 } 50 50 token[i] = source[pos]; 51 } 52 } 53 void GetCustomToken( char *token, const char *source, int &pos, char delimitation, bool isEscapeSequence ) 54 { 55 for( int i=0; ; i++, pos++ ){ 56 if( isEscapeSequence ) 57 { 58 if( source[pos] == 1 && source[pos+1] == delimitation ) 59 { 60 token[i] = 0; 61 pos++; 62 break; 63 } 64 } 65 else 66 { 67 if( source[pos] == delimitation ) 68 { 69 token[i] = 0; 70 break; 71 } 72 } 73 74 token[i] = source[pos]; 75 76 if( source[pos] == '\0' ) 77 { 78 break; 79 } 51 80 } 52 81 } -
trunk/abdev/BasicCompiler_Common/Intermediate_Step2.cpp
r372 r381 451 451 ComNum=COM_FOR; 452 452 } 453 else if(lstrcmpi(com,"Foreach")==0){ 454 KillSpaces(Command+i,pam); 453 else if(lstrcmpi(com,"Foreach")==0) 454 { 455 for(i2=0,IsStr=0;;i++,i2++) 456 { 457 while(Command[i]==' '||Command[i]=='\t') i++; 458 if(Command[i]=='\"') IsStr^=1; 459 if((Command[i-1]==' '||Command[i-1]=='\t')&&(Command[i]=='i'||Command[i]=='I')&&(Command[i+1]=='n'||Command[i+1]=='N')&&(Command[i+2]==' '||Command[i+2]=='\t')&&IsStr==0){ 460 pam[i2++] = 1; 461 pam[i2] = ESC_IN; 462 break; 463 } 464 pam[i2]=Command[i]; 465 if(Command[i]=='\0') break; 466 } 467 if(Command[i]) 468 { 469 lstrcpy( pam + i2 + 1, Command + i + 3 ); 470 } 455 471 ComNum=COM_FOREACH; 456 472 } -
trunk/abdev/BasicCompiler_Common/common.h
r350 r381 377 377 void GetIdentifierToken( char *token, const char *source, int &pos ); 378 378 void GetCommandToken( char *token, const char *source, int &pos ); 379 void GetCustomToken( char *token, const char *source, int &pos, char delimitation, bool isEscapeSequence ); 379 380 void SplitGenericClassInstance( const char *fullName, char *className, Jenga::Common::Strings &typeParameters ); 380 381 int JumpStatement(const char *source, int &pos); -
trunk/abdev/ProjectEditor/SubOperation.cpp
r380 r381 524 524 if(lstrcmpi(str,"Imports")==0) return -1; 525 525 if(lstrcmpi(str,"Implements")==0) return -1; 526 if(lstrcmpi(str,"In")==0) return -1; 526 527 if(lstrcmpi(str,"Inherits")==0) return COM_INHERITS; 527 528 if(lstrcmpi(str,"Input")==0) return COM_INPUT; … … 580 581 if(lstrcmpi(str,"Sleep")==0) return COM_SLEEP; 581 582 if(lstrcmp(str,"Static")==0) return -1; 583 if(lstrcmpi(str,"Step")==0) return -1; 582 584 if(lstrcmp(str,"String")==0) return -1; 583 585 if(lstrcmpi(str,"Sub")==0) return COM_SUB; … … 588 590 if(lstrcmpi(str,"This")==0) return -1; 589 591 if(lstrcmpi(str,"Throw")==0) return -1; 592 if(lstrcmpi(str,"To")==0) return -1; 590 593 if(lstrcmp(str,"True")==0) return -1; 591 594 if(lstrcmp(str,"Try")==0) return COM_TRY;
Note:
See TracChangeset
for help on using the changeset viewer.