Skip to content

Commit

Permalink
fix[json5]: unicode::isHexDigit and unicode::isDigit match as `ch…
Browse files Browse the repository at this point in the history
…ar` type
  • Loading branch information
ChingCdesu committed May 15, 2024
1 parent db365b1 commit bf04d25
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions include/parser5/parser5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <cctype>
#include <cmath>
#include <iomanip>
#include <regex>
#include <sstream>
#include <stack>
#include <vector>
Expand Down Expand Up @@ -303,15 +302,13 @@ inline bool parser5<string_t>::unicode::isIdContinueChar(u8char ch)
template <typename string_t>
inline bool parser5<string_t>::unicode::isDigit(u8char ch)
{
auto str = StringFromCharCode(ch);
return std::regex_search(str, std::regex(R"([0-9])"));
return (ch >= '0' && ch <= '9');
}

template <typename string_t>
inline bool parser5<string_t>::unicode::isHexDigit(u8char ch)
{
auto str = StringFromCharCode(ch);
return std::regex_search(str, std::regex(R"([0-9A-Fa-f])"));
return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || (ch >= '0' && ch <= '9');
}

template <typename string_t>
Expand Down

0 comments on commit bf04d25

Please sign in to comment.