@@ -42,6 +42,13 @@ struct syncrep_yy_extra_type
42
42
StringInfoData xdbuf;
43
43
};
44
44
45
+ /*
46
+ * Better keep this definition here than put it in replication/syncrep.h and
47
+ * save a bit of duplication. Putting it in replication/syncrep.h would leak
48
+ * the definition to other parts and possibly affect other scanners.
49
+ */
50
+ #define YY_DECL extern int syncrep_yylex (union YYSTYPE *yylval_param, char **syncrep_parse_error_msg_p, yyscan_t yyscanner)
51
+
45
52
/* LCOV_EXCL_START */
46
53
47
54
%}
@@ -104,7 +111,7 @@ xdinside [^"]+
104
111
return NAME;
105
112
}
106
113
<xd><<EOF>> {
107
- syncrep_yyerror (yyscanner, " unterminated quoted identifier" );
114
+ syncrep_yyerror (NULL , syncrep_parse_error_msg_p, yyscanner, " unterminated quoted identifier" );
108
115
return JUNK;
109
116
}
110
117
@@ -136,12 +143,21 @@ xdinside [^"]+
136
143
#undef yyextra
137
144
#define yyextra (((struct yyguts_t *) yyscanner)->yyextra_r)
138
145
139
- /* Needs to be here for access to yytext */
146
+ /*
147
+ * This yyerror() function does not raise an error (elog or similar), it just
148
+ * collects the error message in *syncrep_parse_error_msg_p and leaves it to
149
+ * the ultimate caller of the syncrep parser to raise the error. (The
150
+ * ultimate caller will do that with special GUC error functions.)
151
+ *
152
+ * (The first argument is enforced by Bison to match the first argument of
153
+ * yyparse(), but it is not used here.)
154
+ */
140
155
void
141
- syncrep_yyerror (yyscan_t yyscanner, const char *message)
156
+ syncrep_yyerror (SyncRepConfigData **syncrep_parse_result_p, char **syncrep_parse_error_msg_p, yyscan_t yyscanner, const char *message)
142
157
{
143
158
struct yyguts_t *yyg = (struct yyguts_t *) yyscanner; /* needed for yytext
144
159
* macro */
160
+ char *syncrep_parse_error_msg = *syncrep_parse_error_msg_p;
145
161
146
162
/* report only the first error in a parse operation */
147
163
if (syncrep_parse_error_msg)
0 commit comments