mirror of
https://github.com/yhirose/cpp-peglib.git
synced 2024-12-22 20:05:31 +00:00
Fixed error message problem.
This commit is contained in:
parent
feff9d1d97
commit
7d17f7ce8d
@ -42,12 +42,7 @@ int main(int argc, const char** argv)
|
||||
|
||||
peglib::peg peg;
|
||||
|
||||
bool firstError = true;
|
||||
peg.log = [&](size_t ln, size_t col, const string& msg) {
|
||||
if (firstError) {
|
||||
firstError = false;
|
||||
cerr << "# PEG grammar syntax error" << endl;
|
||||
}
|
||||
cerr << syntax_path << ":" << ln << ":" << col << ": " << msg << endl;
|
||||
};
|
||||
|
||||
@ -68,13 +63,8 @@ int main(int argc, const char** argv)
|
||||
return -1;
|
||||
}
|
||||
|
||||
firstError = true;
|
||||
peg.log = [&](size_t ln, size_t col, const string& msg) {
|
||||
if (firstError) {
|
||||
firstError = false;
|
||||
cerr << "# Source syntax error" << endl;
|
||||
}
|
||||
cerr << syntax_path << ":" << ln << ":" << col << ": " << msg << endl;
|
||||
cerr << source_path << ":" << ln << ":" << col << ": " << msg << endl;
|
||||
};
|
||||
|
||||
if (!peg.parse_n(source.data(), source.size())) {
|
||||
|
Loading…
Reference in New Issue
Block a user