diff --git a/include/cubescript/cubescript.hh b/include/cubescript/cubescript.hh index 4da6ee0..7b62a85 100644 --- a/include/cubescript/cubescript.hh +++ b/include/cubescript/cubescript.hh @@ -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 ); diff --git a/src/cs_util.cc b/src/cs_util.cc index fdc9132..7fb6ff7 100644 --- a/src/cs_util.cc +++ b/src/cs_util.cc @@ -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 == '/')) {