simgear/props/props.cxx: parse_name(): improved exception text.

Also fixed indentation.
This commit is contained in:
Julian Smith 2020-12-18 15:49:20 +00:00
parent 995608fc9e
commit 42c89ba6d3

View File

@ -144,7 +144,8 @@ parse_name (const SGPropertyNode *node, const Range &path)
}
if (i != max && *i != '/')
throw std::runtime_error("illegal character after . or .. in '" + node->getPath() + "'");
} else if (isalpha_c(*i) || *i == '_') {
}
else if (isalpha_c(*i) || *i == '_') {
i++;
// The rules inside a name are a little
@ -152,19 +153,23 @@ parse_name (const SGPropertyNode *node, const Range &path)
while (i != max) {
if (isalpha_c(*i) || isdigit_c(*i) || isspecial_c(*i)) {
// name += path[i];
} else if (*i == '[' || *i == '/') {
}
else if (*i == '[' || *i == '/') {
break;
} else {
}
else {
std::string err = "'";
err.push_back(*i);
err.append("' found in propertyname after '"+node->getPath()+"'");
err.append("\nname may contain only ._- and alphanumeric characters");
err.append("' found in propertyname after '"+node->getPath()+"'.");
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);
}
i++;
}
}
else {
if (path.begin() == i) {
std::string err = "'";