Fixed warnings

This commit is contained in:
yhirose 2020-03-29 17:01:46 -04:00
parent c416d84fea
commit fdfd1f4267
4 changed files with 6 additions and 7 deletions

View File

@ -16,7 +16,7 @@ int main(void) {
%whitespace <- [ \t]*
)");
assert((bool)parser == true);
assert(static_cast<bool>(parser) == true);
// (3) Setup actions
parser["Additive"] = [](const SemanticValues& sv) {

View File

@ -11,7 +11,7 @@
using namespace std;
bool read_file(const char* path, vector<char>& buff)
inline bool read_file(const char* path, vector<char>& buff)
{
ifstream ifs(path, ios::in | ios::binary);
if (ifs.fail()) {
@ -128,13 +128,13 @@ int main(int argc, const char** argv)
const peg::any& /*dt*/,
size_t len) {
auto pos = static_cast<size_t>(s - c.s);
if (len != -1) {
if (len != static_cast<size_t>(-1)) {
pos += len;
}
string indent;
auto level = c.trace_ids.size() - 1;
while (level--) { indent += ""; }
auto ret = len != -1 ? "└o " : "└x ";
auto ret = len != static_cast<size_t>(-1) ? "└o " : "└x ";
std::stringstream choice;
if (sv.choice_count() > 0) {
choice << " " << sv.choice() << "/" << sv.choice_count();

View File

@ -3143,7 +3143,6 @@ private:
};
g["Loop"] = [&](const SemanticValues &sv) {
std::pair<size_t, size_t> dummy;
switch (sv.choice()) {
case 0: // Option
return Loop{Loop::Type::opt, std::pair<size_t, size_t>()};

View File

@ -3,13 +3,13 @@
using namespace peg;
bool exact(Grammar& g, const char* d, const char* s) {
inline bool exact(Grammar& g, const char* d, const char* s) {
auto n = strlen(s);
auto r = g[d].parse(s, n);
return r.ret && r.len == n;
}
Grammar& make_peg_grammar() {
inline Grammar& make_peg_grammar() {
return ParserGenerator::grammar();
}