1
0

cmCommandArgumentParserHelper.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*=========================================================================
  2. Program: CMake - Cross-Platform Makefile Generator
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  8. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  9. This software is distributed WITHOUT ANY WARRANTY; without even
  10. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  11. PURPOSE. See the above copyright notices for more information.
  12. =========================================================================*/
  13. #ifndef cmCommandArgumentParserHelper_h
  14. #define cmCommandArgumentParserHelper_h
  15. #include "cmStandardIncludes.h"
  16. #define YYSTYPE cmCommandArgumentParserHelper::ParserType
  17. #define YYSTYPE_IS_DECLARED
  18. #define YY_EXTRA_TYPE cmCommandArgumentParserHelper*
  19. #define YY_DECL int cmCommandArgument_yylex(YYSTYPE* yylvalp,\
  20. yyscan_t yyscanner)
  21. /** \class cmCommandArgumentParserHelper
  22. * \brief Helper class for parsing java source files
  23. *
  24. * Finds dependencies for java file and list of outputs
  25. */
  26. class cmMakefile;
  27. class cmCommandArgumentParserHelper
  28. {
  29. public:
  30. typedef struct {
  31. char* str;
  32. } ParserType;
  33. cmCommandArgumentParserHelper();
  34. ~cmCommandArgumentParserHelper();
  35. int ParseString(const char* str, int verb);
  36. // For the lexer:
  37. void AllocateParserType(cmCommandArgumentParserHelper::ParserType* pt,
  38. const char* str, int len = 0);
  39. bool HandleEscapeSymbol(cmCommandArgumentParserHelper::ParserType* pt,
  40. char symbol);
  41. int LexInput(char* buf, int maxlen);
  42. void Error(const char* str);
  43. // For yacc
  44. char* CombineUnions(char* in1, char* in2);
  45. char* ExpandSpecialVariable(const char* key, const char* var);
  46. char* ExpandVariable(const char* var);
  47. char* ExpandVariableForAt(const char* var);
  48. void SetResult(const char* value);
  49. void SetMakefile(const cmMakefile* mf);
  50. std::string& GetResult() { return this->Result; }
  51. void SetLineFile(long line, const char* file);
  52. void SetEscapeQuotes(bool b) { this->EscapeQuotes = b; }
  53. void SetNoEscapeMode(bool b) { this->NoEscapeMode = b; }
  54. void SetReplaceAtSyntax(bool b) { this->ReplaceAtSyntax = b; }
  55. void SetRemoveEmpty(bool b) { this->RemoveEmpty = b; }
  56. const char* GetError() { return this->ErrorString.c_str(); }
  57. char EmptyVariable[1];
  58. char DCURLYVariable[3];
  59. char RCURLYVariable[3];
  60. char ATVariable[3];
  61. char DOLLARVariable[3];
  62. char LCURLYVariable[3];
  63. char BSLASHVariable[3];
  64. private:
  65. cmStdString::size_type InputBufferPos;
  66. cmStdString InputBuffer;
  67. std::vector<char> OutputBuffer;
  68. int CurrentLine;
  69. int UnionsAvailable;
  70. int Verbose;
  71. void Print(const char* place, const char* str);
  72. void SafePrintMissing(const char* str, int line, int cnt);
  73. char* AddString(const char* str);
  74. void CleanupParser();
  75. std::vector<char*> Variables;
  76. const cmMakefile* Makefile;
  77. std::string Result;
  78. const char* FileName;
  79. long FileLine;
  80. bool EscapeQuotes;
  81. std::string ErrorString;
  82. bool NoEscapeMode;
  83. bool ReplaceAtSyntax;
  84. bool RemoveEmpty;
  85. };
  86. #endif