mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Fixed warnings
This commit is contained in:
parent
c416d84fea
commit
fdfd1f4267
@ -16,7 +16,7 @@ int main(void) {
|
|||||||
%whitespace <- [ \t]*
|
%whitespace <- [ \t]*
|
||||||
)");
|
)");
|
||||||
|
|
||||||
assert((bool)parser == true);
|
assert(static_cast<bool>(parser) == true);
|
||||||
|
|
||||||
// (3) Setup actions
|
// (3) Setup actions
|
||||||
parser["Additive"] = [](const SemanticValues& sv) {
|
parser["Additive"] = [](const SemanticValues& sv) {
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
using namespace std;
|
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);
|
ifstream ifs(path, ios::in | ios::binary);
|
||||||
if (ifs.fail()) {
|
if (ifs.fail()) {
|
||||||
@ -128,13 +128,13 @@ int main(int argc, const char** argv)
|
|||||||
const peg::any& /*dt*/,
|
const peg::any& /*dt*/,
|
||||||
size_t len) {
|
size_t len) {
|
||||||
auto pos = static_cast<size_t>(s - c.s);
|
auto pos = static_cast<size_t>(s - c.s);
|
||||||
if (len != -1) {
|
if (len != static_cast<size_t>(-1)) {
|
||||||
pos += len;
|
pos += len;
|
||||||
}
|
}
|
||||||
string indent;
|
string indent;
|
||||||
auto level = c.trace_ids.size() - 1;
|
auto level = c.trace_ids.size() - 1;
|
||||||
while (level--) { indent += "│"; }
|
while (level--) { indent += "│"; }
|
||||||
auto ret = len != -1 ? "└o " : "└x ";
|
auto ret = len != static_cast<size_t>(-1) ? "└o " : "└x ";
|
||||||
std::stringstream choice;
|
std::stringstream choice;
|
||||||
if (sv.choice_count() > 0) {
|
if (sv.choice_count() > 0) {
|
||||||
choice << " " << sv.choice() << "/" << sv.choice_count();
|
choice << " " << sv.choice() << "/" << sv.choice_count();
|
||||||
|
1
peglib.h
1
peglib.h
@ -3143,7 +3143,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
g["Loop"] = [&](const SemanticValues &sv) {
|
g["Loop"] = [&](const SemanticValues &sv) {
|
||||||
std::pair<size_t, size_t> dummy;
|
|
||||||
switch (sv.choice()) {
|
switch (sv.choice()) {
|
||||||
case 0: // Option
|
case 0: // Option
|
||||||
return Loop{Loop::Type::opt, std::pair<size_t, size_t>()};
|
return Loop{Loop::Type::opt, std::pair<size_t, size_t>()};
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
|
|
||||||
using namespace peg;
|
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 n = strlen(s);
|
||||||
auto r = g[d].parse(s, n);
|
auto r = g[d].parse(s, n);
|
||||||
return r.ret && r.len == n;
|
return r.ret && r.len == n;
|
||||||
}
|
}
|
||||||
|
|
||||||
Grammar& make_peg_grammar() {
|
inline Grammar& make_peg_grammar() {
|
||||||
return ParserGenerator::grammar();
|
return ParserGenerator::grammar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user