aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/script/regex.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/script/regex.hxx')
-rw-r--r--libbuild2/script/regex.hxx35
1 files changed, 20 insertions, 15 deletions
diff --git a/libbuild2/script/regex.hxx b/libbuild2/script/regex.hxx
index 6d2c5c6..3c49b31 100644
--- a/libbuild2/script/regex.hxx
+++ b/libbuild2/script/regex.hxx
@@ -9,7 +9,6 @@
#include <locale>
#include <string> // basic_string
#include <type_traits> // make_unsigned, enable_if, is_*
-#include <unordered_set>
#include <libbuild2/types.hxx>
#include <libbuild2/utility.hxx>
@@ -25,10 +24,10 @@ namespace build2
enum class char_flags: uint16_t
{
icase = 0x1, // Case-insensitive match.
- idot = 0x2, // Invert '.' escaping.
+ idot = 0x2, // Invert '.' escaping.
- none = 0
- };
+ none = 0
+ };
// Restricts valid standard flags to just {icase}, extends with custom
// flags {idot}.
@@ -59,16 +58,21 @@ namespace build2
// Note that we assume the pool can be moved without invalidating
// pointers to any already pooled entities.
//
- std::unordered_set<char_string> strings;
+ // Note that we used to use unordered_set for strings but (1) there is
+ // no general expectation that we will have many identical strings and
+ // (2) the number of strings is not expected to be large. So that felt
+ // like an overkill and we now use a list with linear search.
+ //
+ std::list<char_string> strings;
std::list<char_regex> regexes;
};
enum class line_type
{
special,
- literal,
- regex
- };
+ literal,
+ regex
+ };
struct line_char
{
@@ -267,8 +271,8 @@ namespace build2
template <typename T>
struct line_char_cmp
: public std::enable_if<std::is_integral<T>::value ||
- (std::is_enum<T>::value &&
- !std::is_same<T, char_flags>::value)> {};
+ (std::is_enum<T>::value &&
+ !std::is_same<T, char_flags>::value)> {};
template <typename T, typename = typename line_char_cmp<T>::type>
bool
@@ -466,10 +470,10 @@ namespace std
is (mask m, char_type c) const
{
return m ==
- (c.type () == line_type::special && c.special () >= 0 &&
- build2::digit (static_cast<char> (c.special ()))
- ? digit
- : 0);
+ (c.type () == line_type::special && c.special () >= 0 &&
+ build2::digit (static_cast<char> (c.special ()))
+ ? digit
+ : 0);
}
const char_type*
@@ -625,7 +629,8 @@ namespace std
// specialize the class template to behave as the __match_any<line_char>
// instantiation does (that luckily has all the functions in place).
//
-#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 10000
+//#if defined(_LIBCPP_VERSION) && _LIBCPP_VERSION <= 11000
+#ifdef _LIBCPP_VERSION
template <>
class __match_any_but_newline<build2::script::regex::line_char>
: public __match_any<build2::script::regex::line_char>