forked from boostorg/regex
Remove limit on the number of backrefs possible.
Changes named sub-expressions to use different hashing scheme: high order bit is now always set to clashes between hashes and indexes don't happen until 2^30 or 2^62 sub-expressions in 32 and 64 bit code respectively. Changes bitmask of seen sub-expressions to use dynamic storage for sub-expression indexes above 64. Adds tests for the above. Fixes https://github.com/boostorg/regex/issues/75.
This commit is contained in:
@ -70,13 +70,14 @@ void bubble_down_one(I first, I last)
|
||||
}
|
||||
}
|
||||
|
||||
static const int hash_value_mask = 1 << (std::numeric_limits<int>::digits - 1);
|
||||
|
||||
template <class Iterator>
|
||||
inline int hash_value_from_capture_name(Iterator i, Iterator j)
|
||||
{
|
||||
std::size_t r = boost::hash_range(i, j);
|
||||
r %= ((std::numeric_limits<int>::max)() - 10001);
|
||||
r += 10000;
|
||||
return static_cast<int>(r);
|
||||
r %= ((std::numeric_limits<int>::max)());
|
||||
return static_cast<int>(r) | hash_value_mask;
|
||||
}
|
||||
|
||||
class named_subexpressions
|
||||
|
Reference in New Issue
Block a user