#include #include #include #include #include #include #include #include void parseyaml() { x::yaml::parser p= x::yaml::parser::create(std::istreambuf_iterator(std::cin), std::istreambuf_iterator()); if (p->documents.size() != 1) throw EXCEPTION("stdin did not contain a single YAML document"); x::yaml::document doc=p->documents.front(); x::yaml::sequencenode seq=doc->root(); for (x::yaml::mappingnode highest_point:*seq) { std::map m; for (std::pair mapping : *highest_point) { m[mapping.first->value]=mapping.second->value; } std::cout << "In " << m["continent"] << ", the highest point is " << m["highest_point"] << ", located in " << m["country"] << std::endl; } } int main(int argc, char **argv) { try { parseyaml(); } catch (const x::exception &e) { std::cerr << e << std::endl; exit(1); } return 0; }