X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-psi;a=blobdiff_plain;f=src%2Fparser_proc.c;h=206056ad4dea8fb87ecee7f8a331a60dc431bd9a;hp=6b8b81714bc991535ffc6e1b5526f3af2b476c6c;hb=cd0567b4052ee24259bc6b8a9858af9d26f3de48;hpb=69da9075d8a72c094e0bb977226d975365431f55 diff --git a/src/parser_proc.c b/src/parser_proc.c index 6b8b817..206056a 100644 --- a/src/parser_proc.c +++ b/src/parser_proc.c @@ -9475,11 +9475,22 @@ static void psi_parser_proc_error(struct psi_parser *P, struct psi_plist *tokens P->error(PSI_DATA(P), T, PSI_WARNING, "PSI %s at col %u", msg, T->col); while (i <= last || T->type != PSI_T_EOS) { + const char *pos; + if (!psi_plist_get(tokens, i++, &T)) { break; } + + if (i < last + 1) { + pos = "preceding"; + } else if (i > last + 1) { + pos = "following"; + } else { + pos = "offending"; + } + P->error(PSI_DATA(P), T, PSI_WARNING, "PSI %s token '%s' at col %u", - ilast+1?"following":"offending", T->text->val, T->col); + pos, T ? T->text->val : "", T ? T->col : 0); } } else { P->error(PSI_DATA(P), NULL, PSI_WARNING, "PSI %s", msg);