2009-07-10 03:10:03 +00:00
|
|
|
#include "yaml.h"
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
|
{
|
2009-07-10 04:25:11 +00:00
|
|
|
std::ifstream fin;
|
|
|
|
|
if(argc > 1)
|
|
|
|
|
fin.open(argv[1]);
|
|
|
|
|
|
|
|
|
|
std::istream& input = (argc > 1 ? fin : std::cin);
|
2009-07-10 03:10:03 +00:00
|
|
|
try {
|
2009-07-10 04:25:11 +00:00
|
|
|
YAML::Parser parser(input);
|
2009-09-29 18:25:11 +00:00
|
|
|
YAML::Node doc;
|
|
|
|
|
while(parser.GetNextDocument(doc)) {
|
2009-07-10 23:39:14 +00:00
|
|
|
YAML::Emitter emitter;
|
|
|
|
|
emitter << doc;
|
|
|
|
|
std::cout << emitter.c_str() << "\n";
|
2009-07-10 04:25:11 +00:00
|
|
|
}
|
2009-07-10 03:10:03 +00:00
|
|
|
} catch(const YAML::Exception& e) {
|
2009-07-10 04:17:30 +00:00
|
|
|
std::cerr << e.what() << "\n";
|
2009-07-10 03:10:03 +00:00
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|