Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2328c9a

Browse filesBrowse files
committed
compatibility with bison 3.0
1 parent f321a73 commit 2328c9a
Copy full SHA for 2328c9a

File tree

2 files changed

+11
-13
lines changed
Filter options

2 files changed

+11
-13
lines changed

‎jsquery_gram.y

Copy file name to clipboardExpand all lines: jsquery_gram.y
+4-6Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
*/
1414

1515
%{
16-
#define YYPARSE_PARAM result /* need this to pass a pointer (void *) to yyparse */
17-
1816
#include "postgres.h"
1917

2018
#include "fmgr.h"
@@ -53,8 +51,7 @@ typedef struct string {
5351

5452
/* flex 2.5.4 doesn't bother with a decl for this */
5553
int jsquery_yylex(YYSTYPE * yylval_param);
56-
int jsquery_yyparse(void *result);
57-
void jsquery_yyerror(const char *message);
54+
void jsquery_yyerror(JsQueryParseItem **result, const char *message);
5855

5956
static JsQueryParseItem*
6057
makeItemType(int type)
@@ -191,6 +188,7 @@ makeItemList(List *list) {
191188
%expect 0
192189
%name-prefix="jsquery_yy"
193190
%error-verbose
191+
%parse-param {JsQueryParseItem **result}
194192

195193
%union {
196194
string str;
@@ -225,8 +223,8 @@ makeItemList(List *list) {
225223
%%
226224

227225
result:
228-
expr { *((JsQueryParseItem**)result) = $1; }
229-
| /* EMPTY */ { *((JsQueryParseItem**)result) = NULL; }
226+
expr { *result = $1; }
227+
| /* EMPTY */ { *result = NULL; }
230228
;
231229

232230
array:

‎jsquery_scan.l

Copy file name to clipboardExpand all lines: jsquery_scan.l
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ unicode \\u[0-9A-Fa-f]{4}
157157
158158
<xNONQUOTED,xQUOTED>{unicode}+ { parseUnicode(yytext, yyleng); }
159159
160-
<xNONQUOTED,xQUOTED>\\u { yyerror("Unicode sequence is invalid"); }
160+
<xNONQUOTED,xQUOTED>\\u { yyerror(NULL, "Unicode sequence is invalid"); }
161161
162-
<xNONQUOTED,xQUOTED>\\. { yyerror("Escape sequence is invalid"); }
162+
<xNONQUOTED,xQUOTED>\\. { yyerror(NULL, "Escape sequence is invalid"); }
163163
164-
<xNONQUOTED,xQUOTED>\\ { yyerror("Unexpected end after backslesh"); }
164+
<xNONQUOTED,xQUOTED>\\ { yyerror(NULL, "Unexpected end after backslesh"); }
165165
166-
<xQUOTED><<EOF>> { yyerror("Unexpected end of quoted string"); }
166+
<xQUOTED><<EOF>> { yyerror(NULL, "Unexpected end of quoted string"); }
167167
168168
<xQUOTED>\" {
169169
yylval->str = scanstring;
@@ -186,12 +186,12 @@ unicode \\u[0-9A-Fa-f]{4}
186186
187187
<xCOMMENT>\* { addchar(false, '*'); }
188188
189-
<xCOMMENT><<EOF>> { yyerror("Unexpected end of comment"); }
189+
<xCOMMENT><<EOF>> { yyerror(NULL, "Unexpected end of comment"); }
190190
191191
%%
192192
193193
void
194-
yyerror(const char *message)
194+
yyerror(JsQueryParseItem **result, const char *message)
195195
{
196196
if (*yytext == YY_END_OF_BUFFER_CHAR)
197197
{
@@ -384,7 +384,7 @@ parsejsquery(const char *str, int len) {
384384
jsquery_scanner_init(str, len);
385385

386386
if (jsquery_yyparse((void*)&parseresult) != 0)
387-
jsquery_yyerror("bugus input");
387+
jsquery_yyerror(NULL, "bugus input");
388388

389389
jsquery_scanner_finish();
390390

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.