* process preprocessor statements. * charNum should be the index of the #. * * delete bracketTypeStack entries added by #if if a #else is found. * prevents double entries in the bracketTypeStack. */
| 4567 | * prevents double entries in the bracketTypeStack. |
| 4568 | */ |
| 4569 | void ASFormatter::processPreprocessor() |
| 4570 | { |
| 4571 | assert(currentChar == '#'); |
| 4572 | |
| 4573 | const size_t preproc = currentLine.find_first_not_of(" \t", charNum + 1); |
| 4574 | |
| 4575 | if (preproc == string::npos) |
| 4576 | return; |
| 4577 | |
| 4578 | if (currentLine.compare(preproc, 2, "if") == 0) |
| 4579 | { |
| 4580 | preprocBracketTypeStackSize = bracketTypeStack->size(); |
| 4581 | } |
| 4582 | else if (currentLine.compare(preproc, 4, "else") == 0) |
| 4583 | { |
| 4584 | // delete stack entries added in #if |
| 4585 | // should be replaced by #else |
| 4586 | if (preprocBracketTypeStackSize > 0) |
| 4587 | { |
| 4588 | int addedPreproc = bracketTypeStack->size() - preprocBracketTypeStackSize; |
| 4589 | for (int i = 0; i < addedPreproc; i++) |
| 4590 | bracketTypeStack->pop_back(); |
| 4591 | } |
| 4592 | } |
| 4593 | } |
| 4594 | |
| 4595 | /** |
| 4596 | * determine if the next line starts a comment |
nothing calls this directly
no outgoing calls
no test coverage detected