Overwrite all code with blanks until the matching #endif
| 844 | |
| 845 | // Overwrite all code with blanks until the matching #endif |
| 846 | int CScriptBuilder::ExcludeCode(int pos) |
| 847 | { |
| 848 | asUINT len = 0; |
| 849 | int nested = 0; |
| 850 | while( pos < (int)modifiedScript.size() ) |
| 851 | { |
| 852 | engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len); |
| 853 | if( modifiedScript[pos] == '#' ) |
| 854 | { |
| 855 | modifiedScript[pos] = ' '; |
| 856 | pos++; |
| 857 | |
| 858 | // Is it an #if or #endif directive? |
| 859 | engine->ParseToken(&modifiedScript[pos], modifiedScript.size() - pos, &len); |
| 860 | string token; |
| 861 | token.assign(&modifiedScript[pos], len); |
| 862 | OverwriteCode(pos, len); |
| 863 | |
| 864 | if( token == "if" ) |
| 865 | { |
| 866 | nested++; |
| 867 | } |
| 868 | else if( token == "endif" ) |
| 869 | { |
| 870 | if( nested-- == 0 ) |
| 871 | { |
| 872 | pos += len; |
| 873 | break; |
| 874 | } |
| 875 | } |
| 876 | } |
| 877 | else if( modifiedScript[pos] != '\n' ) |
| 878 | { |
| 879 | OverwriteCode(pos, len); |
| 880 | } |
| 881 | pos += len; |
| 882 | } |
| 883 | |
| 884 | return pos; |
| 885 | } |
| 886 | |
| 887 | // Overwrite all characters except line breaks with blanks |
| 888 | void CScriptBuilder::OverwriteCode(int start, int len) |
nothing calls this directly
no test coverage detected