| 33 | typedef yard::TreeBuildingParser<char>::Node Node; |
| 34 | |
| 35 | void printNode(Node* n, int depth = 0) { |
| 36 | std::cout << std::string(depth, '+') << n->GetRuleTypeInfo().name(); |
| 37 | if (n->IsCompleted()) { |
| 38 | std::cout << ": [" << std::string(n->GetFirstToken(), n->GetLastToken()) |
| 39 | << ']'; |
| 40 | } |
| 41 | std::cout << std::endl; |
| 42 | for (Node* c = n->GetFirstChild(); c; c = c->GetSibling()) { |
| 43 | printNode(c, depth + 1); |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | void callback(yard::SimpleTextParser& p) { |
| 48 | printNode(p.GetAstRoot()); |
no test coverage detected