Is it possible to prevent boost's escaped_list_separator
from consuming quotes in a quoted token? Or are there any other ready-to-use constructs to archive this behavior?
The inner quotes cannot be escaped as the grammar doesn't support that and is defined by a third party.
Example:
std::string input("ID=abcde;PARAM={this;{is};quoted}");
boost::escaped_list_separator<char> separator("", ";", "{}");
boost::tokenizer<boost::escaped_list_separator<char>> tokenizer(input, separator);
for(const auto &token : tokenizer)
{
std::cout << token << std::endl;
}
This yields
ID=abcde
PARAM=this;is;quoted
but I need
ID=abcde
PARAM=this;{is};quoted
Don't tokenize if you want to parse.
I'll make some assumptions:
{"ID","abcde"}
)Example: Spirit X3
Live On Compiler Explorer
Prints
UPDATE: MSODBC Connection Strings
Going from the scant documentation here:
It follows that a braced value is only ended by
}
if it appears right before;
or at the end of the connection string, so basically:To also retain the original bracing status (so the highlighted requirement can be met) I'd do this:
Live On Compiler Explorer
Which prints the expected outcome: