flush
[m6w6/ext-psi] / src / parser_proc_grammar.y
index cd828e63861748e0a3710336c4e8e562d5f2b438..7a3cf55f7dbef3bef88b8751abc3f5727619e832 100644 (file)
@@ -1,5 +1,9 @@
 %code top {
-#include "php_psi_stdinc.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#else
+# include "php_config.h"
+#endif
 }
 
 %code {
@@ -2325,11 +2329,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", 
-                                       i<last+1?"preceding":i>last+1?"following":"offending", T->text->val, T->col);
+                                       pos, T ? T->text->val : "<deleted>", T ? T->col : 0);
                }
        } else {
                P->error(PSI_DATA(P), NULL, PSI_WARNING, "PSI %s", msg);