Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: davidlion <[email protected]>
  • Loading branch information
Bill-hbrhbr and davidlion authored Jul 24, 2024
1 parent 60da06a commit 9841553
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
11 changes: 6 additions & 5 deletions components/core/src/clp/regex_utils/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ constexpr char cEscapeChar{'\\'};
constexpr char cCharsetNegate{'^'};

// Character bitmaps
// The set of characters that can be preceded with an escape backslash. When escaped, these
// characters are used as literals.
constexpr auto cRegexEscapeSeqMetaCharsLUT = create_char_bit_array("*+?|^$.{}[]()<>-_/=!\\");
// The set of metacharacters that need to be escaped in the wildcard syntax.
constexpr auto cWildcardMetaCharsLUT = create_char_bit_array("?*\\");
// The set of regex metacharacters that can be preceded with an escape backslash to be treated as a
// literal.
constexpr auto cRegexEscapeSeqMetaCharsLut = create_char_bit_array("*+?|^$.{}[]()<>-_/=!\\");
// The set of wildcard metacharacters that must remain escaped in the translated string to be
// treated as a literal.
constexpr auto cWildcardMetaCharsLut = create_char_bit_array("?*\\");
} // namespace clp::regex_utils

#endif // CLP_REGEX_UTILS_CONSTANTS_HPP
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ auto escaped_state_transition(
[[maybe_unused]] RegexToWildcardTranslatorConfig const& config
) -> error_code {
auto const ch{*it};
if (false == cRegexEscapeSeqMetaCharsLUT.at(ch)) {
if (false == cRegexEscapeSeqMetaCharsLut.at(ch)) {
return ErrorCode::IllegalEscapeSequence;
}
if (cWildcardMetaCharsLUT.at(ch)) {
if (cWildcardMetaCharsLut.at(ch)) {
wildcard_str = wildcard_str + cEscapeChar + ch;
} else {
wildcard_str += ch;
Expand Down

0 comments on commit 9841553

Please sign in to comment.