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