Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit df8789b

Browse files
author
Michael Meskes
committed
Third try. Sorry, I had a wrong path in my copy statement.
1 parent c823b1e commit df8789b

File tree

5 files changed

+26
-8
lines changed

5 files changed

+26
-8
lines changed

src/interfaces/ecpg/preproc/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ PATCHLEVEL=0
99
override CPPFLAGS+=-I$(srcdir)/../include -DMAJOR_VERSION=$(MAJOR_VERSION) \
1010
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
1111
-DINCLUDE_PATH=\"$(includedir)\"
12+
# -DYYDEBUG -g
1213

1314
OBJS=preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o\
1415
keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ static void
2222
usage(char *progname)
2323
{
2424
fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
25-
fprintf(stderr, "Usage: %s: [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname);
25+
fprintf(stderr, "Usage: %s: "
26+
#ifdef YYDEBUG
27+
"[-d]"
28+
#endif
29+
" [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname);
2630
}
2731

2832
static void
@@ -61,7 +65,7 @@ main(int argc, char *const argv[])
6165
add_include_path("/usr/local/include");
6266
add_include_path(".");
6367

64-
while ((c = getopt(argc, argv, "vo:I:tD:")) != EOF)
68+
while ((c = getopt(argc, argv, "vo:I:tD:d")) != EOF)
6569
{
6670
switch (c)
6771
{
@@ -84,6 +88,11 @@ main(int argc, char *const argv[])
8488
case 'D':
8589
add_preprocessor_define(optarg);
8690
break;
91+
#ifdef YYDEBUG
92+
case 'd':
93+
yydebug=1;
94+
break;
95+
#endif
8796
default:
8897
usage(argv[0]);
8998
return ILLEGAL_OPTION;

src/interfaces/ecpg/preproc/extern.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ extern char *connection;
1919
extern char *input_filename;
2020
extern char *yytext,
2121
errortext[128];
22+
#ifdef YYDEBUG
23+
extern int yydebug;
24+
#endif
2225
extern int yylineno,
2326
yyleng;
2427
extern FILE *yyin,

src/interfaces/ecpg/preproc/keywords.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.30 2000/09/26 11:41:44 meskes Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.31 2000/11/07 08:46:27 meskes Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -191,12 +191,12 @@ static ScanKeyword ScanKeywords[] = {
191191
{"only", ONLY},
192192
{"operator", OPERATOR},
193193
{"option", OPTION},
194-
{"overlaps", OVERLAPS},
195-
{"owner", OWNER},
196194
{"or", OR},
197195
{"order", ORDER},
198196
{"out", OUT},
199197
{"outer", OUTER_P},
198+
{"overlaps", OVERLAPS},
199+
{"owner", OWNER},
200200
{"partial", PARTIAL},
201201
{"password", PASSWORD},
202202
{"path", PATH_P},

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ make_name(void)
375375
%type <index> opt_array_bounds opt_type_array_bounds
376376

377377
%type <ival> Iresult
378+
379+
%token YYERROR_VERBOSE
378380
%%
379381
prog: statements;
380382

@@ -5272,6 +5274,7 @@ c_anything: IDENT { $$ = $1; }
52725274
| S_LSHIFT { $$ = make_str("<<"); }
52735275
| S_MEMBER { $$ = make_str("->"); }
52745276
| S_MEMPOINT { $$ = make_str("->*"); }
5277+
| S_MOD { $$ = make_str("%="); }
52755278
| S_MUL { $$ = make_str("*="); }
52765279
| S_NEQUAL { $$ = make_str("!="); }
52775280
| S_OR { $$ = make_str("||"); }
@@ -5311,7 +5314,9 @@ blockend : '}'
53115314

53125315
%%
53135316

5314-
void yyerror(char * error)
5315-
{
5316-
mmerror(ET_ERROR, error);
5317+
void yyerror( char * error)
5318+
{ char buf[1024];
5319+
snprintf(buf,sizeof buf,"%s at or near \"%s\"",error,yytext);
5320+
buf[sizeof(buf)-1]=0;
5321+
mmerror(ET_ERROR, buf);
53175322
}

0 commit comments

Comments
 (0)