cmake/Source/cmGeneratorExpressionLexer.h

51 lines
981 B
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
2013-03-16 19:13:01 +02:00
2017-07-20 19:35:53 +02:00
#include "cmConfigure.h" // IWYU pragma: keep
2013-03-16 19:13:01 +02:00
2020-02-01 23:06:01 +01:00
#include <cstddef>
2016-10-30 18:24:19 +01:00
#include <string>
2013-03-16 19:13:01 +02:00
#include <vector>
struct cmGeneratorExpressionToken
{
2016-07-09 11:21:54 +02:00
cmGeneratorExpressionToken(unsigned type, const char* c, size_t l)
: TokenType(type)
, Content(c)
, Length(l)
2013-03-16 19:13:01 +02:00
{
}
2016-07-09 11:21:54 +02:00
enum
{
2013-03-16 19:13:01 +02:00
Text,
BeginExpression,
EndExpression,
ColonSeparator,
CommaSeparator
};
unsigned TokenType;
2016-07-09 11:21:54 +02:00
const char* Content;
2014-08-03 19:52:23 +02:00
size_t Length;
2013-03-16 19:13:01 +02:00
};
/** \class cmGeneratorExpressionLexer
*
*/
class cmGeneratorExpressionLexer
{
public:
cmGeneratorExpressionLexer();
2015-04-27 22:25:09 +02:00
std::vector<cmGeneratorExpressionToken> Tokenize(const std::string& input);
2013-03-16 19:13:01 +02:00
bool GetSawGeneratorExpression() const
{
return this->SawGeneratorExpression;
}
private:
2019-11-11 23:01:05 +01:00
bool SawBeginExpression = false;
bool SawGeneratorExpression = false;
2013-03-16 19:13:01 +02:00
};