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.
%type any_identifier opt_block_label opt_label option_value
-%type proc_sect proc_stmts stmt_elsifs stmt_else
+%type proc_sect stmt_elsifs stmt_else
%type loop_body
%type proc_stmt pl_block
%type stmt_assign stmt_if stmt_loop stmt_while stmt_exit
%token K_RETURN
%token K_RETURNED_SQLSTATE
%token K_REVERSE
-%token K_ROWTYPE
%token K_ROW_COUNT
+%token K_ROWTYPE
%token K_SCHEMA
%token K_SCHEMA_NAME
%token K_SCROLL
proc_sect :
{ $$ = NIL; }
- | proc_stmts
- { $$ = $1; }
- ;
-
-proc_stmts : proc_stmts proc_stmt
- {
- if ($2 == NULL)
- $$ = $1;
- else
- $$ = lappend($1, $2);
- }
- | proc_stmt
- {
- if ($1 == NULL)
- $$ = NIL;
- else
- $$ = list_make1($1);
- }
+ | proc_sect proc_stmt
+ {
+ /* don't bother linking null statements into list */
+ if ($2 == NULL)
+ $$ = $1;
+ else
+ $$ = lappend($1, $2);
+ }
;
proc_stmt : pl_block ';'
| K_PG_EXCEPTION_CONTEXT
| K_PG_EXCEPTION_DETAIL
| K_PG_EXCEPTION_HINT
- | K_PRIOR
| K_PRINT_STRICT_PARAMS
+ | K_PRIOR
| K_QUERY
| K_RELATIVE
| K_RESULT_OID