-# Declare yyerror.
-m4_append([b4_post_prologue],
-[b4_syncline([@oline@], [@ofile@])
-
-b4_c_ansi_function_decl([yyerror],
- [static void],
- [[b4_namespace_ref::b4_parser_class_name::location_type *yylocationp], [yylocationp]],
+# Hijack the post prologue to insert early definition of YYLLOC_DEFAULT
+# and declaration of yyerror.
+]m4_append([b4_post_prologue],
+[b4_syncline([@oline@], [@ofile@])[
+]b4_yylloc_default_define[
+#define YYRHSLOC(Rhs, K) ((Rhs)[K].yystate.yyloc)
+]b4_function_declare([yyerror],
+ [static void],b4_locations_if([
+ [[const ]b4_namespace_ref::b4_parser_class_name[::location_type *yylocationp],
+ [yylocationp]],])