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

Commitb1ef489

Browse files
committed
flex code modernization: Replace YY_EXTRA_TYPE define with flex option
Replace #define YY_EXTRA_TYPE with %option extra-type. The latter isthe way recommended by the flex manual (available since flex 2.5.34).Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Discussion:https://www.postgresql.org/message-id/flat/eb6faeac-2a8a-4b69-9189-c33c520e5b7b@eisentraut.org
1 parent632384d commitb1ef489

File tree

6 files changed

+16
-21
lines changed

6 files changed

+16
-21
lines changed

‎src/backend/parser/scan.l

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ const uint16 ScanKeywordTokens[] = {
8989
*/
9090
#defineYYSTYPE core_YYSTYPE
9191

92-
/*
93-
* Set the type of yyextra. All state variables used by the scanner should
94-
* be in yyextra, *not* statically allocated.
95-
*/
96-
#defineYY_EXTRA_TYPE core_yy_extra_type *
97-
9892
/*
9993
* Each call to yylex must set yylloc to the location of the found token
10094
* (expressed as a byte offset from the start of the input text).
@@ -161,6 +155,7 @@ extern void core_yyset_column(int column_no, yyscan_t yyscanner);
161155
%optionnoyyfree
162156
%optionwarn
163157
%optionprefix="core_yy"
158+
%optionextra-type="core_yy_extra_type*"
164159

165160
/*
166161
* OK, here is a short description of lex/flex rules behavior.

‎src/backend/replication/repl_scanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ struct replication_yy_extra_type
4646
/* Work area for collecting literals */
4747
StringInfoData litbuf;
4848
};
49-
#defineYY_EXTRA_TYPEstructreplication_yy_extra_type *
5049

5150
staticvoidstartlit(yyscan_t yyscanner);
5251
staticchar *litbufdup(yyscan_t yyscanner);
@@ -70,6 +69,7 @@ static void addlitchar(unsigned char ychar, yyscan_t yyscanner);
7069
%optionnoyyfree
7170
%optionwarn
7271
%optionprefix="replication_yy"
72+
%optionextra-type="structreplication_yy_extra_type*"
7373

7474
/*
7575
* Exclusive states:

‎src/backend/replication/syncrep_scanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ struct syncrep_yy_extra_type
4141
{
4242
StringInfoData xdbuf;
4343
};
44-
#defineYY_EXTRA_TYPEstructsyncrep_yy_extra_type *
4544

4645
/* LCOV_EXCL_START*/
4746

@@ -60,6 +59,7 @@ struct syncrep_yy_extra_type
6059
%optionnoyyfree
6160
%optionwarn
6261
%optionprefix="syncrep_yy"
62+
%optionextra-type="structsyncrep_yy_extra_type*"
6363

6464
/*
6565
* <xd> delimited identifiers (double-quoted identifiers)

‎src/backend/utils/adt/jsonpath_scan.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ struct jsonpath_yy_extra_type
3434
{
3535
JsonPathString scanstring;
3636
};
37-
#defineYY_EXTRA_TYPEstructjsonpath_yy_extra_type *
3837

3938
staticvoidaddstring(bool init,char *s,int l,yyscan_t yyscanner);
4039
staticvoidaddchar(bool init,char c,yyscan_t yyscanner);
@@ -64,6 +63,7 @@ fprintf_to_ereport(const char *fmt, const char *msg)
6463
%optionnoyywrap
6564
%optionwarn
6665
%optionprefix="jsonpath_yy"
66+
%optionextra-type="structjsonpath_yy_extra_type*"
6767
%optionreentrant
6868
%optionbison-bridge
6969
%optionnoyyalloc

‎src/bin/psql/psqlscanslash.l

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@
3838
*/
3939
typedefint YYSTYPE;
4040

41-
/*
42-
* Set the type of yyextra; we use it as a pointer back to the containing
43-
* PsqlScanState.
44-
*/
45-
#defineYY_EXTRA_TYPE PsqlScanState
46-
4741
/*
4842
* These variables do not need to be saved across calls. Yeah, it's a bit
4943
* of a hack, but putting them into PsqlScanStateData would be klugy too.
@@ -88,6 +82,12 @@ extern void slash_yyset_column(int column_no, yyscan_t yyscanner);
8882
%optionwarn
8983
%optionprefix="slash_yy"
9084

85+
/*
86+
* Set the type of yyextra; we use it as a pointer back to the containing
87+
* PsqlScanState.
88+
*/
89+
%optionextra-type="PsqlScanState"
90+
9191
/*
9292
* OK, here is a short description of lex/flex rules behavior.
9393
* The longest pattern which matches an input string is always chosen.

‎src/fe_utils/psqlscan.l

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,6 @@
5252
*/
5353
typedefint YYSTYPE;
5454

55-
/*
56-
* Set the type of yyextra; we use it as a pointer back to the containing
57-
* PsqlScanState.
58-
*/
59-
#defineYY_EXTRA_TYPE PsqlScanState
60-
6155

6256
/* Return values from yylex()*/
6357
#defineLEXRES_EOL0/* end of input*/
@@ -89,6 +83,12 @@ extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
8983
%optionwarn
9084
%optionprefix="psql_yy"
9185

86+
/*
87+
* Set the type of yyextra; we use it as a pointer back to the containing
88+
* PsqlScanState.
89+
*/
90+
%optionextra-type="PsqlScanState"
91+
9292
/*
9393
* All of the following definitions and rules should exactly match
9494
* src/backend/parser/scan.l so far as the flex patterns are concerned.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp