cmExprParserHelper.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*============================================================================
  2. CMake - Cross Platform Makefile Generator
  3. Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
  4. Distributed under the OSI-approved BSD License (the "License");
  5. see accompanying file Copyright.txt for details.
  6. This software is distributed WITHOUT ANY WARRANTY; without even the
  7. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  8. See the License for more information.
  9. ============================================================================*/
  10. #ifndef cmExprParserHelper_h
  11. #define cmExprParserHelper_h
  12. #include "cmStandardIncludes.h"
  13. #define YYSTYPE cmExprParserHelper::ParserType
  14. #define YYSTYPE_IS_DECLARED
  15. #define YY_EXTRA_TYPE cmExprParserHelper*
  16. #define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
  17. /** \class cmExprParserHelper
  18. * \brief Helper class for parsing java source files
  19. *
  20. * Finds dependencies for java file and list of outputs
  21. */
  22. class cmMakefile;
  23. class cmExprParserHelper
  24. {
  25. public:
  26. typedef struct {
  27. int Number;
  28. } ParserType;
  29. cmExprParserHelper();
  30. ~cmExprParserHelper();
  31. int ParseString(const char* str, int verb);
  32. int LexInput(char* buf, int maxlen);
  33. void Error(const char* str);
  34. void SetResult(int value);
  35. int GetResult() { return this->Result; }
  36. const char* GetError() { return this->ErrorString.c_str(); }
  37. private:
  38. std::string::size_type InputBufferPos;
  39. std::string InputBuffer;
  40. std::vector<char> OutputBuffer;
  41. int CurrentLine;
  42. int Verbose;
  43. void Print(const char* place, const char* str);
  44. void CleanupParser();
  45. int Result;
  46. const char* FileName;
  47. long FileLine;
  48. std::string ErrorString;
  49. };
  50. #endif