| 1062 | } |
| 1063 | |
| 1064 | bool BfParser::HandlePreprocessor() |
| 1065 | { |
| 1066 | int triviaStart = mTriviaStart; |
| 1067 | |
| 1068 | int checkIdx = 0; |
| 1069 | for (int checkIdx = mLineStart; checkIdx < mSrcIdx - 1; checkIdx++) |
| 1070 | { |
| 1071 | if (!isspace((uint8)mSrc[checkIdx])) |
| 1072 | { |
| 1073 | if (mPreprocessorIgnoreDepth == 0) |
| 1074 | { |
| 1075 | if (mSrc[mSrcIdx - 1] != '#') |
| 1076 | return false; |
| 1077 | mPassInstance->FailAt("Preprocessor directives must appear as the first non-whitespace character on a line", mSourceData, checkIdx); |
| 1078 | break; |
| 1079 | } |
| 1080 | else |
| 1081 | continue; // Keep searching for #endif |
| 1082 | } |
| 1083 | } |
| 1084 | |
| 1085 | String pragma; |
| 1086 | String pragmaParam; |
| 1087 | |
| 1088 | switch (mSrc[mSrcIdx - 1]) |
| 1089 | { |
| 1090 | case '<': |
| 1091 | if (mPreprocessorIgnoreDepth > 0) |
| 1092 | return false; |
| 1093 | pragma = "<<<"; |
| 1094 | break; |
| 1095 | case '=': |
| 1096 | if (mPreprocessorIgnoreDepth > 0) |
| 1097 | return false; |
| 1098 | pragma = "==="; |
| 1099 | break; |
| 1100 | case '>': |
| 1101 | if (mPreprocessorIgnoreDepth > 1) |
| 1102 | return false; |
| 1103 | pragma = ">>>"; |
| 1104 | break; |
| 1105 | } |
| 1106 | |
| 1107 | bool atEnd = false; |
| 1108 | |
| 1109 | int startIdx = mSrcIdx - 1; |
| 1110 | int spaceIdx = -1; |
| 1111 | int charIdx = -1; |
| 1112 | while (true) |
| 1113 | { |
| 1114 | char c = mSrc[mSrcIdx++]; |
| 1115 | |
| 1116 | if (c == '\n') |
| 1117 | { |
| 1118 | int checkIdx = mSrcIdx - 2; |
| 1119 | bool hadSlash = false; |
| 1120 | while (checkIdx >= startIdx) |
| 1121 | { |
nothing calls this directly
no test coverage detected