1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCommandArgumentParserHelper.h,v $
6 Date: $Date: 2008-09-24 12:51:19 $
7 Version: $Revision: 1.12 $
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,\
28 /** \class cmCommandArgumentParserHelper
29 * \brief Helper class for parsing java source files
31 * Finds dependencies for java file and list of outputs
36 class cmCommandArgumentParserHelper
43 cmCommandArgumentParserHelper();
44 ~cmCommandArgumentParserHelper();
46 int ParseString(const char* str
, int verb
);
49 void AllocateParserType(cmCommandArgumentParserHelper::ParserType
* pt
,
50 const char* str
, int len
= 0);
51 bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType
* pt
,
54 int LexInput(char* buf
, int maxlen
);
55 void Error(const char* str
);
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];
80 char DOLLARVariable
[3];
81 char LCURLYVariable
[3];
82 char BSLASHVariable
[3];
85 cmStdString::size_type InputBufferPos
;
86 cmStdString InputBuffer
;
87 std::vector
<char> OutputBuffer
;
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
);
98 void SetError(std::string
const& msg
);
100 std::vector
<char*> Variables
;
101 const cmMakefile
* Makefile
;
103 const char* FileName
;
106 std::string ErrorString
;
108 bool ReplaceAtSyntax
;