Third try. Sorry, I had a wrong path in my copy statement.
authorMichael Meskes <meskes@postgresql.org>
Tue, 7 Nov 2000 08:46:27 +0000 (08:46 +0000)
committerMichael Meskes <meskes@postgresql.org>
Tue, 7 Nov 2000 08:46:27 +0000 (08:46 +0000)
src/interfaces/ecpg/preproc/Makefile
src/interfaces/ecpg/preproc/ecpg.c
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/keywords.c
src/interfaces/ecpg/preproc/preproc.y

index 048a13080cf46c91c6e3bd7979bb90742cce59b1..945cba8c1fe7ffeb0378697636d7fee743f8f6e9 100644 (file)
@@ -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
index f6db59bec74628c072fc438f70398a476d461314..5c76e3eed791e7aec2e18c200119c41c900ac89e 100644 (file)
@@ -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;
index 5628e30dd1eb0acc46f341953f6dc638afd76594..f94ab94976478902873dc71fa9f884c786908370 100644 (file)
@@ -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,
index acf49b850714511b483224cff18e9194953642f3..e17c452fd087b06a3bb1e25d84bb39368a5178d6 100644 (file)
@@ -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}, 
index ded00a63ef1b5a3e64476dea92a9d096a7526bb2..e7df679a7098d51d22e309d10316b27ec9c95096 100644 (file)
@@ -375,6 +375,8 @@ make_name(void)
 %type  <index> opt_array_bounds opt_type_array_bounds
 
 %type  <ival>  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);
 }