simgear/props/props.cxx: parse_name(): improved exception text.
Also fixed indentation.
This commit is contained in:
parent
995608fc9e
commit
42c89ba6d3
@ -143,28 +143,33 @@ parse_name (const SGPropertyNode *node, const Range &path)
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if (i != max && *i != '/')
|
if (i != max && *i != '/')
|
||||||
throw std::runtime_error("illegal character after . or .. in '" + node->getPath() + "'");
|
throw std::runtime_error("illegal character after . or .. in '" + node->getPath() + "'");
|
||||||
} else if (isalpha_c(*i) || *i == '_') {
|
}
|
||||||
|
else if (isalpha_c(*i) || *i == '_') {
|
||||||
i++;
|
i++;
|
||||||
|
|
||||||
// The rules inside a name are a little
|
// The rules inside a name are a little
|
||||||
// less restrictive.
|
// less restrictive.
|
||||||
while (i != max) {
|
while (i != max) {
|
||||||
if (isalpha_c(*i) || isdigit_c(*i) || isspecial_c(*i)) {
|
if (isalpha_c(*i) || isdigit_c(*i) || isspecial_c(*i)) {
|
||||||
// name += path[i];
|
// name += path[i];
|
||||||
} else if (*i == '[' || *i == '/') {
|
}
|
||||||
break;
|
else if (*i == '[' || *i == '/') {
|
||||||
} else {
|
break;
|
||||||
|
}
|
||||||
|
else {
|
||||||
std::string err = "'";
|
std::string err = "'";
|
||||||
err.push_back(*i);
|
err.push_back(*i);
|
||||||
err.append("' found in propertyname after '"+node->getPath()+"'");
|
err.append("' found in propertyname after '"+node->getPath()+"'.");
|
||||||
err.append("\nname may contain only ._- and alphanumeric characters");
|
err.append(" name may contain only ._- and alphanumeric characters.");
|
||||||
|
err.append(" Complete path is: '");
|
||||||
|
for (auto j: path) err.push_back(j);
|
||||||
|
err.append("'");
|
||||||
throw std::runtime_error(err);
|
throw std::runtime_error(err);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
if (path.begin() == i) {
|
if (path.begin() == i) {
|
||||||
std::string err = "'";
|
std::string err = "'";
|
||||||
|
Loading…
Reference in New Issue
Block a user