expose string parse
parent
58b54aff66
commit
27affb1057
|
@ -741,6 +741,10 @@ namespace util {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OSTD_EXPORT ostd::ConstCharRange parse_string(
|
||||||
|
CsState &cs, ostd::ConstCharRange str
|
||||||
|
);
|
||||||
|
|
||||||
OSTD_EXPORT ostd::ConstCharRange parse_word(
|
OSTD_EXPORT ostd::ConstCharRange parse_word(
|
||||||
CsState &cs, ostd::ConstCharRange str
|
CsState &cs, ostd::ConstCharRange str
|
||||||
);
|
);
|
||||||
|
|
|
@ -186,9 +186,12 @@ done:
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace util {
|
namespace util {
|
||||||
static ostd::ConstCharRange cs_parse_str(
|
OSTD_EXPORT ostd::ConstCharRange parse_string(
|
||||||
CsState &cs, ostd::ConstCharRange str
|
CsState &cs, ostd::ConstCharRange str
|
||||||
) {
|
) {
|
||||||
|
if (str.empty() || (*str != '\"')) {
|
||||||
|
return str;
|
||||||
|
}
|
||||||
ostd::ConstCharRange orig = str;
|
ostd::ConstCharRange orig = str;
|
||||||
++str;
|
++str;
|
||||||
while (!str.empty()) {
|
while (!str.empty()) {
|
||||||
|
@ -292,7 +295,7 @@ end:
|
||||||
switch (*input) {
|
switch (*input) {
|
||||||
case '"':
|
case '"':
|
||||||
quote = input;
|
quote = input;
|
||||||
input = cs_parse_str(p_state, input);
|
input = parse_string(p_state, input);
|
||||||
quote = ostd::slice_until(quote, input);
|
quote = ostd::slice_until(quote, input);
|
||||||
item = quote.slice(1, quote.size() - 1);
|
item = quote.slice(1, quote.size() - 1);
|
||||||
break;
|
break;
|
||||||
|
@ -314,7 +317,7 @@ end:
|
||||||
++input;
|
++input;
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '"':
|
case '"':
|
||||||
input = cs_parse_str(p_state, input);
|
input = parse_string(p_state, input);
|
||||||
break;
|
break;
|
||||||
case '/':
|
case '/':
|
||||||
if (!input.empty() && (*input == '/')) {
|
if (!input.empty() && (*input == '/')) {
|
||||||
|
|
Loading…
Reference in New Issue