aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-02-02 12:51:14 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2014-02-02 12:51:14 -0500
commit46825d4978b63a0ae9637efbf6298220c833fa8d (patch)
tree232ae67828c0aa89e08be33cc9931cb95090242f
parent0753bdb352270a03dec52bc959418fa82e9b07cc (diff)
downloadpostgresql-46825d4978b63a0ae9637efbf6298220c833fa8d.tar.gz
postgresql-46825d4978b63a0ae9637efbf6298220c833fa8d.zip
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.
-rw-r--r--src/backend/replication/repl_gram.y49
1 files changed, 24 insertions, 25 deletions
diff --git a/src/backend/replication/repl_gram.y b/src/backend/replication/repl_gram.y
index d4bd59bab24..c3f4a24a8ff 100644
--- a/src/backend/replication/repl_gram.y
+++ b/src/backend/replication/repl_gram.y
@@ -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"