cmExprParserHelper.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmExprParserHelper_h
  4. #define cmExprParserHelper_h
  5. #include <cmConfigure.h> // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #define YYSTYPE cmExprParserHelper::ParserType
  9. #define YYSTYPE_IS_DECLARED
  10. #define YY_EXTRA_TYPE cmExprParserHelper*
  11. #define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
  12. /** \class cmExprParserHelper
  13. * \brief Helper class for parsing java source files
  14. *
  15. * Finds dependencies for java file and list of outputs
  16. */
  17. class cmExprParserHelper
  18. {
  19. public:
  20. typedef struct
  21. {
  22. int Number;
  23. } ParserType;
  24. cmExprParserHelper();
  25. ~cmExprParserHelper();
  26. int ParseString(const char* str, int verb);
  27. int LexInput(char* buf, int maxlen);
  28. void Error(const char* str);
  29. void SetResult(int value);
  30. int GetResult() { return this->Result; }
  31. const char* GetError() { return this->ErrorString.c_str(); }
  32. private:
  33. std::string::size_type InputBufferPos;
  34. std::string InputBuffer;
  35. std::vector<char> OutputBuffer;
  36. int CurrentLine;
  37. int Verbose;
  38. void Print(const char* place, const char* str);
  39. void CleanupParser();
  40. int Result;
  41. const char* FileName;
  42. long FileLine;
  43. std::string ErrorString;
  44. };
  45. #endif