don't use list_explode
parent
39f233a870
commit
99ed0e8095
38
main.cc
38
main.cc
|
@ -186,14 +186,6 @@ static bool ob_expand_glob(String &ret, ConstCharRange src, bool ne) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String ob_expand_globs(Vector<String> const &src) {
|
|
||||||
String ret;
|
|
||||||
for (auto &s: src.iter()) {
|
|
||||||
ob_expand_glob(ret, s.iter());
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* check funcs */
|
/* check funcs */
|
||||||
|
|
||||||
static bool ob_check_ts(ConstCharRange tname, Vector<String> const &deps) {
|
static bool ob_check_ts(ConstCharRange tname, Vector<String> const &deps) {
|
||||||
|
@ -508,13 +500,16 @@ struct ObState: CsState {
|
||||||
CsState &cs, ConstCharRange tgt, ConstCharRange dep, CsBytecode *body,
|
CsState &cs, ConstCharRange tgt, ConstCharRange dep, CsBytecode *body,
|
||||||
bool action = false
|
bool action = false
|
||||||
) {
|
) {
|
||||||
auto targets = cscript::util::list_explode(cs, tgt);
|
cscript::util::ListParser p{cs, tgt};
|
||||||
for (auto &target: targets.iter()) {
|
while (p.parse()) {
|
||||||
Rule &r = rules.push();
|
Rule &r = rules.push();
|
||||||
r.target = target;
|
r.target = p.element();
|
||||||
r.action = action;
|
r.action = action;
|
||||||
r.func = cscript::cs_code_is_empty(body) ? nullptr : body;
|
r.func = cscript::cs_code_is_empty(body) ? nullptr : body;
|
||||||
r.deps = cscript::util::list_explode(cs, dep);
|
cscript::util::ListParser lp{cs, dep};
|
||||||
|
while (lp.parse()) {
|
||||||
|
r.deps.push(lp.element());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +534,10 @@ struct ObState: CsState {
|
||||||
if (inherit_deps) {
|
if (inherit_deps) {
|
||||||
r.deps = oldr->deps;
|
r.deps = oldr->deps;
|
||||||
} else {
|
} else {
|
||||||
r.deps = cscript::util::list_explode(cs, dep);
|
cscript::util::ListParser p{cs, dep};
|
||||||
|
while (p.parse()) {
|
||||||
|
r.deps.push(p.element());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -680,8 +678,10 @@ int main(int argc, char **argv) {
|
||||||
if (newext.front() == '.') {
|
if (newext.front() == '.') {
|
||||||
newext.pop_front();
|
newext.pop_front();
|
||||||
}
|
}
|
||||||
auto fnames = cscript::util::list_explode(cs, lst);
|
cscript::util::ListParser p{cs, lst};
|
||||||
for (ConstCharRange it: fnames.iter()) {
|
while (p.parse()) {
|
||||||
|
auto elem = p.element();
|
||||||
|
ConstCharRange it = elem.iter();
|
||||||
if (!ret.empty()) {
|
if (!ret.empty()) {
|
||||||
ret += ' ';
|
ret += ' ';
|
||||||
}
|
}
|
||||||
|
@ -702,8 +702,12 @@ int main(int argc, char **argv) {
|
||||||
});
|
});
|
||||||
|
|
||||||
os.new_command("glob", "C", [&os](auto &cs, auto args, auto &res) {
|
os.new_command("glob", "C", [&os](auto &cs, auto args, auto &res) {
|
||||||
auto fnames = cscript::util::list_explode(cs, args[0].get_strr());
|
String ret;
|
||||||
res.set_str(ostd::move(ob_expand_globs(fnames)));
|
cscript::util::ListParser p{cs, args[0].get_strr()};
|
||||||
|
while (p.parse()) {
|
||||||
|
ob_expand_glob(ret, p.element());
|
||||||
|
}
|
||||||
|
res.set_str(ostd::move(ret));
|
||||||
});
|
});
|
||||||
|
|
||||||
if ((!fcont.empty() && !os.run_bool(fcont)) || !os.run_file(deffile)) {
|
if ((!fcont.empty() && !os.run_bool(fcont)) || !os.run_file(deffile)) {
|
||||||
|
|
Loading…
Reference in New Issue