MCPcopy Create free account
hub / github.com/dirkvranckaert/AndroidDecompiler / processPreprocessor

Method processPreprocessor

astyle/src/ASFormatter.cpp:4569–4593  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

4567 * prevents double entries in the bracketTypeStack.
4568 */
4569void 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected