restored return value commit
This commit is contained in:
parent
a646916e93
commit
f1ca33fa3a
@ -42,7 +42,7 @@ main(int ac, char **av)
|
|||||||
|
|
||||||
psql_free(pstate);
|
psql_free(pstate);
|
||||||
|
|
||||||
if (!res) {
|
if (!res && !yyerrno) {
|
||||||
printf("{\"result\":true}\n");
|
printf("{\"result\":true}\n");
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
|
13
source/sql.y
13
source/sql.y
@ -21,6 +21,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
char *filename;
|
char *filename;
|
||||||
|
int yyerrno;
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%define api.pure
|
%define api.pure
|
||||||
@ -31,6 +32,7 @@ char *filename;
|
|||||||
|
|
||||||
%code requires {
|
%code requires {
|
||||||
extern char *filename;
|
extern char *filename;
|
||||||
|
extern int yyerrno;
|
||||||
|
|
||||||
#include "yyl.h"
|
#include "yyl.h"
|
||||||
|
|
||||||
@ -53,7 +55,7 @@ struct psql_state;
|
|||||||
|
|
||||||
%token <strval> NAME
|
%token <strval> NAME
|
||||||
%token <strval> STRING
|
%token <strval> STRING
|
||||||
%token <intval> INTNUM
|
<intval> INTNUM
|
||||||
%token <intval> BOOL
|
%token <intval> BOOL
|
||||||
%token <floatval> APPROXNUM
|
%token <floatval> APPROXNUM
|
||||||
|
|
||||||
@ -327,7 +329,11 @@ void yyerror(YYLTYPE *, yyscan_t scanner, struct psql_state *pstate, const char
|
|||||||
void lyyerror(YYLTYPE t, const char *s, ...);
|
void lyyerror(YYLTYPE t, const char *s, ...);
|
||||||
%}
|
%}
|
||||||
/* free discarded tokens */
|
/* free discarded tokens */
|
||||||
%destructor { printf ("free at %d %s\n",@$.first_line, $$); free($$); } <strval>
|
%destructor {
|
||||||
|
#if DEBUG
|
||||||
|
printf ("free at %d %s\n",@$.first_line, $$); free($$);
|
||||||
|
#endif
|
||||||
|
} <strval>
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
@ -974,7 +980,7 @@ yyerror(YYLTYPE *t, yyscan_t scanner, struct psql_state *pstate, const char *s,
|
|||||||
t->last_line, t->last_column);
|
t->last_line, t->last_column);
|
||||||
vfprintf(stderr, s, ap);
|
vfprintf(stderr, s, ap);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
yyerrno = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -988,5 +994,6 @@ lyyerror(YYLTYPE t, const char *s, ...)
|
|||||||
t.last_line, t.last_column);
|
t.last_line, t.last_column);
|
||||||
vfprintf(stderr, s, ap);
|
vfprintf(stderr, s, ap);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
yyerrno = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user