rename to get_element
parent
987d00b933
commit
da37ff51d1
|
@ -771,7 +771,7 @@ namespace util {
|
||||||
ostd::Size count();
|
ostd::Size count();
|
||||||
|
|
||||||
template<typename R>
|
template<typename R>
|
||||||
ostd::Size element(R &&writer) const {
|
ostd::Size get_element(R &&writer) const {
|
||||||
if (!quote.empty() && (*quote == '"')) {
|
if (!quote.empty() && (*quote == '"')) {
|
||||||
return unescape_string(ostd::forward<R>(writer), item);
|
return unescape_string(ostd::forward<R>(writer), item);
|
||||||
} else {
|
} else {
|
||||||
|
@ -779,9 +779,9 @@ namespace util {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CsString element() const {
|
CsString get_element() const {
|
||||||
auto app = ostd::appender<CsString>();
|
auto app = ostd::appender<CsString>();
|
||||||
element(app);
|
get_element(app);
|
||||||
return ostd::move(app.get());
|
return ostd::move(app.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ static inline void cs_list_assoc(
|
||||||
for (util::ListParser p(cs, args[0].get_strr()); p.parse();) {
|
for (util::ListParser p(cs, args[0].get_strr()); p.parse();) {
|
||||||
if (cmp(p, val)) {
|
if (cmp(p, val)) {
|
||||||
if (p.parse()) {
|
if (p.parse()) {
|
||||||
res.set_str(p.element());
|
res.set_str(p.get_element());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ static void cs_loop_list_conc(
|
||||||
CsString r;
|
CsString r;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (util::ListParser p(cs, list); p.parse(); ++n) {
|
for (util::ListParser p(cs, list); p.parse(); ++n) {
|
||||||
idv.set_str(p.element());
|
idv.set_str(p.get_element());
|
||||||
idv.push();
|
idv.push();
|
||||||
if (n && space) {
|
if (n && space) {
|
||||||
r += ' ';
|
r += ' ';
|
||||||
|
@ -161,7 +161,7 @@ void cs_init_lib_list(CsState &gcs) {
|
||||||
p.item = p.quote = ostd::ConstCharRange();
|
p.item = p.quote = ostd::ConstCharRange();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
res.set_str(p.element());
|
res.set_str(p.get_element());
|
||||||
});
|
});
|
||||||
|
|
||||||
gcs.new_command("sublist", "siiN", [](auto &cs, auto args, auto &res) {
|
gcs.new_command("sublist", "siiN", [](auto &cs, auto args, auto &res) {
|
||||||
|
@ -226,7 +226,7 @@ void cs_init_lib_list(CsState &gcs) {
|
||||||
idv.push();
|
idv.push();
|
||||||
if (cs.run_bool(body)) {
|
if (cs.run_bool(body)) {
|
||||||
if (p.parse()) {
|
if (p.parse()) {
|
||||||
res.set_str(p.element());
|
res.set_str(p.get_element());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ void cs_init_lib_list(CsState &gcs) {
|
||||||
auto body = args[2].get_code();
|
auto body = args[2].get_code();
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (util::ListParser p(cs, args[1].get_strr()); p.parse(); ++n) {
|
for (util::ListParser p(cs, args[1].get_strr()); p.parse(); ++n) {
|
||||||
idv.set_str(p.element());
|
idv.set_str(p.get_element());
|
||||||
idv.push();
|
idv.push();
|
||||||
switch (cs.run_loop(body)) {
|
switch (cs.run_loop(body)) {
|
||||||
case CsLoopState::Break:
|
case CsLoopState::Break:
|
||||||
|
@ -309,9 +309,9 @@ end:
|
||||||
auto body = args[3].get_code();
|
auto body = args[3].get_code();
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (util::ListParser p(cs, args[2].get_strr()); p.parse(); n += 2) {
|
for (util::ListParser p(cs, args[2].get_strr()); p.parse(); n += 2) {
|
||||||
idv1.set_str(p.element());
|
idv1.set_str(p.get_element());
|
||||||
if (p.parse()) {
|
if (p.parse()) {
|
||||||
idv2.set_str(p.element());
|
idv2.set_str(p.get_element());
|
||||||
} else {
|
} else {
|
||||||
idv2.set_str("");
|
idv2.set_str("");
|
||||||
}
|
}
|
||||||
|
@ -338,14 +338,14 @@ end:
|
||||||
auto body = args[4].get_code();
|
auto body = args[4].get_code();
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for (util::ListParser p(cs, args[3].get_strr()); p.parse(); n += 3) {
|
for (util::ListParser p(cs, args[3].get_strr()); p.parse(); n += 3) {
|
||||||
idv1.set_str(p.element());
|
idv1.set_str(p.get_element());
|
||||||
if (p.parse()) {
|
if (p.parse()) {
|
||||||
idv2.set_str(p.element());
|
idv2.set_str(p.get_element());
|
||||||
} else {
|
} else {
|
||||||
idv2.set_str("");
|
idv2.set_str("");
|
||||||
}
|
}
|
||||||
if (p.parse()) {
|
if (p.parse()) {
|
||||||
idv3.set_str(p.element());
|
idv3.set_str(p.get_element());
|
||||||
} else {
|
} else {
|
||||||
idv3.set_str("");
|
idv3.set_str("");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue