mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
flex code modernization: Replace YY_EXTRA_TYPE define with flex option
Replace #define YY_EXTRA_TYPE with %option extra-type. The latter is the 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
This commit is contained in:
@ -89,12 +89,6 @@ const uint16 ScanKeywordTokens[] = {
|
|||||||
*/
|
*/
|
||||||
#define YYSTYPE core_YYSTYPE
|
#define YYSTYPE core_YYSTYPE
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the type of yyextra. All state variables used by the scanner should
|
|
||||||
* be in yyextra, *not* statically allocated.
|
|
||||||
*/
|
|
||||||
#define YY_EXTRA_TYPE core_yy_extra_type *
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Each call to yylex must set yylloc to the location of the found token
|
* Each call to yylex must set yylloc to the location of the found token
|
||||||
* (expressed as a byte offset from the start of the input text).
|
* (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);
|
|||||||
%option noyyfree
|
%option noyyfree
|
||||||
%option warn
|
%option warn
|
||||||
%option prefix="core_yy"
|
%option prefix="core_yy"
|
||||||
|
%option extra-type="core_yy_extra_type *"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OK, here is a short description of lex/flex rules behavior.
|
* OK, here is a short description of lex/flex rules behavior.
|
||||||
|
@ -46,7 +46,6 @@ struct replication_yy_extra_type
|
|||||||
/* Work area for collecting literals */
|
/* Work area for collecting literals */
|
||||||
StringInfoData litbuf;
|
StringInfoData litbuf;
|
||||||
};
|
};
|
||||||
#define YY_EXTRA_TYPE struct replication_yy_extra_type *
|
|
||||||
|
|
||||||
static void startlit(yyscan_t yyscanner);
|
static void startlit(yyscan_t yyscanner);
|
||||||
static char *litbufdup(yyscan_t yyscanner);
|
static char *litbufdup(yyscan_t yyscanner);
|
||||||
@ -70,6 +69,7 @@ static void addlitchar(unsigned char ychar, yyscan_t yyscanner);
|
|||||||
%option noyyfree
|
%option noyyfree
|
||||||
%option warn
|
%option warn
|
||||||
%option prefix="replication_yy"
|
%option prefix="replication_yy"
|
||||||
|
%option extra-type="struct replication_yy_extra_type *"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exclusive states:
|
* Exclusive states:
|
||||||
|
@ -41,7 +41,6 @@ struct syncrep_yy_extra_type
|
|||||||
{
|
{
|
||||||
StringInfoData xdbuf;
|
StringInfoData xdbuf;
|
||||||
};
|
};
|
||||||
#define YY_EXTRA_TYPE struct syncrep_yy_extra_type *
|
|
||||||
|
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
|
|
||||||
@ -60,6 +59,7 @@ struct syncrep_yy_extra_type
|
|||||||
%option noyyfree
|
%option noyyfree
|
||||||
%option warn
|
%option warn
|
||||||
%option prefix="syncrep_yy"
|
%option prefix="syncrep_yy"
|
||||||
|
%option extra-type="struct syncrep_yy_extra_type *"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* <xd> delimited identifiers (double-quoted identifiers)
|
* <xd> delimited identifiers (double-quoted identifiers)
|
||||||
|
@ -34,7 +34,6 @@ struct jsonpath_yy_extra_type
|
|||||||
{
|
{
|
||||||
JsonPathString scanstring;
|
JsonPathString scanstring;
|
||||||
};
|
};
|
||||||
#define YY_EXTRA_TYPE struct jsonpath_yy_extra_type *
|
|
||||||
|
|
||||||
static void addstring(bool init, char *s, int l, yyscan_t yyscanner);
|
static void addstring(bool init, char *s, int l, yyscan_t yyscanner);
|
||||||
static void addchar(bool init, char c, yyscan_t yyscanner);
|
static void addchar(bool init, char c, yyscan_t yyscanner);
|
||||||
@ -64,6 +63,7 @@ fprintf_to_ereport(const char *fmt, const char *msg)
|
|||||||
%option noyywrap
|
%option noyywrap
|
||||||
%option warn
|
%option warn
|
||||||
%option prefix="jsonpath_yy"
|
%option prefix="jsonpath_yy"
|
||||||
|
%option extra-type="struct jsonpath_yy_extra_type *"
|
||||||
%option reentrant
|
%option reentrant
|
||||||
%option bison-bridge
|
%option bison-bridge
|
||||||
%option noyyalloc
|
%option noyyalloc
|
||||||
|
@ -38,12 +38,6 @@
|
|||||||
*/
|
*/
|
||||||
typedef int YYSTYPE;
|
typedef int YYSTYPE;
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the type of yyextra; we use it as a pointer back to the containing
|
|
||||||
* PsqlScanState.
|
|
||||||
*/
|
|
||||||
#define YY_EXTRA_TYPE PsqlScanState
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These variables do not need to be saved across calls. Yeah, it's a bit
|
* These variables do not need to be saved across calls. Yeah, it's a bit
|
||||||
* of a hack, but putting them into PsqlScanStateData would be klugy too.
|
* 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);
|
|||||||
%option warn
|
%option warn
|
||||||
%option prefix="slash_yy"
|
%option prefix="slash_yy"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the type of yyextra; we use it as a pointer back to the containing
|
||||||
|
* PsqlScanState.
|
||||||
|
*/
|
||||||
|
%option extra-type="PsqlScanState"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* OK, here is a short description of lex/flex rules behavior.
|
* OK, here is a short description of lex/flex rules behavior.
|
||||||
* The longest pattern which matches an input string is always chosen.
|
* The longest pattern which matches an input string is always chosen.
|
||||||
|
@ -52,12 +52,6 @@
|
|||||||
*/
|
*/
|
||||||
typedef int YYSTYPE;
|
typedef int YYSTYPE;
|
||||||
|
|
||||||
/*
|
|
||||||
* Set the type of yyextra; we use it as a pointer back to the containing
|
|
||||||
* PsqlScanState.
|
|
||||||
*/
|
|
||||||
#define YY_EXTRA_TYPE PsqlScanState
|
|
||||||
|
|
||||||
|
|
||||||
/* Return values from yylex() */
|
/* Return values from yylex() */
|
||||||
#define LEXRES_EOL 0 /* end of input */
|
#define LEXRES_EOL 0 /* end of input */
|
||||||
@ -89,6 +83,12 @@ extern void psql_yyset_column(int column_no, yyscan_t yyscanner);
|
|||||||
%option warn
|
%option warn
|
||||||
%option prefix="psql_yy"
|
%option prefix="psql_yy"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Set the type of yyextra; we use it as a pointer back to the containing
|
||||||
|
* PsqlScanState.
|
||||||
|
*/
|
||||||
|
%option extra-type="PsqlScanState"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All of the following definitions and rules should exactly match
|
* All of the following definitions and rules should exactly match
|
||||||
* src/backend/parser/scan.l so far as the flex patterns are concerned.
|
* src/backend/parser/scan.l so far as the flex patterns are concerned.
|
||||||
|
Reference in New Issue
Block a user