1 /*=========================================================================
3 Program: CMake - Cross-Platform Makefile Generator
4 Module: $RCSfile: cmDependsJavaParserHelper.h,v $
6 Date: $Date: 2006-05-10 19:01:22 $
7 Version: $Revision: 1.3 $
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 cmDependsJavaParserHelper_h
18 #define cmDependsJavaParserHelper_h
20 #include "cmStandardIncludes.h"
22 #define YYSTYPE cmDependsJavaParserHelper::ParserType
23 #define YYSTYPE_IS_DECLARED
24 #define YY_EXTRA_TYPE cmDependsJavaParserHelper*
25 #define YY_DECL int cmDependsJava_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
27 /** \class cmDependsJavaParserHelper
28 * \brief Helper class for parsing java source files
30 * Finds dependencies for java file and list of outputs
33 class cmDependsJavaParserHelper
40 cmDependsJavaParserHelper();
41 ~cmDependsJavaParserHelper();
43 int ParseString(const char* str
, int verb
);
44 int ParseFile(const char* file
);
47 void AllocateParserType(cmDependsJavaParserHelper::ParserType
* pt
,
48 const char* str
, int len
= 0);
50 int LexInput(char* buf
, int maxlen
);
51 void Error(const char* str
);
54 void AddClassFound(const char* sclass
);
55 void PrepareElement(ParserType
* opt
);
56 void DeallocateParserType(char** pt
);
57 void CheckEmpty(int line
, int cnt
, ParserType
* pt
);
58 void StartClass(const char* cls
);
60 void AddPackagesImport(const char* sclass
);
61 void SetCurrentPackage(const char* pkg
) { this->CurrentPackage
= pkg
; }
62 const char* GetCurrentPackage() { return this->CurrentPackage
.c_str(); }
63 void SetCurrentCombine(const char* cmb
) { this->CurrentCombine
= cmb
; }
64 const char* GetCurrentCombine() { return this->CurrentCombine
.c_str(); }
65 void UpdateCombine(const char* str1
, const char* str2
);
67 std::vector
<cmStdString
>& GetClassesFound() { return this->ClassesFound
; }
69 std::vector
<cmStdString
> GetFilesProduced();
76 std::vector
<CurrentClass
> NestedClasses
;
78 void AddFileNamesForPrinting(std::vector
<cmStdString
> *files
,
79 const char* prefix
, const char* sep
);
81 cmStdString CurrentPackage
;
82 cmStdString::size_type InputBufferPos
;
83 cmStdString InputBuffer
;
84 std::vector
<char> OutputBuffer
;
85 std::vector
<cmStdString
> ClassesFound
;
86 std::vector
<cmStdString
> PackagesImport
;
87 cmStdString CurrentCombine
;
89 std::vector
<CurrentClass
> ClassStack
;
97 std::vector
<char*> Allocates
;
101 void Print(const char* place
, const char* str
);
102 void CombineUnions(char** out
, const char* in1
, char** in2
,
104 void SafePrintMissing(const char* str
, int line
, int cnt
);
106 void CleanupParser();