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