cmGeneratorExpressionLexer.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 "cmStandardIncludes.h"
  13. #include <vector>
  14. //----------------------------------------------------------------------------
  15. struct cmGeneratorExpressionToken
  16. {
  17. cmGeneratorExpressionToken(unsigned type, const char *c, unsigned l)
  18. : TokenType(type), Content(c), Length(l)
  19. {
  20. }
  21. enum {
  22. Text,
  23. BeginExpression,
  24. EndExpression,
  25. ColonSeparator,
  26. CommaSeparator
  27. };
  28. unsigned TokenType;
  29. const char *Content;
  30. unsigned Length;
  31. };
  32. /** \class cmGeneratorExpressionLexer
  33. *
  34. */
  35. class cmGeneratorExpressionLexer
  36. {
  37. public:
  38. cmGeneratorExpressionLexer();
  39. std::vector<cmGeneratorExpressionToken> Tokenize(const char *input);
  40. bool GetSawGeneratorExpression() const
  41. {
  42. return this->SawGeneratorExpression;
  43. }
  44. private:
  45. bool SawBeginExpression;
  46. bool SawGeneratorExpression;
  47. };
  48. #endif