commit dae8555234f0e5c8358b91c307d91b219c664617
Author: Georg Baum <[email protected]>
Date:   Sun Dec 28 17:46:33 2014 +0100

    Get rid of regex_constants::match_partial
    
    As shown by the unit test this is not needed at all, even not for really
    awkward input.

diff --git a/src/insets/ExternalTransforms.cpp 
b/src/insets/ExternalTransforms.cpp
index 8a29f38..4762536 100644
--- a/src/insets/ExternalTransforms.cpp
+++ b/src/insets/ExternalTransforms.cpp
@@ -282,7 +282,7 @@ string const sanitizeLatexOption(string const & input)
        lyx::smatch what;
        static lyx::regex const front("^( *[[],*)(.*)$");
 
-       regex_match(it, end, what, front, regex_constants::match_partial);
+       regex_match(it, end, what, front);
        if (!what[0].matched) {
                lyxerr << "Unable to sanitize LaTeX \"Option\": "
                       << input << '\n';
@@ -295,7 +295,7 @@ string const sanitizeLatexOption(string const & input)
        // with iterator now pointing to 'b'
        static lyx::regex const commas("([^,]*)(,,*)(.*)$");
        for (; it != end;) {
-               regex_match(it, end, what, commas, 
regex_constants::match_partial);
+               regex_match(it, end, what, commas);
                if (!what[0].matched) {
                        output += string(it, end);
                        break;
diff --git a/src/support/regex.h b/src/support/regex.h
index db365ca..04f93ca 100644
--- a/src/support/regex.h
+++ b/src/support/regex.h
@@ -15,7 +15,6 @@
 #if __cplusplus >= 201103L && defined(LYX_USE_STD_REGEX)
 #  include <regex>
 #  ifdef _MSC_VER
-#    define match_partial _Match_partial
 namespace lyx {
   // inheriting 'private' to see which functions are used and if there are
   // other ECMAScrip defaults
@@ -59,7 +58,6 @@ namespace lyx {
 #  else
 // <regex> in gcc is unusable in versions less than 4.9.0
 // see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53631
-// TODO no match_partial in std, how to replace?
 #  define LR_NS std
 namespace lyx {
 using LR_NS::regex;
diff --git a/src/tests/check_ExternalTransforms.cpp 
b/src/tests/check_ExternalTransforms.cpp
index aff2369..37cd20f 100644
--- a/src/tests/check_ExternalTransforms.cpp
+++ b/src/tests/check_ExternalTransforms.cpp
@@ -19,6 +19,8 @@ void test_sanitizeLatexOption()
        cout << sanitizeLatexOption(",,") << endl;
        cout << sanitizeLatexOption("[") << endl;
        cout << sanitizeLatexOption("]") << endl;
+       cout << sanitizeLatexOption("a,[,c]") << endl;
+       cout << sanitizeLatexOption("[a,],c") << endl;
        // valid input
        cout << sanitizeLatexOption("[]") << endl;
        cout << sanitizeLatexOption("[[]") << endl;
@@ -34,6 +36,11 @@ void test_sanitizeLatexOption()
        cout << sanitizeLatexOption("[a,b]") << endl;
        cout << sanitizeLatexOption("[a,,b]") << endl;
        cout << sanitizeLatexOption("[a,,,b]") << endl;
+       cout << sanitizeLatexOption("[a,[,c]") << endl;
+       cout << sanitizeLatexOption("[a,],c]") << endl;
+       cout << sanitizeLatexOption("[a,[],c]") << endl;
+       cout << sanitizeLatexOption("[a,,[],,c]") << endl;
+       cout << sanitizeLatexOption("[a,,[,],,c]") << endl;
        cout << sanitizeLatexOption("[a,]") << endl;
        cout << sanitizeLatexOption("[a,,]") << endl;
        cout << sanitizeLatexOption("[a,,,]") << endl;
diff --git a/src/tests/regfiles/ExternalTransforms 
b/src/tests/regfiles/ExternalTransforms
index a53123a..9722fb3 100644
--- a/src/tests/regfiles/ExternalTransforms
+++ b/src/tests/regfiles/ExternalTransforms
@@ -8,6 +8,10 @@ Unable to sanitize LaTeX "Option":
 
 Unable to sanitize LaTeX "Option": ]
 
+Unable to sanitize LaTeX "Option": a,[,c]
+
+Unable to sanitize LaTeX "Option": a,],c
+
 
 [[]
 []]
@@ -22,6 +26,11 @@ Unable to sanitize LaTeX "Option": ]
 [a,b]
 [a,b]
 [a,b]
+[a,[,c]
+[a,],c]
+[a,[],c]
+[a,[],c]
+[a,[,],c]
 [a]
 [a]
 [a]

Reply via email to