diff --git a/test/core/parsertests.cpp b/test/core/parsertests.cpp index 05f7358..1ff922c 100644 --- a/test/core/parsertests.cpp +++ b/test/core/parsertests.cpp @@ -29,7 +29,7 @@ namespace Test } if(!ret.ok) { - std::cout << "Spec test " << index << " failed: " << name << "\n"; + std::cout << "Parser test failed: " << name << "\n"; std::cout << ret.error << "\n"; } diff --git a/util/CMakeLists.txt b/util/CMakeLists.txt index 1e2f59e..28a3603 100644 --- a/util/CMakeLists.txt +++ b/util/CMakeLists.txt @@ -3,3 +3,6 @@ target_link_libraries(parse yaml-cpp) add_executable(sandbox sandbox.cpp) target_link_libraries(sandbox yaml-cpp) + +add_executable(read read.cpp) +target_link_libraries(read yaml-cpp) diff --git a/util/read.cpp b/util/read.cpp new file mode 100644 index 0000000..f82cb7e --- /dev/null +++ b/util/read.cpp @@ -0,0 +1,30 @@ +#include "yaml-cpp/yaml.h" +#include "yaml-cpp/eventhandler.h" +#include + +class NullEventHandler: public YAML::EventHandler +{ +public: + typedef YAML::Mark Mark; + typedef YAML::anchor_t anchor_t; + + NullEventHandler() {} + + virtual void OnDocumentStart(const Mark&) {} + virtual void OnDocumentEnd() {} + virtual void OnNull(const Mark&, anchor_t) {} + virtual void OnAlias(const Mark&, anchor_t) {} + virtual void OnScalar(const Mark&, const std::string&, anchor_t, const std::string&) {} + virtual void OnSequenceStart(const Mark&, const std::string&, anchor_t) {} + virtual void OnSequenceEnd() {} + virtual void OnMapStart(const Mark&, const std::string&, anchor_t) {} + virtual void OnMapEnd() {} +}; + +int main() +{ + YAML::Parser parser(std::cin); + NullEventHandler handler; + parser.HandleNextDocument(handler); + return 0; +}