pgsql-server/src/pl/plpgsql/src scan.l
pgsql-server/src/pl/plpgsql/src scan.l
От:
momjian@postgresql.org (Bruce Momjian - CVS)
Дата:
CVSROOT: /cvsroot Module name: pgsql-server Changes by: momjian@postgresql.org 02/08/03 23:59:09 Modified files: src/pl/plpgsql/src: scan.l Log message: I send a simple patch for PL/pgSQL parser which allow now to use whitespaces in identifers of any kind(table names,attribute names,variables ...) in Pl/pgSQL procedural language.Explicit definition of bug can be found in Re: [HACKERS] Bug of PL/pgSQL parser TODO item completed: o -Fix PL/PgSQL to handle quoted mixed-case identifiers eutm
Re: pgsql-server/src/pl/plpgsql/src scan.l
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
momjian@postgresql.org (Bruce Momjian - CVS) writes: > I send a simple patch for PL/pgSQL parser which allow now to use > whitespaces in identifers of any kind(table names,attribute > names,variables ...) in Pl/pgSQL procedural language.Explicit definition > of bug can be found in Re: [HACKERS] Bug of PL/pgSQL parser I feel sure I pointed out that this patch is wrong. regards, tom lane
Re: pgsql-server/src/pl/plpgsql/src scan.l
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Tom Lane wrote:
> momjian@postgresql.org (Bruce Momjian - CVS) writes:
> > I send a simple patch for PL/pgSQL parser which allow now to use
> > whitespaces in identifers of any kind(table names,attribute
> > names,variables ...) in Pl/pgSQL procedural language.Explicit definition
> > of bug can be found in Re: [HACKERS] Bug of PL/pgSQL parser
>
> I feel sure I pointed out that this patch is wrong.
Yea, I was already researching this. I can't find your comment and I
thought this was a _newer_ version of the patch. Can't find your
comment in the archives. Let me attach the patch. Is it wrong?
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
--- src/pl/plpgsql/src/scan.l Thu Mar 7 07:52:15 2002
+++ ../DONE/scan.l Mon Jul 22 06:53:14 2002
@@ -57,9 +57,9 @@
%option yylineno
-
-WS [\200-\377_A-Za-z"]
-WC [\200-\377_A-Za-z0-9"]
+DQUOTE \"([^\"])*\"
+WS [\200-\377_A-Za-z]
+WC [\200-\377_A-Za-z0-9]
%x IN_STRING IN_COMMENT
@@ -151,17 +151,48 @@
* ----------
*/
{WS}{WC}* { return plpgsql_parse_word(yytext); }
+{DQUOTE}* { return plpgsql_parse_word(yytext); }
+
{WS}{WC}*\.{WS}{WC}* { return plpgsql_parse_dblword(yytext); }
+{WS}{WC}*\.{DQUOTE}* { return plpgsql_parse_dblword(yytext); }
+{DQUOTE}*\.{WS}{WC}* { return plpgsql_parse_dblword(yytext); }
+{DQUOTE}*\.{DQUOTE}* { return plpgsql_parse_dblword(yytext); }
+
{WS}{WC}*\.{WS}{WC}*\.{WS}{WC}* { return plpgsql_parse_tripword(yytext); }
+{WS}{WC}*\.{WS}{WC}*\.{DQUOTE}* { return plpgsql_parse_tripword(yytext); }
+{WS}{WC}*\.{DQUOTE}*\.{WS}{WC}* { return plpgsql_parse_tripword(yytext); }
+{WS}{WC}*\.{DQUOTE}*\.{DQUOTE}* { return plpgsql_parse_tripword(yytext); }
+{DQUOTE}*\.{WS}{WC}*\.{WS}{WC}* { return plpgsql_parse_tripword(yytext); }
+{DQUOTE}*\.{WS}{WC}*\.{DQUOTE}* { return plpgsql_parse_tripword(yytext); }
+{DQUOTE}*\.{DQUOTE}*\.{WS}{WC}* { return plpgsql_parse_tripword(yytext); }
+{DQUOTE}*\.{DQUOTE}*\.{DQUOTE}* { return plpgsql_parse_tripword(yytext); }
+
{WS}{WC}*%TYPE { return plpgsql_parse_wordtype(yytext); }
+{DQUOTE}*%TYPE { return plpgsql_parse_wordtype(yytext); }
+
{WS}{WC}*\.{WS}{WC}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
+{WS}{WC}*\.{DQUOTE}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
+{DQUOTE}*\.{WS}{WC}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
+{DQUOTE}*\.{DQUOTE}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
+
{WS}{WC}*%ROWTYPE { return plpgsql_parse_wordrowtype(yytext); }
+{DQUOTE}*%ROWTYPE { return plpgsql_parse_wordrowtype(yytext); }
\$[0-9]+ { return plpgsql_parse_word(yytext); }
+
\$[0-9]+\.{WS}{WC}* { return plpgsql_parse_dblword(yytext); }
+\$[0-9]+\.{DQUOTE}* { return plpgsql_parse_dblword(yytext); }
+
\$[0-9]+\.{WS}{WC}*\.{WS}{WC}* { return plpgsql_parse_tripword(yytext); }
+\$[0-9]+\.{WS}{WC}*\.{DQUOTE}* { return plpgsql_parse_tripword(yytext); }
+\$[0-9]+\.{DQUOTE}*\.{WS}{WC}* { return plpgsql_parse_tripword(yytext); }
+\$[0-9]+\.{DQUOTE}*\.{DQUOTE}* { return plpgsql_parse_tripword(yytext); }
+
\$[0-9]+%TYPE { return plpgsql_parse_wordtype(yytext); }
+
\$[0-9]+\.{WS}{WC}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
+\$[0-9]+\.{DQUOTE}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
+
\$[0-9]+%ROWTYPE { return plpgsql_parse_wordrowtype(yytext); }
[0-9]+ { return T_NUMBER; }
Re: pgsql-server/src/pl/plpgsql/src scan.l
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Tom Lane wrote: > momjian@postgresql.org (Bruce Momjian - CVS) writes: > > I send a simple patch for PL/pgSQL parser which allow now to use > > whitespaces in identifers of any kind(table names,attribute > > names,variables ...) in Pl/pgSQL procedural language.Explicit definition > > of bug can be found in Re: [HACKERS] Bug of PL/pgSQL parser > > I feel sure I pointed out that this patch is wrong. OK, I figured it out. The submitter sent the same patch on the 23rd and 30th with different text. I assumed the 30th had the fix but it seems he just sent the same patch. If someone wants to hack it, it is at: http://fts.postgresql.org/db/mw/msg.html?mid=1076915 -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026