From df8789bb1551dc30e46798d99364032adf7f6d54 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Tue, 7 Nov 2000 08:46:27 +0000 Subject: [PATCH] Third try. Sorry, I had a wrong path in my copy statement. --- src/interfaces/ecpg/preproc/Makefile | 1 + src/interfaces/ecpg/preproc/ecpg.c | 13 +++++++++++-- src/interfaces/ecpg/preproc/extern.h | 3 +++ src/interfaces/ecpg/preproc/keywords.c | 6 +++--- src/interfaces/ecpg/preproc/preproc.y | 11 ++++++++--- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/interfaces/ecpg/preproc/Makefile b/src/interfaces/ecpg/preproc/Makefile index 048a13080c..945cba8c1f 100644 --- a/src/interfaces/ecpg/preproc/Makefile +++ b/src/interfaces/ecpg/preproc/Makefile @@ -9,6 +9,7 @@ PATCHLEVEL=0 override CPPFLAGS+=-I$(srcdir)/../include -DMAJOR_VERSION=$(MAJOR_VERSION) \ -DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \ -DINCLUDE_PATH=\"$(includedir)\" +# -DYYDEBUG -g OBJS=preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o\ keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c index f6db59bec7..5c76e3eed7 100644 --- a/src/interfaces/ecpg/preproc/ecpg.c +++ b/src/interfaces/ecpg/preproc/ecpg.c @@ -22,7 +22,11 @@ static void usage(char *progname) { fprintf(stderr, "ecpg - the postgresql preprocessor, version: %d.%d.%d\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL); - fprintf(stderr, "Usage: %s: [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname); + fprintf(stderr, "Usage: %s: " +#ifdef YYDEBUG + "[-d]" +#endif + " [-v] [-t] [-I include path] [ -o output file name] [-D define name] file1 [file2] ...\n", progname); } static void @@ -61,7 +65,7 @@ main(int argc, char *const argv[]) add_include_path("/usr/local/include"); add_include_path("."); - while ((c = getopt(argc, argv, "vo:I:tD:")) != EOF) + while ((c = getopt(argc, argv, "vo:I:tD:d")) != EOF) { switch (c) { @@ -84,6 +88,11 @@ main(int argc, char *const argv[]) case 'D': add_preprocessor_define(optarg); break; +#ifdef YYDEBUG + case 'd': + yydebug=1; + break; +#endif default: usage(argv[0]); return ILLEGAL_OPTION; diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h index 5628e30dd1..f94ab94976 100644 --- a/src/interfaces/ecpg/preproc/extern.h +++ b/src/interfaces/ecpg/preproc/extern.h @@ -19,6 +19,9 @@ extern char *connection; extern char *input_filename; extern char *yytext, errortext[128]; +#ifdef YYDEBUG +extern int yydebug; +#endif extern int yylineno, yyleng; extern FILE *yyin, diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c index acf49b8507..e17c452fd0 100644 --- a/src/interfaces/ecpg/preproc/keywords.c +++ b/src/interfaces/ecpg/preproc/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.30 2000/09/26 11:41:44 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.31 2000/11/07 08:46:27 meskes Exp $ * *------------------------------------------------------------------------- */ @@ -191,12 +191,12 @@ static ScanKeyword ScanKeywords[] = { {"only", ONLY}, {"operator", OPERATOR}, {"option", OPTION}, - {"overlaps", OVERLAPS}, - {"owner", OWNER}, {"or", OR}, {"order", ORDER}, {"out", OUT}, {"outer", OUTER_P}, + {"overlaps", OVERLAPS}, + {"owner", OWNER}, {"partial", PARTIAL}, {"password", PASSWORD}, {"path", PATH_P}, diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index ded00a63ef..e7df679a70 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -375,6 +375,8 @@ make_name(void) %type opt_array_bounds opt_type_array_bounds %type Iresult + +%token YYERROR_VERBOSE %% prog: statements; @@ -5272,6 +5274,7 @@ c_anything: IDENT { $$ = $1; } | S_LSHIFT { $$ = make_str("<<"); } | S_MEMBER { $$ = make_str("->"); } | S_MEMPOINT { $$ = make_str("->*"); } + | S_MOD { $$ = make_str("%="); } | S_MUL { $$ = make_str("*="); } | S_NEQUAL { $$ = make_str("!="); } | S_OR { $$ = make_str("||"); } @@ -5311,7 +5314,9 @@ blockend : '}' %% -void yyerror(char * error) -{ - mmerror(ET_ERROR, error); +void yyerror( char * error) +{ char buf[1024]; + snprintf(buf,sizeof buf,"%s at or near \"%s\"",error,yytext); + buf[sizeof(buf)-1]=0; + mmerror(ET_ERROR, buf); }