Merge pull request #2638 from akohlmey/parse-molecule-refactor

Further refactor parsing of molecule files
This commit is contained in:
Axel Kohlmeyer
2021-03-08 20:04:07 -05:00
committed by GitHub
7 changed files with 653 additions and 220 deletions

View File

@ -854,7 +854,7 @@ std::vector<std::string> utils::split_words(const std::string &text)
------------------------------------------------------------------------- */
bool utils::is_integer(const std::string &str) {
if (str.size() == 0) {
if (str.empty()) {
return false;
}
@ -870,7 +870,7 @@ bool utils::is_integer(const std::string &str) {
------------------------------------------------------------------------- */
bool utils::is_double(const std::string &str) {
if (str.size() == 0) {
if (str.empty()) {
return false;
}
@ -883,6 +883,22 @@ bool utils::is_double(const std::string &str) {
return true;
}
/* ----------------------------------------------------------------------
Return whether string is a valid ID string
------------------------------------------------------------------------- */
bool utils::is_id(const std::string &str) {
if (str.empty()) {
return false;
}
for (auto c : str) {
if (isalnum(c) || (c == '_')) continue;
return false;
}
return true;
}
/* ----------------------------------------------------------------------
strip off leading part of path, return just the filename
------------------------------------------------------------------------- */