Closed mingodad closed 2 years ago
Describe the bug Segfault when grammar entry rule doesn't exists
To Reproduce Steps to reproduce the behavior:
README
peppa parse -G json.peg -e entry2 data.json
Desktop (please complete the following information):
This seems to fix the problem (line numbers are from my code with other changes):
@@ -3194,9 +3330,9 @@ P4_GetErrorMessage(P4_Source* source) { return NULL; memset(source->errmsg, 0, sizeof(source->errmsg)); sprintf(source->errmsg, "line %zu:%zu, expect %s", source->error.lineno, source->error.offset, - source->error.rule->name); + source->error.rule ? source->error.rule->name : source->entry_name);
Thanks for reporting the issue!
Describe the bug Segfault when grammar entry rule doesn't exists
To Reproduce Steps to reproduce the behavior:
README
json example executepeppa parse -G json.peg -e entry2 data.json
Desktop (please complete the following information):
This seems to fix the problem (line numbers are from my code with other changes):