LCOV - differential code coverage report
Current view: top level - contrib/seg - segscan.l (source / functions) Coverage Total Hit UBC CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 78.9 % 38 30 8 30
Current Date: 2025-09-06 07:49:51 +0900 Functions: 71.4 % 7 5 2 5
Baseline: lcov-20250906-005545-baseline Branches: 63.6 % 22 14 8 14
Baseline Date: 2025-09-05 08:21:35 +0100 Line coverage date bins:
Legend: Lines:     hit not hit
Branches: + taken - not taken # not executed
(30,360] days: 80.0 % 25 20 5 20
(360..) days: 76.9 % 13 10 3 10
Function coverage date bins:
(30,360] days: 83.3 % 6 5 1 5
(360..) days: 0.0 % 1 0 1
Branch coverage date bins:
(30,360] days: 37.5 % 8 3 5 3
(360..) days: 78.6 % 14 11 3 11

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : %top{
                                  2                 :                : /*
                                  3                 :                :  * A scanner for EMP-style numeric ranges
                                  4                 :                :  */
                                  5                 :                : #include "postgres.h"
                                  6                 :                : 
                                  7                 :                : #include "nodes/miscnodes.h"
                                  8                 :                : 
                                  9                 :                : #include "segdata.h"
                                 10                 :                : #include "segparse.h" /* must be after segdata.h for SEG */
                                 11                 :                : }
                                 12                 :                : 
                                 13                 :                : %{
                                 14                 :                : /* LCOV_EXCL_START */
                                 15                 :                : 
                                 16                 :                : /* No reason to constrain amount of data slurped */
                                 17                 :                : #define YY_READ_BUF_SIZE 16777216
                                 18                 :                : 
                                 19                 :                : /* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
                                 20                 :                : #undef fprintf
                                 21                 :                : #define fprintf(file, fmt, msg)  fprintf_to_ereport(fmt, msg)
                                 22                 :                : 
                                 23                 :                : static void
 4619 tgl@sss.pgh.pa.us          24                 :UBC           0 : fprintf_to_ereport(const char *fmt, const char *msg)
                                 25                 :                : {
                                 26         [ #  # ]:              0 :     ereport(ERROR, (errmsg_internal("%s", msg)));
                                 27                 :                : }
                                 28                 :                : %}
                                 29                 :                : 
                                 30                 :                : %option reentrant
                                 31                 :                : %option bison-bridge
                                 32                 :                : %option 8bit
                                 33                 :                : %option never-interactive
                                 34                 :                : %option nodefault
                                 35                 :                : %option noinput
                                 36                 :                : %option nounput
                                 37                 :                : %option noyywrap
                                 38                 :                : %option noyyalloc
                                 39                 :                : %option noyyrealloc
                                 40                 :                : %option noyyfree
                                 41                 :                : %option warn
                                 42                 :                : %option prefix="seg_yy"
                                 43                 :                : 
                                 44                 :                : 
                                 45                 :                : range        (\.\.)(\.)?
                                 46                 :                : plumin       (\'\+\-\')|(\(\+\-)\)
                                 47                 :                : integer      [+-]?[0-9]+
                                 48                 :                : real         [+-]?[0-9]+\.[0-9]+
                                 49                 :                : float        ({integer}|{real})([eE]{integer})?
                                 50                 :                : 
                                 51                 :                : %%
                                 52                 :                : 
  262 peter@eisentraut.org       53                 :CBC        2449 : {range}      yylval->text = yytext; return RANGE;
                                 54                 :              7 : {plumin}     yylval->text = yytext; return PLUMIN;
                                 55                 :              7 : {float}      yylval->text = yytext; return SEGFLOAT;
                                 56                 :           5178 : \<           yylval->text = "<"; return EXTENSION;
                                 57                 :            530 : \>           yylval->text = ">"; return EXTENSION;
                                 58                 :            672 : \~           yylval->text = "~"; return EXTENSION;
  793 michael@paquier.xyz        59                 :             15 : [ \t\n\r\f\v]+ /* discard spaces */
 9035 tgl@sss.pgh.pa.us          60                 :            490 : .            return yytext[0]; /* alert parser of the garbage */
                                 61                 :             10 : 
 9035 tgl@sss.pgh.pa.us          62                 :UBC           0 : %%
                                 63                 :                : 
                                 64                 :                : /* LCOV_EXCL_STOP */
                                 65                 :                : 
                                 66                 :                : void
  262 peter@eisentraut.org       67                 :CBC          22 : seg_yyerror(SEG *result, struct Node *escontext, yyscan_t yyscanner, const char *message)
                                 68                 :                : {
  255                            69                 :             22 :     struct yyguts_t *yyg = (struct yyguts_t *) yyscanner;   /* needed for yytext
                                 70                 :                :                                                              * macro */
                                 71                 :                : 
                                 72                 :                :     /* if we already reported an error, don't overwrite it */
  988 andrew@dunslane.net        73   [ +  +  +  -  :             22 :     if (SOFT_ERROR_OCCURRED(escontext))
                                              +  + ]
                                 74                 :              8 :         return;
                                 75                 :                : 
 8028 tgl@sss.pgh.pa.us          76         [ +  + ]:             14 :     if (*yytext == YY_END_OF_BUFFER_CHAR)
                                 77                 :                :     {
  988 andrew@dunslane.net        78         [ +  + ]:              3 :         errsave(escontext,
                                 79                 :                :                 (errcode(ERRCODE_SYNTAX_ERROR),
                                 80                 :                :                  errmsg("bad seg representation"),
                                 81                 :                :         /* translator: %s is typically "syntax error" */
                                 82                 :                :                  errdetail("%s at end of input", message)));
                                 83                 :                :     }
                                 84                 :                :     else
                                 85                 :                :     {
                                 86         [ +  + ]:             11 :         errsave(escontext,
                                 87                 :                :                 (errcode(ERRCODE_SYNTAX_ERROR),
                                 88                 :                :                  errmsg("bad seg representation"),
                                 89                 :                :         /* translator: first %s is typically "syntax error" */
                                 90                 :                :                  errdetail("%s at or near \"%s\"", message, yytext)));
                                 91                 :                :     }
                                 92                 :                : }
                                 93                 :                : 
                                 94                 :                : 
                                 95                 :                : /*
                                 96                 :                :  * Called before any actual parsing is done
                                 97                 :                :  */
                                 98                 :                : void
  262 peter@eisentraut.org       99                 :           2825 : seg_scanner_init(const char *str, yyscan_t *yyscannerp)
                                100                 :                : {
                                101                 :                :     yyscan_t    yyscanner;
                                102                 :                : 
                                103         [ -  + ]:           2825 :     if (yylex_init(yyscannerp) != 0)
  262 peter@eisentraut.org      104         [ #  # ]:UBC           0 :         elog(ERROR, "yylex_init() failed: %m");
                                105                 :                : 
  262 peter@eisentraut.org      106                 :CBC        2825 :     yyscanner = *yyscannerp;
                                107                 :                : 
                                108                 :           2825 :     yy_scan_string(str, yyscanner);
 8028 tgl@sss.pgh.pa.us         109                 :           2825 : }
                                110                 :                : 
                                111                 :                : 
                                112                 :                : /*
                                113                 :                :  * Called after parsing is done to clean up after seg_scanner_init()
                                114                 :                :  */
                                115                 :                : void
  262 peter@eisentraut.org      116                 :           2816 : seg_scanner_finish(yyscan_t yyscanner)
                                117                 :                : {
                                118                 :           2816 :     yylex_destroy(yyscanner);
                                119                 :           2816 : }
                                120                 :                : 
                                121                 :                : /*
                                122                 :                :  * Interface functions to make flex use palloc() instead of malloc().
                                123                 :                :  * It'd be better to make these static, but flex insists otherwise.
                                124                 :                :  */
                                125                 :                : 
                                126                 :                : void *
                                127                 :          11300 : yyalloc(yy_size_t size, yyscan_t yyscanner)
                                128                 :                : {
                                129                 :          11300 :     return palloc(size);
                                130                 :                : }
                                131                 :                : 
                                132                 :                : void *
  262 peter@eisentraut.org      133                 :UBC           0 : yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner)
                                134                 :                : {
                                135         [ #  # ]:              0 :     if (ptr)
                                136                 :              0 :         return repalloc(ptr, size);
                                137                 :                :     else
                                138                 :              0 :         return palloc(size);
                                139                 :                : }
                                140                 :                : 
                                141                 :                : void
  262 peter@eisentraut.org      142                 :CBC       14080 : yyfree(void *ptr, yyscan_t yyscanner)
                                143                 :                : {
                                144         [ +  + ]:          14080 :     if (ptr)
                                145                 :          11264 :         pfree(ptr);
 9035 tgl@sss.pgh.pa.us         146                 :          14080 : }
        

Generated by: LCOV version 2.4-beta