1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCommandArgumentParserHelper.h,v $
6 <<<<<<< cmCommandArgumentParserHelper.h
7 Date: $Date: 2007/06/06 20:20:02 $
8 Version: $Revision: 1.11 $
10 Date: $Date: 2008-09-24 12:51:19 $
11 Version: $Revision: 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,\
33 /** \class cmCommandArgumentParserHelper
34 * \brief Helper class for parsing java source files
36 * Finds dependencies for java file and list of outputs
41 class cmCommandArgumentParserHelper
48 cmCommandArgumentParserHelper();
49 ~cmCommandArgumentParserHelper();
51 int ParseString(const char* str
, int verb
);
54 void AllocateParserType(cmCommandArgumentParserHelper::ParserType
* pt
,
55 const char* str
, int len
= 0);
56 bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType
* pt
,
59 int LexInput(char* buf
, int maxlen
);
60 void Error(const char* str
);
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];
85 char DOLLARVariable
[3];
86 char LCURLYVariable
[3];
87 char BSLASHVariable
[3];
90 cmStdString::size_type InputBufferPos
;
91 cmStdString InputBuffer
;
92 std::vector
<char> OutputBuffer
;
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
;
108 const char* FileName
;
111 std::string ErrorString
;
113 bool ReplaceAtSyntax
;