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

Commit301de6a

Browse files
committed
Partial pgindent of .l and .y files
Trying to clean up the code a bit while we're working on these filesfor the reentrant scanner/pure parser patches. This cleanup onlytouches the code sections after the second '%%' in each file, via amanually-supervised and locally hacked up pgindent.
1 parent2571c1d commit301de6a

File tree

16 files changed

+207
-188
lines changed

16 files changed

+207
-188
lines changed

‎contrib/cube/cubeparse.y

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ write_box(int dim, char *str1, char *str2,
244244
* The value turned out to be a point, ie. all the upper-right
245245
* coordinates were equal to the lower-left coordinates. Resize the
246246
* cube we constructed. Note: we don't bother to repalloc() it
247-
* smaller, as it's unlikely that the tiny amount of memory freed
248-
*thatway would be useful, and the output is always short-lived.
247+
* smaller, as it's unlikely that the tiny amount of memory freed that
248+
* way would be useful, and the output is always short-lived.
249249
*/
250250
size =POINT_SIZE(dim);
251251
SET_VARSIZE(bp, size);
@@ -260,7 +260,7 @@ static bool
260260
write_point_as_box(int dim,char *str,
261261
NDBOX **result,structNode *escontext)
262262
{
263-
NDBOX*bp;
263+
NDBOX*bp;
264264
inti,
265265
size;
266266
char *s;

‎contrib/cube/cubescan.l

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,23 @@ cube_yyerror(NDBOX **result, Size scanbuflen,
7373
yyscan_t yyscanner,
7474
constchar *message)
7575
{
76-
structyyguts_t * yyg = (structyyguts_t *) yyscanner;/* needed for yytext macro */
76+
structyyguts_t *yyg = (structyyguts_t *) yyscanner;/* needed for yytext
77+
* macro */
7778

7879
if (*yytext == YY_END_OF_BUFFER_CHAR)
7980
{
8081
errsave(escontext,
8182
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
8283
errmsg("invalid input syntax for cube"),
83-
/* translator: %s is typically "syntax error" */
84+
/* translator: %s is typically "syntax error" */
8485
errdetail("%s at end of input", message)));
8586
}
8687
else
8788
{
8889
errsave(escontext,
8990
(errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
9091
errmsg("invalid input syntax for cube"),
91-
/* translator: first %s is typically "syntax error" */
92+
/* translator: first %s is typically "syntax error" */
9293
errdetail("%s at or near\"%s\"", message, yytext)));
9394
}
9495
}

‎contrib/seg/segscan.l

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ float ({integer}|{real})([eE]{integer})?
6666
void
6767
seg_yyerror(SEG *result,structNode *escontext,yyscan_t yyscanner,constchar *message)
6868
{
69-
structyyguts_t * yyg = (structyyguts_t *) yyscanner;/* needed for yytext macro */
69+
structyyguts_t *yyg = (structyyguts_t *) yyscanner;/* needed for yytext
70+
* macro */
7071

7172
/* if we already reported an error, don't overwrite it */
7273
if (SOFT_ERROR_OCCURRED(escontext))
@@ -77,15 +78,15 @@ seg_yyerror(SEG *result, struct Node *escontext, yyscan_t yyscanner, const char
7778
errsave(escontext,
7879
(errcode(ERRCODE_SYNTAX_ERROR),
7980
errmsg("bad seg representation"),
80-
/* translator: %s is typically "syntax error" */
81+
/* translator: %s is typically "syntax error" */
8182
errdetail("%s at end of input", message)));
8283
}
8384
else
8485
{
8586
errsave(escontext,
8687
(errcode(ERRCODE_SYNTAX_ERROR),
8788
errmsg("bad seg representation"),
88-
/* translator: first %s is typically "syntax error" */
89+
/* translator: first %s is typically "syntax error" */
8990
errdetail("%s at or near\"%s\"", message, yytext)));
9091
}
9192
}
@@ -97,7 +98,7 @@ seg_yyerror(SEG *result, struct Node *escontext, yyscan_t yyscanner, const char
9798
void
9899
seg_scanner_init(constchar *str,yyscan_t *yyscannerp)
99100
{
100-
yyscan_tyyscanner;
101+
yyscan_tyyscanner;
101102

102103
if (yylex_init(yyscannerp) !=0)
103104
elog(ERROR,"yylex_init() failed: %m");

‎src/backend/bootstrap/bootscanner.l

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ NULL{ yylval->kw = "NULL"; return XNULL; }
131131
void
132132
boot_yyerror(yyscan_t yyscanner,constchar *message)
133133
{
134-
structyyguts_t * yyg = (structyyguts_t *) yyscanner;/* needed for yylineno macro */
134+
structyyguts_t *yyg = (structyyguts_t *) yyscanner;/* needed for yylineno
135+
* macro */
135136

136137
elog(ERROR,"%s at line %d", message, yylineno);
137138
}
@@ -159,6 +160,6 @@ yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner)
159160
void
160161
yyfree(void *ptr,yyscan_t yyscanner)
161162
{
162-
if (ptr)
163-
pfree(ptr);
163+
if (ptr)
164+
pfree(ptr);
164165
}

‎src/backend/parser/gram.y

Lines changed: 45 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18646,31 +18646,31 @@ updatePreparableStmtEnd(Node *n, int end_location)
1864618646
{
1864718647
if (IsA(n, SelectStmt))
1864818648
{
18649-
SelectStmt *stmt = (SelectStmt *)n;
18649+
SelectStmt *stmt = (SelectStmt *)n;
1865018650

1865118651
stmt->stmt_len = end_location - stmt->stmt_location;
1865218652
}
1865318653
else if (IsA(n, InsertStmt))
1865418654
{
18655-
InsertStmt *stmt = (InsertStmt *)n;
18655+
InsertStmt *stmt = (InsertStmt *)n;
1865618656

1865718657
stmt->stmt_len = end_location - stmt->stmt_location;
1865818658
}
1865918659
else if (IsA(n, UpdateStmt))
1866018660
{
18661-
UpdateStmt *stmt = (UpdateStmt *)n;
18661+
UpdateStmt *stmt = (UpdateStmt *)n;
1866218662

1866318663
stmt->stmt_len = end_location - stmt->stmt_location;
1866418664
}
1866518665
else if (IsA(n, DeleteStmt))
1866618666
{
18667-
DeleteStmt *stmt = (DeleteStmt *)n;
18667+
DeleteStmt *stmt = (DeleteStmt *)n;
1866818668

1866918669
stmt->stmt_len = end_location - stmt->stmt_location;
1867018670
}
1867118671
else if (IsA(n, MergeStmt))
1867218672
{
18673-
MergeStmt *stmt = (MergeStmt *)n;
18673+
MergeStmt*stmt = (MergeStmt *)n;
1867418674

1867518675
stmt->stmt_len = end_location - stmt->stmt_location;
1867618676
}
@@ -18683,10 +18683,10 @@ makeColumnRef(char *colname, List *indirection,
1868318683
int location, core_yyscan_t yyscanner)
1868418684
{
1868518685
/*
18686-
* Generate a ColumnRef node, with an A_Indirection node added if there
18687-
*isany subscripting in the specified indirection list. However,
18688-
*any fieldselection at the start of the indirection list must be
18689-
*transposed intothe "fields" part of the ColumnRef node.
18686+
* Generate a ColumnRef node, with an A_Indirection node added if there is
18687+
* any subscripting in the specified indirection list. However, any field
18688+
* selection at the start of the indirection list must be transposed into
18689+
* the "fields" part of the ColumnRef node.
1869018690
*/
1869118691
ColumnRef *c = makeNode(ColumnRef);
1869218692
intnfields = 0;
@@ -18752,55 +18752,55 @@ makeStringConstCast(char *str, int location, TypeName *typename)
1875218752
static Node *
1875318753
makeIntConst(int val, int location)
1875418754
{
18755-
A_Const *n = makeNode(A_Const);
18755+
A_Const *n = makeNode(A_Const);
1875618756

1875718757
n->val.ival.type = T_Integer;
1875818758
n->val.ival.ival = val;
1875918759
n->location = location;
1876018760

18761-
return (Node *) n;
18761+
return (Node *) n;
1876218762
}
1876318763

1876418764
static Node *
1876518765
makeFloatConst(char *str, int location)
1876618766
{
18767-
A_Const *n = makeNode(A_Const);
18767+
A_Const *n = makeNode(A_Const);
1876818768

1876918769
n->val.fval.type = T_Float;
1877018770
n->val.fval.fval = str;
1877118771
n->location = location;
1877218772

18773-
return (Node *) n;
18773+
return (Node *) n;
1877418774
}
1877518775

1877618776
static Node *
1877718777
makeBoolAConst(bool state, int location)
1877818778
{
18779-
A_Const *n = makeNode(A_Const);
18779+
A_Const *n = makeNode(A_Const);
1878018780

1878118781
n->val.boolval.type = T_Boolean;
1878218782
n->val.boolval.boolval = state;
1878318783
n->location = location;
1878418784

18785-
return (Node *) n;
18785+
return (Node *) n;
1878618786
}
1878718787

1878818788
static Node *
1878918789
makeBitStringConst(char *str, int location)
1879018790
{
18791-
A_Const *n = makeNode(A_Const);
18791+
A_Const *n = makeNode(A_Const);
1879218792

1879318793
n->val.bsval.type = T_BitString;
1879418794
n->val.bsval.bsval = str;
1879518795
n->location = location;
1879618796

18797-
return (Node *) n;
18797+
return (Node *) n;
1879818798
}
1879918799

1880018800
static Node *
1880118801
makeNullAConst(int location)
1880218802
{
18803-
A_Const *n = makeNode(A_Const);
18803+
A_Const *n = makeNode(A_Const);
1880418804

1880518805
n->isnull = true;
1880618806
n->location = location;
@@ -18889,7 +18889,7 @@ check_func_name(List *names, core_yyscan_t yyscanner)
1888918889
static List *
1889018890
check_indirection(List *indirection, core_yyscan_t yyscanner)
1889118891
{
18892-
ListCell *l;
18892+
ListCell*l;
1889318893

1889418894
foreach(l, indirection)
1889518895
{
@@ -18944,16 +18944,16 @@ makeOrderedSetArgs(List *directargs, List *orderedargs,
1894418944
core_yyscan_t yyscanner)
1894518945
{
1894618946
FunctionParameter *lastd = (FunctionParameter *) llast(directargs);
18947-
Integer *ndirectargs;
18947+
Integer *ndirectargs;
1894818948

1894918949
/* No restriction unless last direct arg is VARIADIC*/
1895018950
if (lastd->mode == FUNC_PARAM_VARIADIC)
1895118951
{
1895218952
FunctionParameter *firsto = (FunctionParameter *) linitial(orderedargs);
1895318953

1895418954
/*
18955-
* We ignore the names, though the aggr_arg production allows them;
18956-
*itdoesn't allow default values, so those need not be checked.
18955+
* We ignore the names, though the aggr_arg production allows them; it
18956+
* doesn't allow default values, so those need not be checked.
1895718957
*/
1895818958
if (list_length(orderedargs) != 1 ||
1895918959
firsto->mode != FUNC_PARAM_VARIADIC ||
@@ -19115,7 +19115,7 @@ doNegate(Node *n, int location)
1911519115
{
1911619116
if (IsA(n, A_Const))
1911719117
{
19118-
A_Const *con = (A_Const *) n;
19118+
A_Const *con = (A_Const *) n;
1911919119

1912019120
/* report the constant's location as that of the '-' sign*/
1912119121
con->location = location;
@@ -19143,7 +19143,7 @@ doNegateFloat(Float *v)
1914319143
if (*oldval == '+')
1914419144
oldval++;
1914519145
if (*oldval == '-')
19146-
v->fval = oldval+1;/* just strip the '-'*/
19146+
v->fval = oldval +1;/* just strip the '-'*/
1914719147
else
1914819148
v->fval = psprintf("-%s", oldval);
1914919149
}
@@ -19214,10 +19214,11 @@ static Node *
1921419214
makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
1921519215
int location)
1921619216
{
19217-
XmlExpr*x = makeNode(XmlExpr);
19217+
XmlExpr*x = makeNode(XmlExpr);
1921819218

1921919219
x->op = op;
1922019220
x->name = name;
19221+
1922119222
/*
1922219223
* named_args is a list of ResTarget; it'll be split apart into separate
1922319224
* expression and name lists in transformXmlExpr().
@@ -19227,7 +19228,7 @@ makeXmlExpr(XmlExprOp op, char *name, List *named_args, List *args,
1922719228
x->args = args;
1922819229
/* xmloption, if relevant, must be filled in by caller*/
1922919230
/* type and typmod will be filled in during parse analysis*/
19230-
x->type = InvalidOid;/* marks the node as not analyzed*/
19231+
x->type = InvalidOid;/* marks the node as not analyzed*/
1923119232
x->location = location;
1923219233
return (Node *) x;
1923319234
}
@@ -19352,7 +19353,7 @@ makeRangeVarFromQualifiedName(char *name, List *namelist, int location,
1935219353
errcode(ERRCODE_SYNTAX_ERROR),
1935319354
errmsg("improper qualified name (too many dotted names): %s",
1935419355
NameListToString(lcons(makeString(name),namelist))),
19355-
parser_errposition(location));
19356+
parser_errposition(location));
1935619357
break;
1935719358
}
1935819359

@@ -19421,7 +19422,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
1942119422
else
1942219423
ereport(ERROR,
1942319424
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
19424-
/* translator: %s is CHECK, UNIQUE, or similar*/
19425+
/* translator: %s is CHECK, UNIQUE, or similar*/
1942519426
errmsg("%s constraints cannot be marked DEFERRABLE",
1942619427
constrType),
1942719428
parser_errposition(location)));
@@ -19434,7 +19435,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
1943419435
else
1943519436
ereport(ERROR,
1943619437
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
19437-
/* translator: %s is CHECK, UNIQUE, or similar*/
19438+
/* translator: %s is CHECK, UNIQUE, or similar*/
1943819439
errmsg("%s constraints cannot be marked DEFERRABLE",
1943919440
constrType),
1944019441
parser_errposition(location)));
@@ -19447,7 +19448,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
1944719448
else
1944819449
ereport(ERROR,
1944919450
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
19450-
/* translator: %s is CHECK, UNIQUE, or similar*/
19451+
/* translator: %s is CHECK, UNIQUE, or similar*/
1945119452
errmsg("%s constraints cannot be marked NOT VALID",
1945219453
constrType),
1945319454
parser_errposition(location)));
@@ -19460,7 +19461,7 @@ processCASbits(int cas_bits, int location, const char *constrType,
1946019461
else
1946119462
ereport(ERROR,
1946219463
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
19463-
/* translator: %s is CHECK, UNIQUE, or similar*/
19464+
/* translator: %s is CHECK, UNIQUE, or similar*/
1946419465
errmsg("%s constraints cannot be marked NO INHERIT",
1946519466
constrType),
1946619467
parser_errposition(location)));
@@ -19485,7 +19486,7 @@ parsePartitionStrategy(char *strategy, int location, core_yyscan_t yyscanner)
1948519486
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1948619487
errmsg("unrecognized partitioning strategy \"%s\"", strategy),
1948719488
parser_errposition(location)));
19488-
return PARTITION_STRATEGY_LIST;/* keep compiler quiet*/
19489+
return PARTITION_STRATEGY_LIST;/* keep compiler quiet*/
1948919490

1949019491
}
1949119492

@@ -19556,8 +19557,8 @@ preprocess_pubobj_list(List *pubobjspec_list, core_yyscan_t yyscanner)
1955619557
parser_errposition(pubobj->location));
1955719558

1955819559
/*
19559-
* We can distinguish between the different type of schema
19560-
*objectsbased on whether name and pubtable is set.
19560+
* We can distinguish between the different type of schema objects
19561+
* based on whether name and pubtable is set.
1956119562
*/
1956219563
if (pubobj->name)
1956319564
pubobj->pubobjtype = PUBLICATIONOBJ_TABLES_IN_SCHEMA;
@@ -19612,11 +19613,13 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
1961219613
w->ctes = list_make1(cte);
1961319614
w->location = -1;
1961419615

19615-
/* create target list for the new SELECT from the alias list of the
19616-
* recursive view specification*/
19617-
foreach (lc, aliases)
19616+
/*
19617+
* create target list for the new SELECT from the alias list of the
19618+
* recursive view specification
19619+
*/
19620+
foreach(lc, aliases)
1961819621
{
19619-
ResTarget *rt = makeNode(ResTarget);
19622+
ResTarget*rt = makeNode(ResTarget);
1962019623

1962119624
rt->name = NULL;
1962219625
rt->indirection = NIL;
@@ -19626,8 +19629,10 @@ makeRecursiveViewSelect(char *relname, List *aliases, Node *query)
1962619629
tl = lappend(tl, rt);
1962719630
}
1962819631

19629-
/* create new SELECT combining WITH clause, target list, and fake FROM
19630-
* clause*/
19632+
/*
19633+
* create new SELECT combining WITH clause, target list, and fake FROM
19634+
* clause
19635+
*/
1963119636
s->withClause = w;
1963219637
s->targetList = tl;
1963319638
s->fromClause = list_make1(makeRangeVar(NULL, relname, -1));

‎src/backend/parser/scan.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1468,9 +1468,9 @@ check_escape_warning(core_yyscan_t yyscanner)
14681468
ereport(WARNING,
14691469
(errcode(ERRCODE_NONSTANDARD_USE_OF_ESCAPE_CHARACTER),
14701470
errmsg("nonstandard use of escape in a string literal"),
1471-
errhint("Use the escape string syntax for escapes, e.g., E'\\r\\n'."),
1471+
errhint("Use the escape string syntax for escapes, e.g., E'\\r\\n'."),
14721472
lexer_errposition()));
1473-
yyextra->warn_on_first_escape =false;/* warn only once per string */
1473+
yyextra->warn_on_first_escape =false;/* warn only once per string */
14741474
}
14751475

14761476
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp