LCOV - differential code coverage report
Current view: top level - contrib/cube - cubescan.l (source / functions) Coverage Total Hit UBC CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 80.5 % 41 33 8 33
Current Date: 2025-09-06 07:49:51 +0900 Functions: 71.4 % 7 5 2 5
Baseline: lcov-20250906-005545-baseline Branches: 50.0 % 16 8 8 8
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: 81.5 % 27 22 5 22
(360..) days: 78.6 % 14 11 3 11
Function coverage date bins:
(30,360] days: 80.0 % 5 4 1 4
(360..) days: 50.0 % 2 1 1 1
Branch coverage date bins:
(30,360] days: 37.5 % 8 3 5 3
(360..) days: 62.5 % 8 5 3 5

 Age         Owner                    Branch data    TLA  Line data    Source code
                                  1                 :                : %top{
                                  2                 :                : /*
                                  3                 :                :  * A scanner for EMP-style numeric ranges
                                  4                 :                :  * contrib/cube/cubescan.l
                                  5                 :                :  */
                                  6                 :                : 
                                  7                 :                : #include "postgres.h"
                                  8                 :                : 
                                  9                 :                : #include "cubedata.h"
                                 10                 :                : #include "cubeparse.h"    /* must be after cubedata.h for YYSTYPE and NDBOX */
                                 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="cube_yy"
                                 43                 :                : 
                                 44                 :                : 
                                 45                 :                : n            [0-9]+
                                 46                 :                : integer      [+-]?{n}
                                 47                 :                : real         [+-]?({n}\.{n}?|\.{n})
                                 48                 :                : float        ({integer}|{real})([eE]{integer})?
                                 49                 :                : infinity     [+-]?[iI][nN][fF]([iI][nN][iI][tT][yY])?
                                 50                 :                : NaN          [nN][aA][nN]
                                 51                 :                : 
                                 52                 :                : %%
                                 53                 :                : 
  262 peter@eisentraut.org       54                 :CBC       14058 : {float}      *yylval = yytext; return CUBEFLOAT;
                                 55                 :              2 : {infinity}   *yylval = yytext; return CUBEFLOAT;
                                 56                 :              2 : {NaN}        *yylval = yytext; return CUBEFLOAT;
                                 57                 :              1 : \[           *yylval = "("; return O_BRACKET;
                                 58                 :             23 : \]           *yylval = ")"; return C_BRACKET;
                                 59                 :             21 : \(           *yylval = "("; return O_PAREN;
                                 60                 :           6604 : \)           *yylval = ")"; return C_PAREN;
                                 61                 :           6602 : \,           *yylval = ","; return COMMA;
  793 michael@paquier.xyz        62                 :          10645 : [ \t\n\r\f\v]+ /* discard spaces */
 9035 tgl@sss.pgh.pa.us          63                 :             39 : .            return yytext[0]; /* alert parser of the garbage */
                                 64                 :              6 : 
 9035 tgl@sss.pgh.pa.us          65                 :UBC           0 : %%
                                 66                 :                : 
                                 67                 :                : /* LCOV_EXCL_STOP */
                                 68                 :                : 
                                 69                 :                : /* result and scanbuflen are not used, but Bison expects this signature */
                                 70                 :                : void
 1002 tgl@sss.pgh.pa.us          71                 :CBC          24 : cube_yyerror(NDBOX **result, Size scanbuflen,
                                 72                 :                :              struct Node *escontext,
                                 73                 :                :              yyscan_t yyscanner,
                                 74                 :                :              const char *message)
                                 75                 :                : {
  255 peter@eisentraut.org       76                 :             24 :     struct yyguts_t *yyg = (struct yyguts_t *) yyscanner;   /* needed for yytext
                                 77                 :                :                                                              * macro */
                                 78                 :                : 
 8028 tgl@sss.pgh.pa.us          79         [ +  + ]:             24 :     if (*yytext == YY_END_OF_BUFFER_CHAR)
                                 80                 :                :     {
 1002                            81         [ +  - ]:              3 :         errsave(escontext,
                                 82                 :                :                 (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                                 83                 :                :                  errmsg("invalid input syntax for cube"),
                                 84                 :                :         /* translator: %s is typically "syntax error" */
                                 85                 :                :                  errdetail("%s at end of input", message)));
                                 86                 :                :     }
                                 87                 :                :     else
                                 88                 :                :     {
                                 89         [ +  + ]:             21 :         errsave(escontext,
                                 90                 :                :                 (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
                                 91                 :                :                  errmsg("invalid input syntax for cube"),
                                 92                 :                :         /* translator: first %s is typically "syntax error" */
                                 93                 :                :                  errdetail("%s at or near \"%s\"", message, yytext)));
                                 94                 :                :     }
 8028                            95                 :              1 : }
                                 96                 :                : 
                                 97                 :                : 
                                 98                 :                : /*
                                 99                 :                :  * Called before any actual parsing is done
                                100                 :                :  */
                                101                 :                : void
  262 peter@eisentraut.org      102                 :           3435 : cube_scanner_init(const char *str, Size *scanbuflen, yyscan_t *yyscannerp)
                                103                 :                : {
 1098 john.naylor@postgres      104                 :           3435 :     Size        slen = strlen(str);
                                105                 :                :     yyscan_t    yyscanner;
                                106                 :                : 
  262 peter@eisentraut.org      107         [ -  + ]:           3435 :     if (yylex_init(yyscannerp) != 0)
  262 peter@eisentraut.org      108         [ #  # ]:UBC           0 :         elog(ERROR, "yylex_init() failed: %m");
                                109                 :                : 
  262 peter@eisentraut.org      110                 :CBC        3435 :     yyscanner = *yyscannerp;
                                111                 :                : 
                                112                 :           3435 :     yy_scan_bytes(str, slen, yyscanner);
                                113                 :           3435 :     *scanbuflen = slen;
 8028 tgl@sss.pgh.pa.us         114                 :           3435 : }
                                115                 :                : 
                                116                 :                : 
                                117                 :                : /*
                                118                 :                :  * Called after parsing is done to clean up after cube_scanner_init()
                                119                 :                :  */
                                120                 :                : void
  262 peter@eisentraut.org      121                 :           3405 : cube_scanner_finish(yyscan_t yyscanner)
                                122                 :                : {
                                123                 :           3405 :     yylex_destroy(yyscanner);
                                124                 :           3405 : }
                                125                 :                : 
                                126                 :                : /*
                                127                 :                :  * Interface functions to make flex use palloc() instead of malloc().
                                128                 :                :  * It'd be better to make these static, but flex insists otherwise.
                                129                 :                :  */
                                130                 :                : 
                                131                 :                : void *
                                132                 :          13740 : yyalloc(yy_size_t size, yyscan_t yyscanner)
                                133                 :                : {
                                134                 :          13740 :     return palloc(size);
                                135                 :                : }
                                136                 :                : 
                                137                 :                : void *
  262 peter@eisentraut.org      138                 :UBC           0 : yyrealloc(void *ptr, yy_size_t size, yyscan_t yyscanner)
                                139                 :                : {
                                140         [ #  # ]:              0 :     if (ptr)
                                141                 :              0 :         return repalloc(ptr, size);
                                142                 :                :     else
                                143                 :              0 :         return palloc(size);
                                144                 :                : }
                                145                 :                : 
                                146                 :                : void
  262 peter@eisentraut.org      147                 :CBC       17025 : yyfree(void *ptr, yyscan_t yyscanner)
                                148                 :                : {
                                149         [ +  + ]:          17025 :     if (ptr)
                                150                 :          13620 :         pfree(ptr);
 9035 tgl@sss.pgh.pa.us         151                 :          17025 : }
        

Generated by: LCOV version 2.4-beta