From 3ecbf5d51b13e11a93ae5757408a27c21d804c9f Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 17 Dec 2016 23:28:30 +0300 Subject: Add support for regex in runner --- build2/test/script/regex.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'build2/test/script/regex.cxx') 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) -- cgit v1.1