cmake/Source/cmExprParserHelper.h

60 lines
1.3 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2016-10-30 18:24:19 +01:00
#include <string>
#include <vector>
2020-08-30 11:54:41 +02:00
#include <cm3p/kwiml/int.h>
2020-02-01 23:06:01 +01:00
class cmExprParserHelper
{
public:
2017-07-20 19:35:53 +02:00
struct ParserType
2016-07-09 11:21:54 +02:00
{
2018-10-28 12:09:07 +01:00
KWIML_INT_int64_t Number;
2017-07-20 19:35:53 +02:00
};
cmExprParserHelper();
~cmExprParserHelper();
int ParseString(const char* str, int verb);
int LexInput(char* buf, int maxlen);
void Error(const char* str);
2018-10-28 12:09:07 +01:00
void SetResult(KWIML_INT_int64_t value);
2021-09-14 00:13:48 +02:00
KWIML_INT_int64_t GetResult() const { return this->Result; }
const char* GetError() { return this->ErrorString.c_str(); }
2018-10-28 12:09:07 +01:00
void UnexpectedChar(char c);
std::string const& GetWarning() const { return this->WarningString; }
private:
2015-04-27 22:25:09 +02:00
std::string::size_type InputBufferPos;
std::string InputBuffer;
std::vector<char> OutputBuffer;
int CurrentLine;
int Verbose;
void Print(const char* place, const char* str);
2018-10-28 12:09:07 +01:00
void SetError(std::string errorString);
2018-10-28 12:09:07 +01:00
KWIML_INT_int64_t Result;
const char* FileName;
long FileLine;
std::string ErrorString;
2018-10-28 12:09:07 +01:00
std::string WarningString;
};
2017-07-20 19:35:53 +02:00
#define YYSTYPE cmExprParserHelper::ParserType
#define YYSTYPE_IS_DECLARED
#define YY_EXTRA_TYPE cmExprParserHelper*
#define YY_DECL int cmExpr_yylex(YYSTYPE* yylvalp, yyscan_t yyscanner)