diff options
Diffstat (limited to 'build2/test/script/regex.cxx')
-rw-r--r-- | build2/test/script/regex.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/build2/test/script/regex.cxx b/build2/test/script/regex.cxx index c6fba75..bd811e4 100644 --- a/build2/test/script/regex.cxx +++ b/build2/test/script/regex.cxx @@ -28,7 +28,6 @@ namespace build2 // @@ How can we allow anything for basic_regex but only subset // for our own code? // - const char sp[] = "()|.*+?{\\}0123456789,=!"; const char ex[] = "pn\n\r"; assert (c == 0 || // Null character. @@ -45,7 +44,7 @@ namespace build2 (c > 0 && c <= 255 && ( // Supported regex special characters. // - string::traits_type::find (sp, 23, c) != nullptr || + syntax (c) || // libstdc++ look-ahead tokens, newline chars. // @@ -73,6 +72,13 @@ namespace build2 } bool + line_char::syntax (char c) + { + return string::traits_type::find ( + "()|.*+?{}\\0123456789,=!", 23, c) != nullptr; + } + + bool operator== (const line_char& l, const line_char& r) { if (l.type == r.type) @@ -157,7 +163,7 @@ namespace std if (n > 0 && d != s) { // If d < s then it can't be in [s, s + n) range and so using copy() is - // safe. Otherwise d + n is out of (first, last] range and so using + // safe. Otherwise d + n is out of (s, s + n] range and so using // copy_backward() is safe. // if (d < s) |