Skip to content

Commit d2f6aff

Browse files
committed
refactor: change character type from char to unsigned char in Token methods for consistency
1 parent a04dd1b commit d2f6aff

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

cucumber_cpp/library/cucumber_expression/Ast.cpp

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ namespace cucumber_cpp::library::cucumber_expression
2323

2424
return demarcationMap;
2525
}
26-
27-
const std::map<TokenType, std::string>& TokenTypeMap()
28-
{
29-
static const std::map<TokenType, std::string> tokenTypeMap = {
30-
{ TokenType::alternation, "alternation" },
31-
{ TokenType::beginParameter, "beginParameter" },
32-
{ TokenType::endParameter, "endParameter" },
33-
{ TokenType::beginOptional, "beginOptional" },
34-
{ TokenType::endOptional, "endOptional" },
35-
};
36-
return tokenTypeMap;
37-
}
3826
}
3927

4028
std::string Node::Text()
@@ -68,12 +56,12 @@ namespace cucumber_cpp::library::cucumber_expression
6856
return std::get<std::vector<Node>>(children);
6957
}
7058

71-
bool Token::IsEscapeCharacter(char ch)
59+
bool Token::IsEscapeCharacter(unsigned char ch)
7260
{
7361
return ch == '\\';
7462
}
7563

76-
TokenType Token::TypeOf(char ch)
64+
TokenType Token::TypeOf(unsigned char ch)
7765
{
7866
if (std::isspace(ch) != 0)
7967
return TokenType::whiteSpace;
@@ -84,7 +72,7 @@ namespace cucumber_cpp::library::cucumber_expression
8472
return TokenType::text;
8573
}
8674

87-
bool Token::CanEscape(char ch)
75+
bool Token::CanEscape(unsigned char ch)
8876
{
8977
if (std::isspace(ch) != 0)
9078
return true;

cucumber_cpp/library/cucumber_expression/Ast.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ namespace cucumber_cpp::library::cucumber_expression
5757

5858
bool operator==(const Token& other) const = default;
5959

60-
static bool IsEscapeCharacter(char ch);
61-
static TokenType TypeOf(char ch);
62-
static bool CanEscape(char ch);
60+
static bool IsEscapeCharacter(unsigned char ch);
61+
static TokenType TypeOf(unsigned char ch);
62+
static bool CanEscape(unsigned char ch);
6363
static std::string NameOf(TokenType type);
6464
static std::string SymbolOf(TokenType type);
6565
static std::string PurposeOf(TokenType type);

0 commit comments

Comments
 (0)