MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / astStringXml

Function astStringXml

lib/token.cpp:1638–1664  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1636}
1637
1638static void astStringXml(const Token *tok, nonneg int indent, std::ostream &out)
1639{
1640 const std::string strindent(indent, ' ');
1641
1642 out << strindent << "<token str=\"" << tok->str() << '\"';
1643 if (tok->varId())
1644 out << " varId=\"" << tok->varId() << '\"';
1645 if (tok->variable())
1646 out << " variable=\"" << tok->variable() << '\"';
1647 if (tok->function())
1648 out << " function=\"" << tok->function() << '\"';
1649 if (!tok->values().empty())
1650 out << " values=\"" << &tok->values() << '\"';
1651
1652 if (!tok->astOperand1() && !tok->astOperand2()) {
1653 out << "/>" << std::endl;
1654 }
1655
1656 else {
1657 out << '>' << std::endl;
1658 if (tok->astOperand1())
1659 astStringXml(tok->astOperand1(), indent+2U, out);
1660 if (tok->astOperand2())
1661 astStringXml(tok->astOperand2(), indent+2U, out);
1662 out << strindent << "</token>" << std::endl;
1663 }
1664}
1665
1666void Token::printAst(bool xml, const std::vector<std::string> &fileNames, std::ostream &out) const
1667{

Callers 1

printAstMethod · 0.85

Calls 6

variableMethod · 0.80
astOperand1Method · 0.80
astOperand2Method · 0.80
strMethod · 0.45
functionMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected