cmGccDepfileLexerHelper.h 806 B

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