aboutsummaryrefslogtreecommitdiff
path: root/build2/test/script/regex
diff options
context:
space:
mode:
Diffstat (limited to 'build2/test/script/regex')
-rw-r--r--build2/test/script/regex36
1 files changed, 22 insertions, 14 deletions
diff --git a/build2/test/script/regex b/build2/test/script/regex
index cfc6031..ae31f59 100644
--- a/build2/test/script/regex
+++ b/build2/test/script/regex
@@ -24,6 +24,7 @@ namespace build2
{
using char_string = std::basic_string<char>;
using char_regex = std::basic_regex<char>;
+ using char_flags = char_regex::flag_type;
// Newlines are line separators and are not part of the line:
//
@@ -50,9 +51,9 @@ namespace build2
enum class line_type
{
special,
- literal,
- regex
- };
+ literal,
+ regex
+ };
struct line_char
{
@@ -127,6 +128,11 @@ namespace build2
return type == line_type::special ? special : '\a'; // BELL.
}
+ // Return true if the character is a syntax (special) one.
+ //
+ static bool
+ syntax (char);
+
// Provide basic_regex (such as from msvcrt) with the ability to
// explicitly cast line_chars to implementation-specific enums.
//
@@ -553,10 +559,10 @@ namespace std
// When used with libc++ the linker complains that it can't find
// __match_any_but_newline<line_char>::__exec() function. The problem is
- // that the function is only specialized for char and wchar_t. As line_char
- // has no notion of the newline character we specialize the class template
- // to behave as the __match_any<line_char> instantiation does (that luckily
- // has all the functions in place).
+ // that the function is only specialized for char and wchar_t
+ // (LLVM bug #31409). As line_char has no notion of the newline character we
+ // 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 <= 4000
template <>
@@ -587,11 +593,6 @@ namespace build2
line_regex () = default;
- // Move constuctible-only type.
- //
- line_regex (line_regex&&) = default;
- line_regex (const line_regex&) = delete;
-
// Move string regex together with the pool used to create it.
//
line_regex (line_string&& s, line_pool&& p)
@@ -599,11 +600,18 @@ namespace build2
//
: base_type (s), pool (move (p)) {s.clear ();}
- line_regex& operator= (line_regex&&) = delete;
+ // Move constuctible/assignable-only type.
+ //
+ line_regex (line_regex&&) = default;
+ line_regex (const line_regex&) = delete;
+ line_regex& operator= (line_regex&&) = default;
line_regex& operator= (const line_regex&) = delete;
public:
- line_pool pool;
+ // Mutable since input line_char literals must go into the same
+ // pool (and thus is MT-unsafe).
+ //
+ mutable line_pool pool;
};
}
}