1 /*============================================================================
2 CMake - Cross Platform Makefile Generator
3 Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
5 Distributed under the OSI-approved BSD License (the "License");
6 see accompanying file Copyright.txt for details.
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 cmCommandArgumentParserHelper_h
13 #define cmCommandArgumentParserHelper_h
15 #include "cmStandardIncludes.h"
17 #define YYSTYPE cmCommandArgumentParserHelper::ParserType
18 #define YYSTYPE_IS_DECLARED
19 #define YY_EXTRA_TYPE cmCommandArgumentParserHelper*
20 #define YY_DECL int cmCommandArgument_yylex(YYSTYPE* yylvalp,\
23 /** \class cmCommandArgumentParserHelper
24 * \brief Helper class for parsing java source files
26 * Finds dependencies for java file and list of outputs
31 class cmCommandArgumentParserHelper
38 cmCommandArgumentParserHelper();
39 ~cmCommandArgumentParserHelper();
41 int ParseString(const char* str, int verb);
44 void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt,
45 const char* str, int len = 0);
46 bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt,
49 int LexInput(char* buf, int maxlen);
50 void Error(const char* str);
53 char* CombineUnions(char* in1, char* in2);
55 char* ExpandSpecialVariable(const char* key, const char* var);
56 char* ExpandVariable(const char* var);
57 char* ExpandVariableForAt(const char* var);
58 void SetResult(const char* value);
60 void SetMakefile(const cmMakefile* mf);
62 std::string& GetResult() { return this->Result; }
64 void SetLineFile(long line, const char* file);
65 void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
66 void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
67 void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
68 void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
70 const char* GetError() { return this->ErrorString.c_str(); }
71 char EmptyVariable[1];
72 char DCURLYVariable[3];
73 char RCURLYVariable[3];
75 char DOLLARVariable[3];
76 char LCURLYVariable[3];
77 char BSLASHVariable[3];
80 cmStdString::size_type InputBufferPos;
81 cmStdString InputBuffer;
82 std::vector<char> OutputBuffer;
86 void Print(const char* place, const char* str);
87 void SafePrintMissing(const char* str, int line, int cnt);
89 char* AddString(const char* str);
92 void SetError(std::string const& msg);
94 std::vector<char*> Variables;
95 const cmMakefile* Makefile;
98 bool WarnUninitialized;
102 std::string ErrorString;
104 bool ReplaceAtSyntax;