4
4
* procedural language
5
5
*
6
6
* IDENTIFICATION
7
- * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.42 2003/04/27 22:21:22 tgl Exp $
7
+ * $Header: /cvsroot/pgsql/src/pl/plpgsql/src/gram.y,v 1.43 2003/05/05 16:46:27 tgl Exp $
8
8
*
9
9
* This software is copyrighted by Jan Wieck - Hamburg.
10
10
*
@@ -334,7 +334,7 @@ decl_statement : decl_varname decl_const decl_datatype decl_notnull decl_defval
334
334
/* Composite type --- treat as rowtype */
335
335
PLpgSQL_row *row;
336
336
337
- row = build_rowtype ($3 ->typrelid);
337
+ row = plpgsql_build_rowtype ($3 ->typrelid);
338
338
row->dtype = PLPGSQL_DTYPE_ROW;
339
339
row->refname = $1 .name;
340
340
row->lineno = $1 .lineno;
@@ -486,7 +486,7 @@ decl_cursor_arglist : decl_cursor_arg
486
486
487
487
new ->dtype = PLPGSQL_DTYPE_ROW;
488
488
new ->refname = strdup(" *internal*" );
489
- new ->lineno = yylineno ;
489
+ new ->lineno = plpgsql_scanner_lineno() ;
490
490
new ->rowtypeclass = InvalidOid;
491
491
/*
492
492
* We make temporary fieldnames/varnos arrays that
@@ -553,7 +553,7 @@ decl_aliasitem : T_WORD
553
553
nsi = plpgsql_ns_lookup(name, NULL );
554
554
if (nsi == NULL )
555
555
{
556
- plpgsql_error_lineno = yylineno ;
556
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
557
557
elog (ERROR, " function has no parameter %s" , name);
558
558
}
559
559
@@ -578,7 +578,7 @@ decl_varname : T_WORD
578
578
plpgsql_convert_ident (yytext, &name, 1 );
579
579
/* name should be malloc'd for use as varname */
580
580
$$ .name = strdup(name);
581
- $$ .lineno = yylineno ;
581
+ $$ .lineno = plpgsql_scanner_lineno() ;
582
582
pfree (name);
583
583
}
584
584
;
@@ -625,7 +625,7 @@ decl_defval : ';'
625
625
PLpgSQL_dstring ds;
626
626
PLpgSQL_expr *expr;
627
627
628
- lno = yylineno ;
628
+ lno = plpgsql_scanner_lineno() ;
629
629
expr = malloc(sizeof (PLpgSQL_expr));
630
630
plpgsql_dstring_init (&ds);
631
631
plpgsql_dstring_append (&ds, " SELECT " );
@@ -1034,7 +1034,7 @@ fori_varname : T_VARIABLE
1034
1034
plpgsql_convert_ident (yytext, &name, 1 );
1035
1035
/* name should be malloc'd for use as varname */
1036
1036
$$ .name = strdup(name);
1037
- $$ .lineno = yylineno ;
1037
+ $$ .lineno = plpgsql_scanner_lineno() ;
1038
1038
pfree (name);
1039
1039
}
1040
1040
| T_WORD
@@ -1044,7 +1044,7 @@ fori_varname : T_VARIABLE
1044
1044
plpgsql_convert_ident (yytext, &name, 1 );
1045
1045
/* name should be malloc'd for use as varname */
1046
1046
$$ .name = strdup(name);
1047
- $$ .lineno = yylineno ;
1047
+ $$ .lineno = plpgsql_scanner_lineno() ;
1048
1048
pfree (name);
1049
1049
}
1050
1050
;
@@ -1405,7 +1405,7 @@ stmt_open : K_OPEN lno cursor_varptr
1405
1405
1406
1406
if (tok != ' (' )
1407
1407
{
1408
- plpgsql_error_lineno = yylineno ;
1408
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
1409
1409
elog (ERROR, " cursor %s has arguments" ,
1410
1410
$3 ->refname);
1411
1411
}
@@ -1427,7 +1427,7 @@ stmt_open : K_OPEN lno cursor_varptr
1427
1427
1428
1428
if (strncmp(cp, " SELECT" , 6 ) != 0 )
1429
1429
{
1430
- plpgsql_error_lineno = yylineno ;
1430
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
1431
1431
elog (ERROR, " expected 'SELECT (', got '%s' (internal error)" ,
1432
1432
new ->argquery->query);
1433
1433
}
@@ -1436,7 +1436,7 @@ stmt_open : K_OPEN lno cursor_varptr
1436
1436
cp++;
1437
1437
if (*cp != ' (' )
1438
1438
{
1439
- plpgsql_error_lineno = yylineno ;
1439
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
1440
1440
elog (ERROR, " expected 'SELECT (', got '%s' (internal error)" ,
1441
1441
new ->argquery->query);
1442
1442
}
@@ -1454,13 +1454,13 @@ stmt_open : K_OPEN lno cursor_varptr
1454
1454
1455
1455
if (tok == ' (' )
1456
1456
{
1457
- plpgsql_error_lineno = yylineno ;
1457
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
1458
1458
elog (ERROR, " cursor %s has no arguments" , $3 ->refname);
1459
1459
}
1460
1460
1461
1461
if (tok != ' ;' )
1462
1462
{
1463
- plpgsql_error_lineno = yylineno ;
1463
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
1464
1464
elog (ERROR, " syntax error at \" %s\" " , yytext);
1465
1465
}
1466
1466
}
@@ -1502,7 +1502,7 @@ cursor_varptr : T_VARIABLE
1502
1502
1503
1503
if (((PLpgSQL_var *) yylval.variable)->datatype->typoid != REFCURSOROID)
1504
1504
{
1505
- plpgsql_error_lineno = yylineno ;
1505
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
1506
1506
elog (ERROR, " %s must be of type cursor or refcursor" ,
1507
1507
((PLpgSQL_var *) yylval.variable)->refname);
1508
1508
}
@@ -1517,7 +1517,7 @@ cursor_variable : T_VARIABLE
1517
1517
1518
1518
if (((PLpgSQL_var *) yylval.variable)->datatype->typoid != REFCURSOROID)
1519
1519
{
1520
- plpgsql_error_lineno = yylineno ;
1520
+ plpgsql_error_lineno = plpgsql_scanner_lineno() ;
1521
1521
elog (ERROR, " %s must be of type refcursor" ,
1522
1522
((PLpgSQL_var *) yylval.variable)->refname);
1523
1523
}
@@ -1583,8 +1583,7 @@ opt_lblname : T_WORD
1583
1583
1584
1584
lno :
1585
1585
{
1586
- plpgsql_error_lineno = yylineno;
1587
- $$ = yylineno;
1586
+ $$ = plpgsql_error_lineno = plpgsql_scanner_lineno();
1588
1587
}
1589
1588
;
1590
1589
@@ -1618,7 +1617,7 @@ read_sql_construct(int until,
1618
1617
char buf[32 ];
1619
1618
PLpgSQL_expr *expr;
1620
1619
1621
- lno = yylineno ;
1620
+ lno = plpgsql_scanner_lineno () ;
1622
1621
plpgsql_dstring_init (&ds);
1623
1622
plpgsql_dstring_append (&ds, (char *) sqlstart);
1624
1623
@@ -1690,7 +1689,7 @@ read_datatype(int tok)
1690
1689
bool needspace = false ;
1691
1690
int parenlevel = 0 ;
1692
1691
1693
- lno = yylineno ;
1692
+ lno = plpgsql_scanner_lineno () ;
1694
1693
1695
1694
/* Often there will be a lookahead token, but if not, get one */
1696
1695
if (tok == YYEMPTY)
@@ -1769,14 +1768,14 @@ make_select_stmt(void)
1769
1768
break ;
1770
1769
if (tok == 0 )
1771
1770
{
1772
- plpgsql_error_lineno = yylineno ;
1771
+ plpgsql_error_lineno = plpgsql_scanner_lineno () ;
1773
1772
elog (ERROR, " unexpected end of file" );
1774
1773
}
1775
1774
if (tok == K_INTO)
1776
1775
{
1777
1776
if (have_into)
1778
1777
{
1779
- plpgsql_error_lineno = yylineno ;
1778
+ plpgsql_error_lineno = plpgsql_scanner_lineno () ;
1780
1779
elog (ERROR, " INTO specified more than once" );
1781
1780
}
1782
1781
tok = yylex ();
@@ -1814,7 +1813,7 @@ make_select_stmt(void)
1814
1813
break ;
1815
1814
1816
1815
default :
1817
- plpgsql_error_lineno = yylineno ;
1816
+ plpgsql_error_lineno = plpgsql_scanner_lineno () ;
1818
1817
elog (ERROR, " plpgsql: %s is not a variable" ,
1819
1818
yytext);
1820
1819
}
@@ -1824,7 +1823,7 @@ make_select_stmt(void)
1824
1823
row = malloc (sizeof (PLpgSQL_row));
1825
1824
row->dtype = PLPGSQL_DTYPE_ROW;
1826
1825
row->refname = strdup (" *internal*" );
1827
- row->lineno = yylineno ;
1826
+ row->lineno = plpgsql_scanner_lineno () ;
1828
1827
row->rowtypeclass = InvalidOid;
1829
1828
row->nfields = nfields;
1830
1829
row->fieldnames = malloc (sizeof (char *) * nfields);
@@ -1945,7 +1944,7 @@ make_fetch_stmt(void)
1945
1944
break ;
1946
1945
1947
1946
default :
1948
- plpgsql_error_lineno = yylineno ;
1947
+ plpgsql_error_lineno = plpgsql_scanner_lineno () ;
1949
1948
elog (ERROR, " plpgsql: %s is not a variable" ,
1950
1949
yytext);
1951
1950
}
@@ -1955,7 +1954,7 @@ make_fetch_stmt(void)
1955
1954
row = malloc (sizeof (PLpgSQL_row));
1956
1955
row->dtype = PLPGSQL_DTYPE_ROW;
1957
1956
row->refname = strdup (" *internal*" );
1958
- row->lineno = yylineno ;
1957
+ row->lineno = plpgsql_scanner_lineno () ;
1959
1958
row->rowtypeclass = InvalidOid;
1960
1959
row->nfields = nfields;
1961
1960
row->fieldnames = malloc (sizeof (char *) * nfields);
@@ -2028,7 +2027,7 @@ check_assignable(PLpgSQL_datum *datum)
2028
2027
case PLPGSQL_DTYPE_VAR:
2029
2028
if (((PLpgSQL_var *) datum)->isconst )
2030
2029
{
2031
- plpgsql_error_lineno = yylineno ;
2030
+ plpgsql_error_lineno = plpgsql_scanner_lineno () ;
2032
2031
elog (ERROR, " %s is declared CONSTANT" ,
2033
2032
((PLpgSQL_var *) datum)->refname );
2034
2033
}
0 commit comments