Clarify documentation for if.
[cmake.git] / Source / cmCommandArgumentParserHelper.h
blobc071185778ed31952c2576781c16fb902afd7dbd
1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmCommandArgumentParserHelper.h,v $
5 Language: C++
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,\
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();
98 void SetError(std::string const& msg);
100 std::vector<char*> Variables;
101 const cmMakefile* Makefile;
102 std::string Result;
103 const char* FileName;
104 long FileLine;
105 bool EscapeQuotes;
106 std::string ErrorString;
107 bool NoEscapeMode;
108 bool ReplaceAtSyntax;
109 bool RemoveEmpty;
112 #endif