| 1636 | } |
| 1637 | |
| 1638 | static 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 | |
| 1666 | void Token::printAst(bool xml, const std::vector<std::string> &fileNames, std::ostream &out) const |
| 1667 | { |
no test coverage detected