Add %option nodefault to all our flex lexers. Fix a couple of rule gaps
authorTom Lane
Tue, 24 Feb 2004 22:06:32 +0000 (22:06 +0000)
committerTom Lane
Tue, 24 Feb 2004 22:06:32 +0000 (22:06 +0000)
exposed thereby.  AFAICT these would not lead to any worse problems than
junk emitted on the backend's stdout, but we should have the option to
catch possible worse errors in future.

contrib/cube/cubescan.l
contrib/seg/segscan.l
contrib/tsearch/parser.l
contrib/tsearch2/wordparser/parser.l
src/backend/bootstrap/bootscanner.l
src/backend/utils/misc/guc-file.l
src/interfaces/ecpg/preproc/pgc.l
src/pl/plpgsql/src/scan.l

index c5e1a20f6b19543baa9ed5578f176f298aa555c9..a47dc4334aa7ad4b03c1b170d0b38445b27b9f79 100644 (file)
@@ -26,6 +26,7 @@ void cube_scanner_finish(void);
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option nounput
 %option noyywrap
 %option prefix="cube_yy"
@@ -44,7 +45,7 @@ float        ({integer}|{real})([eE]{integer})?
 \(           yylval = "("; return O_PAREN;
 \)           yylval = ")"; return C_PAREN;
 \,           yylval = ")"; return COMMA;
-[ ]+         /* discard spaces */
+[ \t\n\r\f]+ /* discard spaces */
 .            return yytext[0]; /* alert parser of the garbage */
 
 %%
index 21eb5fa02076e9090c3ac02eadb252c7e3cb1b25..b2a3bbe68453b848202f538dee4d0a6d3fb86adc 100644 (file)
@@ -25,6 +25,7 @@ void seg_scanner_finish(void);
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option nounput
 %option noyywrap
 %option prefix="seg_yy"
@@ -44,7 +45,7 @@ float        ({integer}|{real})([eE]{integer})?
 \<           yylval.text = "<"; return EXTENSION;
 \>           yylval.text = ">"; return EXTENSION;
 \~           yylval.text = "~"; return EXTENSION;
-[ ]+         /* discard spaces */
+[ \t\n\r\f]+ /* discard spaces */
 .            return yytext[0]; /* alert parser of the garbage */
 
 %%
index 17ac21dcd1c205bea9d867822d3036343ab46f5f..3eb411dded3c81f56b93ed6c9bc5cab8db6512e4 100644 (file)
@@ -16,6 +16,7 @@ YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option nounput
 %option noyywrap
 
index e36c19355c53700859320c314978845e382fa230..e80f5fea903061699972dcb56dd8fe8ff07afdb7 100644 (file)
@@ -18,6 +18,7 @@ YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option nounput
 %option noyywrap
 
index 6d3081695f4d4d3ddfda33e3405c1766c4086edf..d8f683596d9279597a8a81a6b67c04df0b633bc3 100644 (file)
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.32 2003/11/29 19:51:41 pgsql Exp $
+ *   $PostgreSQL: pgsql/src/backend/bootstrap/bootscanner.l,v 1.33 2004/02/24 22:06:32 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,6 +53,7 @@ static int    yyline;  /* keep track of the line number for error reporting */
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option nounput
 %option noyywrap
 
index df895722607179b7d6694f18895620da74976243..eb5f0c7f0711ea8130bec775b06de9da5a3b3cd2 100644 (file)
@@ -4,7 +4,7 @@
  *
  * Copyright (c) 2000-2003, PostgreSQL Global Development Group
  *
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.20 2003/11/29 19:52:03 pgsql Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc-file.l,v 1.21 2004/02/24 22:06:32 tgl Exp $
  */
 
 %{
@@ -47,6 +47,7 @@ char *GUC_scanstr(char *);
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option nounput
 %option noyywrap
 
index 264f93f847cb2e39d6dd1562d5dcb354d8cf4918..376c87c73ba7a17506a7434d3cf6f78685850118 100644 (file)
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.125 2004/02/15 13:48:54 meskes Exp $
+ *   $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.126 2004/02/24 22:06:32 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -70,6 +70,7 @@ static struct _if_value
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option noyywrap
 
 %option yylineno
index 62a7880c6c2c00ff5bb0c9e473860a46888eddea..b891e2b9e185f319533b8d80553f5acbd12375ee 100644 (file)
@@ -4,7 +4,7 @@
  *           procedural language
  *
  * IDENTIFICATION
- *    $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.30 2003/11/29 19:52:12 pgsql Exp $
+ *    $PostgreSQL: pgsql/src/pl/plpgsql/src/scan.l,v 1.31 2004/02/24 22:06:32 tgl Exp $
  *
  *    This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -63,6 +63,7 @@ int   plpgsql_SpaceScanned = 0;
 
 %option 8bit
 %option never-interactive
+%option nodefault
 %option nounput
 %option noyywrap
 
@@ -272,6 +273,7 @@ dump            { return O_DUMP;            }
              BEGIN IN_STRING;
            }
 \\.     { }
+\\      { /* can only happen with \ at EOF */ }
 ''      { }
 '       {
              yyleng -= (yytext - start_charpos);
@@ -279,13 +281,13 @@ dump          { return O_DUMP;            }
              BEGIN INITIAL;
              return T_STRING;
            }
+[^'\\]+ { }
 <> {
                plpgsql_error_lineno = start_lineno;
                ereport(ERROR,
                        (errcode(ERRCODE_DATATYPE_MISMATCH),
                         errmsg("unterminated string")));
            }
-[^'\\]* { }
 
     /* ----------
      * Any unmatched character is returned as is