Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite2dc3f5

Browse files
committed
Get rid of redundant production in plpgsql grammar.
There may once have been a reason for the intermediate proc_stmtsproduction in the plpgsql grammar, but it isn't doing anything usefulanymore, so let's collapse it into proc_sect. Saves some code andprobably 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 thebasis of the lower-case spelling.Noted while fooling with a patch to de-reserve more plpgsql keywords.
1 parent02d5ab6 commite2dc3f5

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

‎src/pl/plpgsql/src/pl_gram.y

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ staticvoidcheck_raise_parameters(PLpgSQL_stmt_raise *stmt);
188188

189189
%type<str>any_identifieropt_block_labelopt_labeloption_value
190190

191-
%type<list>proc_sectproc_stmtsstmt_elsifsstmt_else
191+
%type<list>proc_sectstmt_elsifsstmt_else
192192
%type<loop_body>loop_body
193193
%type<stmt>proc_stmtpl_block
194194
%type<stmt>stmt_assignstmt_ifstmt_loopstmt_whilestmt_exit
@@ -318,8 +318,8 @@ staticvoidcheck_raise_parameters(PLpgSQL_stmt_raise *stmt);
318318
%token<keyword>K_RETURN
319319
%token<keyword>K_RETURNED_SQLSTATE
320320
%token<keyword>K_REVERSE
321-
%token<keyword>K_ROWTYPE
322321
%token<keyword>K_ROW_COUNT
322+
%token<keyword>K_ROWTYPE
323323
%token<keyword>K_SCHEMA
324324
%token<keyword>K_SCHEMA_NAME
325325
%token<keyword>K_SCROLL
@@ -838,24 +838,14 @@ assign_operator: '='
838838

839839
proc_sect:
840840
{ $$ = NIL; }
841-
| proc_stmts
842-
{ $$ = $1; }
843-
;
844-
845-
proc_stmts: proc_stmts proc_stmt
846-
{
847-
if ($2 ==NULL)
848-
$$ = $1;
849-
else
850-
$$ =lappend($1, $2);
851-
}
852-
| proc_stmt
853-
{
854-
if ($1 ==NULL)
855-
$$ = NIL;
856-
else
857-
$$ =list_make1($1);
858-
}
841+
| proc_sect proc_stmt
842+
{
843+
/* don't bother linking null statements into list*/
844+
if ($2 ==NULL)
845+
$$ = $1;
846+
else
847+
$$ =lappend($1, $2);
848+
}
859849
;
860850

861851
proc_stmt: pl_block';'
@@ -2356,8 +2346,8 @@ unreserved_keyword:
23562346
| K_PG_EXCEPTION_CONTEXT
23572347
| K_PG_EXCEPTION_DETAIL
23582348
| K_PG_EXCEPTION_HINT
2359-
| K_PRIOR
23602349
| K_PRINT_STRICT_PARAMS
2350+
| K_PRIOR
23612351
| K_QUERY
23622352
| K_RELATIVE
23632353
| K_RESULT_OID

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp