Called when we reach the end of an input stream. Performs some validation and then destroys the input stream if required.
| 214 | // Called when we reach the end of an input stream. |
| 215 | // Performs some validation and then destroys the input stream if required. |
| 216 | static void EndInputStream(Preprocessor* preprocessor, PreprocessorInputStream* inputStream) |
| 217 | { |
| 218 | // If there are any conditionals that weren't completed, then it is an error |
| 219 | if (inputStream->conditional) |
| 220 | { |
| 221 | PreprocessorConditional* conditional = inputStream->conditional; |
| 222 | |
| 223 | GetSink(preprocessor)->diagnose(conditional->ifToken.Position, Diagnostics::endOfFileInPreprocessorConditional); |
| 224 | |
| 225 | while (conditional) |
| 226 | { |
| 227 | PreprocessorConditional* parent = conditional->parent; |
| 228 | DestroyConditional(conditional); |
| 229 | conditional = parent; |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | DestroyInputStream(preprocessor, inputStream); |
| 234 | } |
| 235 | |
| 236 | // Consume one token from an input stream |
| 237 | static Token AdvanceRawToken(PreprocessorInputStream* inputStream) |
no test coverage detected