diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2016-12-17 23:28:30 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2017-01-05 15:30:41 +0300 |
commit | 3ecbf5d51b13e11a93ae5757408a27c21d804c9f (patch) | |
tree | be46e3caa24574de106c2fbf1a05c43d32694e12 /build2/test/script/regex.cxx | |
parent | a63e1809afd9a837821d6e8376cb14a36e7fc26e (diff) |
Add support for regex in runner
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) |