Skip to content

Commit f12f899

Browse files
committed
Fix error line numbers reported for errors in plpgsql_parse_word and
siblings.
1 parent 3467b1a commit f12f899

File tree

1 file changed

+52
-18
lines changed

1 file changed

+52
-18
lines changed

src/pl/plpgsql/src/scan.l

Lines changed: 52 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* procedural language
55
*
66
* IDENTIFICATION
7-
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.26 2003/05/29 22:30:02 tgl Exp $
7+
* $Header: /cvsroot/pgsql/src/pl/plpgsql/src/Attic/scan.l,v 1.27 2003/06/17 04:35:03 tgl Exp $
88
*
99
* This software is copyrighted by Jan Wieck - Hamburg.
1010
*
@@ -168,25 +168,59 @@ dump { return O_DUMP; }
168168

169169
/* ----------
170170
* Special word rules
171+
*
172+
* We set plpgsql_error_lineno in each rule so that errors reported
173+
* in the pl_comp.c subroutines will point to the right place.
171174
* ----------
172175
*/
173-
{identifier} { return plpgsql_parse_word(yytext); }
174-
{identifier}{space}*\.{space}*{identifier} { return plpgsql_parse_dblword(yytext); }
175-
{identifier}{space}*\.{space}*{identifier}{space}*\.{space}*{identifier} { return plpgsql_parse_tripword(yytext); }
176-
{identifier}{space}*%TYPE { return plpgsql_parse_wordtype(yytext); }
177-
{identifier}{space}*\.{space}*{identifier}{space}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
178-
{identifier}{space}*\.{space}*{identifier}{space}*\.{space}*{identifier}{space}*%TYPE { return plpgsql_parse_tripwordtype(yytext); }
179-
{identifier}{space}*%ROWTYPE { return plpgsql_parse_wordrowtype(yytext); }
180-
{identifier}{space}*\.{space}*{identifier}{space}*%ROWTYPE { return plpgsql_parse_dblwordrowtype(yytext); }
181-
182-
\${digit}+ { return plpgsql_parse_word(yytext); }
183-
\${digit}+{space}*\.{space}*{identifier} { return plpgsql_parse_dblword(yytext); }
184-
\${digit}+{space}*\.{space}*{identifier}{space}*\.{space}*{identifier} { return plpgsql_parse_tripword(yytext); }
185-
\${digit}+{space}*%TYPE { return plpgsql_parse_wordtype(yytext); }
186-
\${digit}+{space}*\.{space}*{identifier}{space}*%TYPE { return plpgsql_parse_dblwordtype(yytext); }
187-
\${digit}+{space}*\.{space}*{identifier}{space}*\.{space}*{identifier}{space}*%TYPE { return plpgsql_parse_tripwordtype(yytext); }
188-
\${digit}+{space}*%ROWTYPE { return plpgsql_parse_wordrowtype(yytext); }
189-
\${digit}+{space}*\.{space}*{identifier}{space}*%ROWTYPE { return plpgsql_parse_dblwordrowtype(yytext); }
176+
{identifier} {
177+
plpgsql_error_lineno = plpgsql_scanner_lineno();
178+
return plpgsql_parse_word(yytext); }
179+
{identifier}{space}*\.{space}*{identifier} {
180+
plpgsql_error_lineno = plpgsql_scanner_lineno();
181+
return plpgsql_parse_dblword(yytext); }
182+
{identifier}{space}*\.{space}*{identifier}{space}*\.{space}*{identifier} {
183+
plpgsql_error_lineno = plpgsql_scanner_lineno();
184+
return plpgsql_parse_tripword(yytext); }
185+
{identifier}{space}*%TYPE {
186+
plpgsql_error_lineno = plpgsql_scanner_lineno();
187+
return plpgsql_parse_wordtype(yytext); }
188+
{identifier}{space}*\.{space}*{identifier}{space}*%TYPE {
189+
plpgsql_error_lineno = plpgsql_scanner_lineno();
190+
return plpgsql_parse_dblwordtype(yytext); }
191+
{identifier}{space}*\.{space}*{identifier}{space}*\.{space}*{identifier}{space}*%TYPE {
192+
plpgsql_error_lineno = plpgsql_scanner_lineno();
193+
return plpgsql_parse_tripwordtype(yytext); }
194+
{identifier}{space}*%ROWTYPE {
195+
plpgsql_error_lineno = plpgsql_scanner_lineno();
196+
return plpgsql_parse_wordrowtype(yytext); }
197+
{identifier}{space}*\.{space}*{identifier}{space}*%ROWTYPE {
198+
plpgsql_error_lineno = plpgsql_scanner_lineno();
199+
return plpgsql_parse_dblwordrowtype(yytext); }
200+
\${digit}+ {
201+
plpgsql_error_lineno = plpgsql_scanner_lineno();
202+
return plpgsql_parse_word(yytext); }
203+
\${digit}+{space}*\.{space}*{identifier} {
204+
plpgsql_error_lineno = plpgsql_scanner_lineno();
205+
return plpgsql_parse_dblword(yytext); }
206+
\${digit}+{space}*\.{space}*{identifier}{space}*\.{space}*{identifier} {
207+
plpgsql_error_lineno = plpgsql_scanner_lineno();
208+
return plpgsql_parse_tripword(yytext); }
209+
\${digit}+{space}*%TYPE {
210+
plpgsql_error_lineno = plpgsql_scanner_lineno();
211+
return plpgsql_parse_wordtype(yytext); }
212+
\${digit}+{space}*\.{space}*{identifier}{space}*%TYPE {
213+
plpgsql_error_lineno = plpgsql_scanner_lineno();
214+
return plpgsql_parse_dblwordtype(yytext); }
215+
\${digit}+{space}*\.{space}*{identifier}{space}*\.{space}*{identifier}{space}*%TYPE {
216+
plpgsql_error_lineno = plpgsql_scanner_lineno();
217+
return plpgsql_parse_tripwordtype(yytext); }
218+
\${digit}+{space}*%ROWTYPE {
219+
plpgsql_error_lineno = plpgsql_scanner_lineno();
220+
return plpgsql_parse_wordrowtype(yytext); }
221+
\${digit}+{space}*\.{space}*{identifier}{space}*%ROWTYPE {
222+
plpgsql_error_lineno = plpgsql_scanner_lineno();
223+
return plpgsql_parse_dblwordrowtype(yytext); }
190224

191225
{digit}+ { return T_NUMBER; }
192226

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy