cmGccDepfileLexerHelper.h 856 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmGccDepfileLexerHelper_h
  4. #define cmGccDepfileLexerHelper_h
  5. #include <utility>
  6. #include <cmGccDepfileReaderTypes.h>
  7. class cmGccDepfileLexerHelper
  8. {
  9. public:
  10. cmGccDepfileLexerHelper() = default;
  11. bool readFile(const char* filePath);
  12. cmGccDepfileContent extractContent() && { return std::move(this->Content); }
  13. // Functions called by the lexer
  14. void newEntry();
  15. void newRule();
  16. void newDependency();
  17. void newRuleOrDependency();
  18. void addToCurrentPath(const char* s);
  19. private:
  20. void sanitizeContent();
  21. cmGccDepfileContent Content;
  22. enum class State
  23. {
  24. Rule,
  25. Dependency
  26. };
  27. State HelperState = State::Rule;
  28. };
  29. #define YY_EXTRA_TYPE cmGccDepfileLexerHelper*
  30. #endif