Imported Upstream version 2.8.9
[platform/upstream/cmake.git] / Source / cmExprParserHelper.h
1 /*============================================================================
2   CMake - Cross Platform Makefile Generator
3   Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
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 cmExprParserHelper_h 
13 #define cmExprParserHelper_h
14
15 #include "cmStandardIncludes.h"
16
17 #define YYSTYPE cmExprParserHelper::ParserType
18 #define YYSTYPE_IS_DECLARED
19 #define YY_EXTRA_TYPE cmExprParserHelper*
20 #define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
21
22 /** \class cmExprParserHelper
23  * \brief Helper class for parsing java source files
24  *
25  * Finds dependencies for java file and list of outputs
26  */
27
28 class cmMakefile;
29
30 class cmExprParserHelper
31 {
32 public:
33   typedef struct {
34     int Number;
35   } ParserType;
36
37   cmExprParserHelper();
38   ~cmExprParserHelper();
39
40   int ParseString(const char* str, int verb);
41
42   int LexInput(char* buf, int maxlen);
43   void Error(const char* str);
44
45   void SetResult(int value);
46
47   int GetResult() { return this->Result; }
48
49   const char* GetError() { return this->ErrorString.c_str(); }
50
51 private:
52   cmStdString::size_type InputBufferPos;
53   cmStdString InputBuffer;
54   std::vector<char> OutputBuffer;
55   int CurrentLine;
56   int Verbose;
57
58   void Print(const char* place, const char* str);
59
60   void CleanupParser();
61
62   int Result;
63   const char* FileName;
64   long FileLine;
65   std::string ErrorString;
66 };
67
68 #endif
69
70
71