Skip to content

Commit aca54a4

Browse files
committed
compile time tokens
1 parent e55fbe5 commit aca54a4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cucumber_cpp/library/tag_expression/Token.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace cucumber_cpp::library::tag_expression
3333

3434
struct Token
3535
{
36-
constexpr Token(std::string keyword, std::int32_t precedence, std::optional<Associative> associative, TokenType type = TokenType::operand)
36+
constexpr Token(std::string_view keyword, std::int32_t precedence, std::optional<Associative> associative, TokenType type = TokenType::operand)
3737
: keyword{ std::move(keyword) }
3838
, precedence{ precedence }
3939
, associative{ associative }
@@ -47,17 +47,17 @@ namespace cucumber_cpp::library::tag_expression
4747

4848
bool operator==(const Token& other) const = default;
4949

50-
std::string keyword;
50+
std::string_view keyword;
5151
std::int32_t precedence;
5252
std::optional<Associative> associative;
5353
TokenType type;
5454
};
5555

56-
inline const Token OR{ "or", 0, Associative::left, TokenType::operator_ };
57-
inline const Token AND{ "and", 1, Associative::left, TokenType::operator_ };
58-
inline const Token NOT{ "not", 2, Associative::right, TokenType::operator_ };
59-
inline const Token OPEN_PARENTHESIS{ "(", -2, std::nullopt };
60-
inline const Token CLOSE_PARENTHESIS{ ")", -1, std::nullopt };
56+
static constexpr Token OR{ "or", 0, Associative::left, TokenType::operator_ };
57+
static constexpr Token AND{ "and", 1, Associative::left, TokenType::operator_ };
58+
static constexpr Token NOT{ "not", 2, Associative::right, TokenType::operator_ };
59+
static constexpr Token OPEN_PARENTHESIS{ "(", -2, std::nullopt };
60+
static constexpr Token CLOSE_PARENTHESIS{ ")", -1, std::nullopt };
6161

6262
inline const std::map<std::string_view, const Token&>& TokenMap()
6363
{

0 commit comments

Comments
 (0)