PIConfig includes improvements
git-svn-id: svn://db.shs.com.ru/pip@172 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -666,19 +666,26 @@ void PIConfig::updateIncludes() {
|
||||
}
|
||||
|
||||
|
||||
PIString PIConfig::entryValue(PIString v) {
|
||||
PIString PIConfig::parseLine(PIString v) {
|
||||
int i = -1, l = 0;
|
||||
while (1) {
|
||||
i = v.find("${");
|
||||
if (i < 0) break;
|
||||
PIString w = v.mid(i + 1).takeRange('{', '}'), r;
|
||||
l = w.length() + 3;
|
||||
w = parseLine(w);
|
||||
w.trim();
|
||||
piForeachC (PIConfig::Entry * e, all_includes)
|
||||
if (e->_full_name == w) {
|
||||
r = e->_value;
|
||||
break;
|
||||
}
|
||||
bool ex = false;
|
||||
PIConfig::Entry & me = getValue(w, "", &ex);
|
||||
if (ex) {
|
||||
r = me._value;
|
||||
} else {
|
||||
piForeachC (PIConfig::Entry * e, all_includes)
|
||||
if (e->_full_name == w) {
|
||||
r = e->_value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
v.replace(i, l, r);
|
||||
}
|
||||
return v;
|
||||
@@ -701,7 +708,7 @@ void PIConfig::parse() {
|
||||
lines = centry = 0;
|
||||
while (!_isEndDev()) {
|
||||
other.push_back(PIString());
|
||||
src = str = _readLineDev();
|
||||
src = str = parseLine(_readLineDev());
|
||||
tprefix = getPrefixFromLine(src, &isPrefix);
|
||||
if (isPrefix) {
|
||||
prefix = tprefix;
|
||||
@@ -726,6 +733,7 @@ void PIConfig::parse() {
|
||||
type = "s";
|
||||
comm = "";
|
||||
}
|
||||
|
||||
//name = str.left(ind).trimmed();
|
||||
tree = (prefix + str.left(ind).trimmed()).split(delim);
|
||||
if (tree.front() == "include") {
|
||||
@@ -767,7 +775,7 @@ void PIConfig::parse() {
|
||||
ce->delim = delim;
|
||||
ce->_tab = tab;
|
||||
ce->_name = name;
|
||||
ce->_value = entryValue(str.right(str.length() - ind - 1).trimmed());
|
||||
ce->_value = str.right(str.length() - ind - 1).trimmed();
|
||||
ce->_type = type;
|
||||
ce->_comment = comm;
|
||||
ce->_line = lines;
|
||||
|
||||
Reference in New Issue
Block a user