Commit fa96a5e1 authored by Tom Lane's avatar Tom Lane

Add %option nodefault to all our flex lexers. Fix a couple of rule gaps

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.
parent 58e70532
...@@ -26,6 +26,7 @@ void cube_scanner_finish(void); ...@@ -26,6 +26,7 @@ void cube_scanner_finish(void);
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option nounput %option nounput
%option noyywrap %option noyywrap
%option prefix="cube_yy" %option prefix="cube_yy"
...@@ -44,7 +45,7 @@ float ({integer}|{real})([eE]{integer})? ...@@ -44,7 +45,7 @@ float ({integer}|{real})([eE]{integer})?
\( yylval = "("; return O_PAREN; \( yylval = "("; return O_PAREN;
\) yylval = ")"; return C_PAREN; \) yylval = ")"; return C_PAREN;
\, yylval = ")"; return COMMA; \, yylval = ")"; return COMMA;
[ ]+ /* discard spaces */ [ \t\n\r\f]+ /* discard spaces */
. return yytext[0]; /* alert parser of the garbage */ . return yytext[0]; /* alert parser of the garbage */
%% %%
......
...@@ -25,6 +25,7 @@ void seg_scanner_finish(void); ...@@ -25,6 +25,7 @@ void seg_scanner_finish(void);
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option nounput %option nounput
%option noyywrap %option noyywrap
%option prefix="seg_yy" %option prefix="seg_yy"
...@@ -44,7 +45,7 @@ float ({integer}|{real})([eE]{integer})? ...@@ -44,7 +45,7 @@ float ({integer}|{real})([eE]{integer})?
\< yylval.text = "<"; return EXTENSION; \< yylval.text = "<"; return EXTENSION;
\> yylval.text = ">"; return EXTENSION; \> 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 */ . return yytext[0]; /* alert parser of the garbage */
%% %%
......
...@@ -16,6 +16,7 @@ YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */ ...@@ -16,6 +16,7 @@ YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option nounput %option nounput
%option noyywrap %option noyywrap
......
...@@ -18,6 +18,7 @@ YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */ ...@@ -18,6 +18,7 @@ YY_BUFFER_STATE buf = NULL; /* buffer to parse; it need for parse from string */
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option nounput %option nounput
%option noyywrap %option noyywrap
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * 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 */ ...@@ -53,6 +53,7 @@ static int yyline; /* keep track of the line number for error reporting */
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option nounput %option nounput
%option noyywrap %option noyywrap
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* Copyright (c) 2000-2003, PostgreSQL Global Development Group * 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 *); ...@@ -47,6 +47,7 @@ char *GUC_scanstr(char *);
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option nounput %option nounput
%option noyywrap %option noyywrap
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * 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 ...@@ -70,6 +70,7 @@ static struct _if_value
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option noyywrap %option noyywrap
%option yylineno %option yylineno
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* procedural language * procedural language
* *
* IDENTIFICATION * 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. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -63,6 +63,7 @@ int plpgsql_SpaceScanned = 0; ...@@ -63,6 +63,7 @@ int plpgsql_SpaceScanned = 0;
%option 8bit %option 8bit
%option never-interactive %option never-interactive
%option nodefault
%option nounput %option nounput
%option noyywrap %option noyywrap
...@@ -272,6 +273,7 @@ dump { return O_DUMP; } ...@@ -272,6 +273,7 @@ dump { return O_DUMP; }
BEGIN IN_STRING; BEGIN IN_STRING;
} }
<IN_STRING>\\. { } <IN_STRING>\\. { }
<IN_STRING>\\ { /* can only happen with \ at EOF */ }
<IN_STRING>'' { } <IN_STRING>'' { }
<IN_STRING>' { <IN_STRING>' {
yyleng -= (yytext - start_charpos); yyleng -= (yytext - start_charpos);
...@@ -279,13 +281,13 @@ dump { return O_DUMP; } ...@@ -279,13 +281,13 @@ dump { return O_DUMP; }
BEGIN INITIAL; BEGIN INITIAL;
return T_STRING; return T_STRING;
} }
<IN_STRING>[^'\\]+ { }
<IN_STRING><<EOF>> { <IN_STRING><<EOF>> {
plpgsql_error_lineno = start_lineno; plpgsql_error_lineno = start_lineno;
ereport(ERROR, ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH), (errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("unterminated string"))); errmsg("unterminated string")));
} }
<IN_STRING>[^'\\]* { }
/* ---------- /* ----------
* Any unmatched character is returned as is * Any unmatched character is returned as is
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment