Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / cmCommandArgumentParserHelper.h
blob3b1dc98a9d5c1cdc1d13eaff79ab55ab430c2aa1
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCommandArgumentParserHelper.h,v $
5 Language: C++
6 <<<<<<< cmCommandArgumentParserHelper.h
7 Date: $Date: 2007/06/06 20:20:02 $
8 Version: $Revision: 1.11 $
9 =======
10 Date: $Date: 2008-09-24 12:51:19 $
11 Version: $Revision: 1.12 $
12 >>>>>>> 1.12
14 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
15 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
17 This software is distributed WITHOUT ANY WARRANTY; without even
18 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 PURPOSE. See the above copyright notices for more information.
21 =========================================================================*/
22 #ifndef cmCommandArgumentParserHelper_h
23 #define cmCommandArgumentParserHelper_h
25 #include "cmStandardIncludes.h"
27 #define YYSTYPE cmCommandArgumentParserHelper::ParserType
28 #define YYSTYPE_IS_DECLARED
29 #define YY_EXTRA_TYPE cmCommandArgumentParserHelper*
30 #define YY_DECL int cmCommandArgument_yylex(YYSTYPE* yylvalp,\
31 yyscan_t yyscanner)
33 /** \class cmCommandArgumentParserHelper
34 * \brief Helper class for parsing java source files
36 * Finds dependencies for java file and list of outputs
39 class cmMakefile;
41 class cmCommandArgumentParserHelper
43 public:
44 typedef struct {
45 char* str;
46 } ParserType;
48 cmCommandArgumentParserHelper();
49 ~cmCommandArgumentParserHelper();
51 int ParseString(const char* str, int verb);
53 // For the lexer:
54 void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt,
55 const char* str, int len = 0);
56 bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt,
57 char symbol);
59 int LexInput(char* buf, int maxlen);
60 void Error(const char* str);
62 // For yacc
63 char* CombineUnions(char* in1, char* in2);
65 char* ExpandSpecialVariable(const char* key, const char* var);
66 char* ExpandVariable(const char* var);
67 char* ExpandVariableForAt(const char* var);
68 void SetResult(const char* value);
70 void SetMakefile(const cmMakefile* mf);
72 std::string& GetResult() { return this->Result; }
74 void SetLineFile(long line, const char* file);
75 void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
76 void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
77 void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
78 void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
80 const char* GetError() { return this->ErrorString.c_str(); }
81 char EmptyVariable[1];
82 char DCURLYVariable[3];
83 char RCURLYVariable[3];
84 char ATVariable[3];
85 char DOLLARVariable[3];
86 char LCURLYVariable[3];
87 char BSLASHVariable[3];
89 private:
90 cmStdString::size_type InputBufferPos;
91 cmStdString InputBuffer;
92 std::vector<char> OutputBuffer;
93 int CurrentLine;
94 int UnionsAvailable;
95 int Verbose;
97 void Print(const char* place, const char* str);
98 void SafePrintMissing(const char* str, int line, int cnt);
100 char* AddString(const char* str);
102 void CleanupParser();
103 void SetError(std::string const& msg);
105 std::vector<char*> Variables;
106 const cmMakefile* Makefile;
107 std::string Result;
108 const char* FileName;
109 long FileLine;
110 bool EscapeQuotes;
111 std::string ErrorString;
112 bool NoEscapeMode;
113 bool ReplaceAtSyntax;
114 bool RemoveEmpty;
117 #endif