@@ -30,6 +30,7 @@ namespace boost { namespace program_options {
30
30
31
31
std::string current;
32
32
bool inside_quoted = false ;
33
+ bool empty_quote = false ;
33
34
int backslash_count = 0 ;
34
35
35
36
for (; i != e; ++i) {
@@ -38,6 +39,7 @@ namespace boost { namespace program_options {
38
39
// n/2 backslashes and is a quoted block delimiter
39
40
if (backslash_count % 2 == 0 ) {
40
41
current.append (backslash_count / 2 , ' \\ ' );
42
+ empty_quote = inside_quoted && current.empty ();
41
43
inside_quoted = !inside_quoted;
42
44
// '"' preceded by odd number (n) of backslashes generates
43
45
// (n-1)/2 backslashes and is literal quote.
@@ -59,6 +61,7 @@ namespace boost { namespace program_options {
59
61
// Space outside quoted section terminate the current argument
60
62
result.push_back (current);
61
63
current.resize (0 );
64
+ empty_quote = false ;
62
65
for (;i != e && isspace ((unsigned char )*i); ++i)
63
66
;
64
67
--i;
@@ -74,7 +77,7 @@ namespace boost { namespace program_options {
74
77
75
78
// If we have non-empty 'current' or we're still in quoted
76
79
// section (even if 'current' is empty), add the last token.
77
- if (!current.empty () || inside_quoted)
80
+ if (!current.empty () || inside_quoted || empty_quote )
78
81
result.push_back (current);
79
82
}
80
83
return result;
@@ -94,3 +97,4 @@ namespace boost { namespace program_options {
94
97
95
98
}}
96
99
#endif
100
+
0 commit comments