mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-11-13 22:55:29 +00:00
Fixed warnings
This commit is contained in:
parent
c416d84fea
commit
fdfd1f4267
@ -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) {
|
||||
|
@ -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();
|
||||
|
1
peglib.h
1
peglib.h
@ -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>()};
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user