Clean up some sloppy coding in repl_gram.y.

Remove unused copy-and-pasted macro definitions, and improve formatting
of recently-added productions.

I got interested in this because buildfarm member protosciurus has been
crashing in "bison repl_gram.y" since commit 858ec11.  It's a long shot
that this will fix that, though maybe the missing trailing semicolon
has something to do with it?  In any case, there's no need to approve
of dead code, nor of code whose formatting isn't even self-consistent
let alone consistent with what's around it.
This commit is contained in:
Tom Lane 2014-02-02 12:51:14 -05:00
parent 0753bdb352
commit 46825d4978

View File

@ -25,14 +25,6 @@
/* Result of the parsing is returned here */
Node *replication_parse_result;
/* Location tracking support --- simpler than bison's default */
#define YYLLOC_DEFAULT(Current, Rhs, N) \
do { \
if (N) \
(Current) = (Rhs)[1]; \
else \
(Current) = (Rhs)[0]; \
} while (0)
/*
* Bison doesn't allocate anything that needs to live across parser calls,
@ -45,9 +37,6 @@ Node *replication_parse_result;
#define YYMALLOC palloc
#define YYFREE pfree
#define parser_yyerror(msg) replication_yyerror(msg, yyscanner)
#define parser_errposition(pos) replication_scanner_errposition(pos)
%}
%expect 0
@ -91,6 +80,7 @@ Node *replication_parse_result;
%type <defelt> base_backup_opt
%type <uintval> opt_timeline
%type <str> opt_slot
%%
firstcmd: command opt_semicolon
@ -134,34 +124,38 @@ base_backup:
}
;
base_backup_opt_list: base_backup_opt_list base_backup_opt { $$ = lappend($1, $2); }
| /* EMPTY */ { $$ = NIL; }
base_backup_opt_list:
base_backup_opt_list base_backup_opt
{ $$ = lappend($1, $2); }
| /* EMPTY */
{ $$ = NIL; }
;
base_backup_opt:
K_LABEL SCONST
{
$$ = makeDefElem("label",
(Node *)makeString($2));
(Node *)makeString($2));
}
| K_PROGRESS
{
$$ = makeDefElem("progress",
(Node *)makeInteger(TRUE));
(Node *)makeInteger(TRUE));
}
| K_FAST
{
$$ = makeDefElem("fast",
(Node *)makeInteger(TRUE));
(Node *)makeInteger(TRUE));
}
| K_WAL
{
$$ = makeDefElem("wal",
(Node *)makeInteger(TRUE));
(Node *)makeInteger(TRUE));
}
| K_NOWAIT
{
$$ = makeDefElem("nowait",
(Node *)makeInteger(TRUE));
(Node *)makeInteger(TRUE));
}
;
@ -214,7 +208,8 @@ opt_timeline:
(errmsg("invalid timeline %u", $2))));
$$ = $2;
}
| /* nothing */ { $$ = 0; }
| /* EMPTY */
{ $$ = 0; }
;
/*
@ -237,14 +232,18 @@ timeline_history:
}
;
opt_physical : K_PHYSICAL | /* EMPTY */;
opt_physical:
K_PHYSICAL
| /* EMPTY */
;
opt_slot:
K_SLOT IDENT
{ $$ = $2; }
| /* EMPTY */
{ $$ = NULL; }
;
opt_slot : K_SLOT IDENT
{
$$ = $2;
}
| /* nothing */ { $$ = NULL; }
%%
#include "repl_scanner.c"