1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-31 22:04:40 +03:00

Build all Flex files standalone

The proposed Meson build system will need a way to ignore certain
generated files in order to coexist with the autoconf build system,
and C files generated by Flex which are #include'd into .y files make
this more difficult. In similar vein to 72b1e3a21, arrange for all Flex
C files to compile to their own .o targets.

Reviewed by Andres Freund

Discussion: https://www.postgresql.org/message-id/20220810171935.7k5zgnjwqzalzmtm%40awork3.anarazel.de
Discussion: https://www.postgresql.org/message-id/CAFBsxsF8Gc2StS3haXofshHCzqNMRXiSxvQEYGwnFsTmsdwNeg@mail.gmail.com
This commit is contained in:
John Naylor
2022-09-04 11:33:31 +07:00
parent 80e8450a74
commit dac048f71e
38 changed files with 307 additions and 190 deletions

View File

@ -1,8 +1,18 @@
%{
%top{
/*
* A scanner for EMP-style numeric ranges
*/
#include "postgres.h"
/*
* NB: include segparse.h only AFTER including segdata.h, because segdata.h
* contains the definition for SEG.
*/
#include "segdata.h"
#include "segparse.h"
}
%{
/* LCOV_EXCL_START */
/* No reason to constrain amount of data slurped */
@ -21,7 +31,6 @@ fprintf_to_ereport(const char *fmt, const char *msg)
/* Handles to the buffer that the lexer uses internally */
static YY_BUFFER_STATE scanbufhandle;
static char *scanbuf;
static int scanbuflen;
%}
%option 8bit
@ -42,12 +51,12 @@ float ({integer}|{real})([eE]{integer})?
%%
{range} yylval.text = yytext; return RANGE;
{plumin} yylval.text = yytext; return PLUMIN;
{float} yylval.text = yytext; return SEGFLOAT;
\< yylval.text = "<"; return EXTENSION;
\> yylval.text = ">"; return EXTENSION;
\~ yylval.text = "~"; return EXTENSION;
{range} seg_yylval.text = yytext; return RANGE;
{plumin} seg_yylval.text = yytext; return PLUMIN;
{float} seg_yylval.text = yytext; return SEGFLOAT;
\< seg_yylval.text = "<"; return EXTENSION;
\> seg_yylval.text = ">"; return EXTENSION;
\~ seg_yylval.text = "~"; return EXTENSION;
[ \t\n\r\f]+ /* discard spaces */
. return yytext[0]; /* alert parser of the garbage */
@ -56,7 +65,7 @@ float ({integer}|{real})([eE]{integer})?
/* LCOV_EXCL_STOP */
void
yyerror(SEG *result, const char *message)
seg_yyerror(SEG *result, const char *message)
{
if (*yytext == YY_END_OF_BUFFER_CHAR)
{
@ -94,7 +103,6 @@ seg_scanner_init(const char *str)
/*
* Make a scan buffer with special termination needed by flex.
*/
scanbuflen = slen;
scanbuf = palloc(slen + 2);
memcpy(scanbuf, str, slen);
scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;