cmGeneratorExpressionLexer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2012 Stephen Kelly <[email protected]>
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmGeneratorExpressionLexer_h
  11. #define cmGeneratorExpressionLexer_h
  12. #include <cmConfigure.h> // IWYU pragma: keep
  13. #include <stddef.h>
  14. #include <string>
  15. #include <vector>
  16. struct cmGeneratorExpressionToken
  17. {
  18. cmGeneratorExpressionToken(unsigned type, const char* c, size_t l)
  19. : TokenType(type)
  20. , Content(c)
  21. , Length(l)
  22. {
  23. }
  24. enum
  25. {
  26. Text,
  27. BeginExpression,
  28. EndExpression,
  29. ColonSeparator,
  30. CommaSeparator
  31. };
  32. unsigned TokenType;
  33. const char* Content;
  34. size_t Length;
  35. };
  36. /** \class cmGeneratorExpressionLexer
  37. *
  38. */
  39. class cmGeneratorExpressionLexer
  40. {
  41. public:
  42. cmGeneratorExpressionLexer();
  43. std::vector<cmGeneratorExpressionToken> Tokenize(const std::string& input);
  44. bool GetSawGeneratorExpression() const
  45. {
  46. return this->SawGeneratorExpression;
  47. }
  48. private:
  49. bool SawBeginExpression;
  50. bool SawGeneratorExpression;
  51. };
  52. #endif