Commit e2dc3f57 authored by Tom Lane's avatar Tom Lane

Get rid of redundant production in plpgsql grammar.

There may once have been a reason for the intermediate proc_stmts
production in the plpgsql grammar, but it isn't doing anything useful
anymore, so let's collapse it into proc_sect.  Saves some code and
probably a small number of nanoseconds per statement list.

In passing, correctly alphabetize keyword lists to match pl_scanner.c;
note that for "rowtype" vs "row_count", pl_scanner.c must sort on the
basis of the lower-case spelling.

Noted while fooling with a patch to de-reserve more plpgsql keywords.
parent 02d5ab6a
...@@ -188,7 +188,7 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt); ...@@ -188,7 +188,7 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
%type <str> any_identifier opt_block_label opt_label option_value %type <str> any_identifier opt_block_label opt_label option_value
%type <list> proc_sect proc_stmts stmt_elsifs stmt_else %type <list> proc_sect stmt_elsifs stmt_else
%type <loop_body> loop_body %type <loop_body> loop_body
%type <stmt> proc_stmt pl_block %type <stmt> proc_stmt pl_block
%type <stmt> stmt_assign stmt_if stmt_loop stmt_while stmt_exit %type <stmt> stmt_assign stmt_if stmt_loop stmt_while stmt_exit
...@@ -318,8 +318,8 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt); ...@@ -318,8 +318,8 @@ static void check_raise_parameters(PLpgSQL_stmt_raise *stmt);
%token <keyword> K_RETURN %token <keyword> K_RETURN
%token <keyword> K_RETURNED_SQLSTATE %token <keyword> K_RETURNED_SQLSTATE
%token <keyword> K_REVERSE %token <keyword> K_REVERSE
%token <keyword> K_ROWTYPE
%token <keyword> K_ROW_COUNT %token <keyword> K_ROW_COUNT
%token <keyword> K_ROWTYPE
%token <keyword> K_SCHEMA %token <keyword> K_SCHEMA
%token <keyword> K_SCHEMA_NAME %token <keyword> K_SCHEMA_NAME
%token <keyword> K_SCROLL %token <keyword> K_SCROLL
...@@ -838,24 +838,14 @@ assign_operator : '=' ...@@ -838,24 +838,14 @@ assign_operator : '='
proc_sect : proc_sect :
{ $$ = NIL; } { $$ = NIL; }
| proc_stmts | proc_sect proc_stmt
{ $$ = $1; } {
; /* don't bother linking null statements into list */
if ($2 == NULL)
proc_stmts : proc_stmts proc_stmt $$ = $1;
{ else
if ($2 == NULL) $$ = lappend($1, $2);
$$ = $1; }
else
$$ = lappend($1, $2);
}
| proc_stmt
{
if ($1 == NULL)
$$ = NIL;
else
$$ = list_make1($1);
}
; ;
proc_stmt : pl_block ';' proc_stmt : pl_block ';'
...@@ -2356,8 +2346,8 @@ unreserved_keyword : ...@@ -2356,8 +2346,8 @@ unreserved_keyword :
| K_PG_EXCEPTION_CONTEXT | K_PG_EXCEPTION_CONTEXT
| K_PG_EXCEPTION_DETAIL | K_PG_EXCEPTION_DETAIL
| K_PG_EXCEPTION_HINT | K_PG_EXCEPTION_HINT
| K_PRIOR
| K_PRINT_STRICT_PARAMS | K_PRINT_STRICT_PARAMS
| K_PRIOR
| K_QUERY | K_QUERY
| K_RELATIVE | K_RELATIVE
| K_RESULT_OID | K_RESULT_OID
......
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