cmExprParserHelper.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. #include <cm3p/kwiml/int.h>
  9. class cmExprParserHelper
  10. {
  11. public:
  12. struct ParserType
  13. {
  14. KWIML_INT_int64_t Number;
  15. };
  16. cmExprParserHelper();
  17. ~cmExprParserHelper();
  18. int ParseString(const char* str, int verb);
  19. int LexInput(char* buf, int maxlen);
  20. void Error(const char* str);
  21. void SetResult(KWIML_INT_int64_t value);
  22. KWIML_INT_int64_t GetResult() { return this->Result; }
  23. const char* GetError() { return this->ErrorString.c_str(); }
  24. void UnexpectedChar(char c);
  25. std::string const& GetWarning() const { return this->WarningString; }
  26. private:
  27. std::string::size_type InputBufferPos;
  28. std::string InputBuffer;
  29. std::vector<char> OutputBuffer;
  30. int CurrentLine;
  31. int Verbose;
  32. void Print(const char* place, const char* str);
  33. void SetError(std::string errorString);
  34. KWIML_INT_int64_t Result;
  35. const char* FileName;
  36. long FileLine;
  37. std::string ErrorString;
  38. std::string WarningString;
  39. };
  40. #define YYSTYPE cmExprParserHelper::ParserType
  41. #define YYSTYPE_IS_DECLARED
  42. #define YY_EXTRA_TYPE cmExprParserHelper*
  43. #define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)
  44. #endif