Overwrite all code with blanks until the matching #endif
| 781 | |
| 782 | // Overwrite all code with blanks until the matching #endif |
| 783 | int CScriptBuilder::ExcludeCode(int pos) |
| 784 | { |
| 785 | asUINT len = 0; |
| 786 | int nested = 0; |
| 787 | while( pos < (int)modifiedScript.size() ) |
| 788 | { |
| 789 | engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len); |
| 790 | if( modifiedScript[pos] == '#' ) |
| 791 | { |
| 792 | modifiedScript[pos] = ' '; |
| 793 | pos++; |
| 794 | |
| 795 | // Is it an #if or #endif directive? |
| 796 | engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len); |
| 797 | string token; |
| 798 | token.assign(&modifiedScript[pos], len); |
| 799 | OverwriteCode(pos, len); |
| 800 | |
| 801 | if( token == "if" ) |
| 802 | { |
| 803 | nested++; |
| 804 | } |
| 805 | else if( token == "endif" ) |
| 806 | { |
| 807 | if( nested-- == 0 ) |
| 808 | { |
| 809 | pos += len; |
| 810 | break; |
| 811 | } |
| 812 | } |
| 813 | } |
| 814 | else if( modifiedScript[pos] != '\n' ) |
| 815 | { |
| 816 | OverwriteCode(pos, len); |
| 817 | } |
| 818 | pos += len; |
| 819 | } |
| 820 | |
| 821 | return pos; |
| 822 | } |
| 823 | |
| 824 | // Overwrite all characters except line breaks with blanks |
| 825 | void CScriptBuilder::OverwriteCode(int start, int len) |
nothing calls this directly
no outgoing calls
no test coverage detected