AST building #2
@ -34,7 +34,7 @@ namespace ppc {
|
||||
inline bool operator !=(version_t other) const { return !(*this == other); }
|
||||
|
||||
version_t(uint16_t major, uint16_t minor, uint32_t revision) : major(major), minor(minor), revision(revision) { }
|
||||
version_t(uint16_t major, uint16_t minor) : version_t(major, minor, -1u) { }
|
||||
version_t(uint16_t major) : version_t(major, -1u, -1u) { }
|
||||
version_t(uint16_t major, uint16_t minor) : version_t(major, minor, -1) { }
|
||||
version_t(uint16_t major) : version_t(major, -1, -1) { }
|
||||
};
|
||||
}
|
||||
|
@ -15,11 +15,11 @@ std::string read_str(std::istream &f, const std::string &skip_chars, const std::
|
||||
while (true) {
|
||||
c = f.get();
|
||||
auto a = end_chars.find(c);
|
||||
if (c == -1 || a != -1ull) {
|
||||
if (c == -1 || a != std::string::npos) {
|
||||
end_char = c;
|
||||
return "";
|
||||
}
|
||||
if ((a = skip_chars.find(c)) == -1ull) {
|
||||
if ((a = skip_chars.find(c)) == std::string::npos) {
|
||||
f.unget();
|
||||
break;
|
||||
}
|
||||
@ -27,7 +27,7 @@ std::string read_str(std::istream &f, const std::string &skip_chars, const std::
|
||||
|
||||
while (true) {
|
||||
c = f.get();
|
||||
if (c == -1 || end_chars.find(c) != -1ull) {
|
||||
if (c == -1 || end_chars.find(c) != std::string::npos) {
|
||||
end_char = c;
|
||||
break;
|
||||
}
|
||||
@ -35,7 +35,7 @@ std::string read_str(std::istream &f, const std::string &skip_chars, const std::
|
||||
res.push_back(c);
|
||||
}
|
||||
while (true) {
|
||||
if (skip_chars.find(res.back()) != -1ull) res.pop_back();
|
||||
if (skip_chars.find(res.back()) != std::string::npos) res.pop_back();
|
||||
else break;
|
||||
}
|
||||
|
||||
@ -63,14 +63,14 @@ project_t read_project(std::istream &f) {
|
||||
};
|
||||
}
|
||||
|
||||
if (name.find(',') != -1ull || name.find(' ') != -1ull) {
|
||||
if (name.find(',') != std::string::npos || name.find(' ') != std::string::npos) {
|
||||
throw (std::string)"The name of a project may not contain spaces or commas.";
|
||||
}
|
||||
|
||||
while (true) {
|
||||
std::string dep = read_str(f, " \v\t\r\n", ",\n", end_ch);
|
||||
|
||||
if (dep.find(' ') != -1ull) {
|
||||
if (dep.find(' ') != std::string::npos) {
|
||||
throw (std::string)"The name of a dependency may not contain spaces.";
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ using namespace ppc;
|
||||
bool check_shorthand(std::string &option, const options::flag_t &flag) {
|
||||
if (option.size() < 2 || option[0] != '-') return false;
|
||||
|
||||
if (option.size() == 2 && std::string { flag.shorthands }.find(option[1]) != -1u) {
|
||||
if (option.size() == 2 && std::string { flag.shorthands }.find(option[1]) != std::string::npos) {
|
||||
option = "";
|
||||
return true;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ std::vector<std::string> str::split(const std::string &splittable, std::initiali
|
||||
std::vector<std::string> res;
|
||||
|
||||
for (char c : splittable) {
|
||||
if (std::string { splitters }.find(c) == -1u) {
|
||||
if (std::string { splitters }.find(c) == std::string::npos) {
|
||||
buff << c;
|
||||
}
|
||||
else {
|
||||
@ -29,10 +29,10 @@ std::vector<std::string> str::split(const std::string &splittable, std::initiali
|
||||
std::string str::trim(std::string splittable, std::initializer_list<char> splitters) {
|
||||
auto split = std::string { splitters };
|
||||
|
||||
while (!splittable.empty() && split.find(splittable[0]) != -1u) {
|
||||
while (!splittable.empty() && split.find(splittable[0]) != std::string::npos) {
|
||||
splittable = splittable.substr(1);
|
||||
}
|
||||
while (!splittable.empty() && split.find(splittable[splittable.length() - 1]) != -1u) {
|
||||
while (!splittable.empty() && split.find(splittable[splittable.length() - 1]) != std::string::npos) {
|
||||
splittable = splittable.substr(0, splittable.length() - 1);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user