yaml-cpp/util/parse.cpp

23 lines
397 B
C++
Raw Normal View History

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