cmGeneratorExpressionLexer.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 cmGeneratorExpressionLexer_h
  4. #define cmGeneratorExpressionLexer_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <stddef.h>
  7. #include <string>
  8. #include <vector>
  9. struct cmGeneratorExpressionToken
  10. {
  11. cmGeneratorExpressionToken(unsigned type, const char* c, size_t l)
  12. : TokenType(type)
  13. , Content(c)
  14. , Length(l)
  15. {
  16. }
  17. enum
  18. {
  19. Text,
  20. BeginExpression,
  21. EndExpression,
  22. ColonSeparator,
  23. CommaSeparator
  24. };
  25. unsigned TokenType;
  26. const char* Content;
  27. size_t Length;
  28. };
  29. /** \class cmGeneratorExpressionLexer
  30. *
  31. */
  32. class cmGeneratorExpressionLexer
  33. {
  34. public:
  35. cmGeneratorExpressionLexer();
  36. std::vector<cmGeneratorExpressionToken> Tokenize(const std::string& input);
  37. bool GetSawGeneratorExpression() const
  38. {
  39. return this->SawGeneratorExpression;
  40. }
  41. private:
  42. bool SawBeginExpression;
  43. bool SawGeneratorExpression;
  44. };
  45. #endif