parser.h 719 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. // Copyright (c) 2013-2014, Alberto Corona <alberto@0x1a.us>
  2. // All rights reserved. This file is part of yabs, distributed under the BSD
  3. // 3-Clause license. For full terms please see the LICENSE file.
  4. #ifndef _PARSER_H
  5. #define _PARSER_H
  6. #include <yaml.h>
  7. #include "profile.h"
  8. class Parser : public Profile
  9. {
  10. private:
  11. enum spec {
  12. error = 0,
  13. key,
  14. value,
  15. block_entry,
  16. } prs;
  17. spec token_return;
  18. FILE *conf;
  19. int valid;
  20. std::string key_value;
  21. yaml_parser_t parser;
  22. yaml_token_t token;
  23. public:
  24. Parser();
  25. ~Parser();
  26. int AssertYML(const char *build_file);
  27. int ParseConfig();
  28. int OpenConfig(const char *build_file);
  29. int CloseConfig();
  30. const char *ReadValues();
  31. const char *ParseValues();
  32. };
  33. #endif