expose string parse

master
Daniel Kolesa 2016-10-10 20:14:16 +02:00
parent 58b54aff66
commit 27affb1057
2 changed files with 10 additions and 3 deletions

View File

@ -741,6 +741,10 @@ namespace util {
return ret;
}
OSTD_EXPORT ostd::ConstCharRange parse_string(
CsState &cs, ostd::ConstCharRange str
);
OSTD_EXPORT ostd::ConstCharRange parse_word(
CsState &cs, ostd::ConstCharRange str
);

View File

@ -186,9 +186,12 @@ done:
}
namespace util {
static ostd::ConstCharRange cs_parse_str(
OSTD_EXPORT ostd::ConstCharRange parse_string(
CsState &cs, ostd::ConstCharRange str
) {
if (str.empty() || (*str != '\"')) {
return str;
}
ostd::ConstCharRange orig = str;
++str;
while (!str.empty()) {
@ -292,7 +295,7 @@ end:
switch (*input) {
case '"':
quote = input;
input = cs_parse_str(p_state, input);
input = parse_string(p_state, input);
quote = ostd::slice_until(quote, input);
item = quote.slice(1, quote.size() - 1);
break;
@ -314,7 +317,7 @@ end:
++input;
switch (c) {
case '"':
input = cs_parse_str(p_state, input);
input = parse_string(p_state, input);
break;
case '/':
if (!input.empty() && (*input == '/')) {