LCOV - differential code coverage report
Current view: top level - contrib/cube - cubescan.l (source / functions) Coverage Total Hit LBC UIC GIC GNC CBC EUB ECB DUB DCB
Current: Differential Code Coverage HEAD vs 15 Lines: 91.2 % 34 31 1 2 9 14 8 2 20 1 2
Current Date: 2023-04-08 17:13:01 Functions: 75.0 % 4 3 1 1 2 1 3
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (120,180] days: 100.0 % 3 3 3
Legend: Lines: hit not hit (180,240] days: 100.0 % 11 11 11
(240..) days: 85.0 % 20 17 1 2 9 8 2 15
Function coverage date bins:
(120,180] days: 100.0 % 1 1 1
(180,240] days: 100.0 % 1 1 1
(240..) days: 20.0 % 5 1 1 1 1 2

 Age         Owner                  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                 : /*
                                 10                 :  * NB: include cubeparse.h only AFTER defining YYSTYPE (to match cubeparse.y)
                                 11                 :  * and cubedata.h for NDBOX.
                                 12                 :  */
                                 13                 : #include "cubedata.h"
                                 14                 : #define YYSTYPE char *
                                 15                 : #include "cubeparse.h"
                                 16                 : }
                                 17                 : 
                                 18                 : %{
                                 19                 : /* LCOV_EXCL_START */
                                 20                 : 
                                 21                 : /* No reason to constrain amount of data slurped */
                                 22                 : #define YY_READ_BUF_SIZE 16777216
                                 23                 : 
                                 24                 : /* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
                                 25                 : #undef fprintf
                                 26                 : #define fprintf(file, fmt, msg)  fprintf_to_ereport(fmt, msg)
                                 27                 : 
                                 28                 : static void
 3738 tgl                        29 UIC           0 : fprintf_to_ereport(const char *fmt, const char *msg)
                                 30                 : {
                                 31               0 :     ereport(ERROR, (errmsg_internal("%s", msg)));
                                 32                 : }
                                 33                 : 
                                 34                 : /* Handles to the buffer that the lexer uses internally */
                                 35                 : static YY_BUFFER_STATE scanbufhandle;
                                 36                 : static char *scanbuf;
                                 37                 : %}
                                 38                 : 
 7558 tgl                        39 EUB             : %option 8bit
                                 40                 : %option never-interactive
 6984                            41                 : %option nodefault
                                 42                 : %option noinput
                                 43                 : %option nounput
                                 44                 : %option noyywrap
                                 45                 : %option warn
                                 46                 : %option prefix="cube_yy"
                                 47                 : 
                                 48                 : 
                                 49                 : n            [0-9]+
                                 50                 : integer      [+-]?{n}
                                 51                 : real         [+-]?({n}\.{n}?|\.{n})
                                 52                 : float        ({integer}|{real})([eE]{integer})?
                                 53                 : infinity     [+-]?[iI][nN][fF]([iI][nN][iI][tT][yY])?
                                 54                 : NaN          [nN][aA][nN]
                                 55                 : 
                                 56                 : %%
                                 57                 : 
  217 john.naylor                58 GNC       14058 : {float}      cube_yylval = yytext; return CUBEFLOAT;
                                 59               2 : {infinity}   cube_yylval = yytext; return CUBEFLOAT;
                                 60               2 : {NaN}        cube_yylval = yytext; return CUBEFLOAT;
                                 61               1 : \[           cube_yylval = "("; return O_BRACKET;
                                 62              23 : \]           cube_yylval = ")"; return C_BRACKET;
                                 63              21 : \(           cube_yylval = "("; return O_PAREN;
                                 64            6604 : \)           cube_yylval = ")"; return C_PAREN;
                                 65            6602 : \,           cube_yylval = ","; return COMMA;
 6984 tgl                        66 GIC       10645 : [ \t\n\r\f]+ /* discard spaces */
 8154                            67              39 : .            return yytext[0]; /* alert parser of the garbage */
 8154 tgl                        68 CBC           6 : 
 8154 tgl                        69 LBC           0 : %%
 8154 tgl                        70 ECB             : 
 2068 peter_e                    71                 : /* LCOV_EXCL_STOP */
                                 72                 : 
                                 73                 : /* result and scanbuflen are not used, but Bison expects this signature */
 2936 tgl                        74                 : void
  121 tgl                        75 GNC          24 : cube_yyerror(NDBOX **result, Size scanbuflen,
                                 76                 :              struct Node *escontext,
                                 77                 :              const char *message)
 7147 tgl                        78 ECB             : {
 7147 tgl                        79 CBC          24 :     if (*yytext == YY_END_OF_BUFFER_CHAR)
 7147 tgl                        80 ECB             :     {
  121 tgl                        81 GNC           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                 :     }
 7147 tgl                        87 ECB             :     else
                                 88                 :     {
  121 tgl                        89 GNC          21 :         errsave(escontext,
                                 90                 :                 (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION),
 2385 tgl                        91 ECB             :                  errmsg("invalid input syntax for cube"),
                                 92                 :                  /* translator: first %s is typically "syntax error" */
 7147                            93                 :                  errdetail("%s at or near \"%s\"", message, yytext)));
                                 94                 :     }
 7147 tgl                        95 GIC           1 : }
                                 96                 : 
                                 97                 : 
                                 98                 : /*
                                 99                 :  * Called before any actual parsing is done
                                100                 :  */
 7147 tgl                       101 ECB             : void
  217 john.naylor               102 GNC        3435 : cube_scanner_init(const char *str, Size *scanbuflen)
                                103                 : {
                                104            3435 :     Size        slen = strlen(str);
                                105                 : 
                                106                 :     /*
 7147 tgl                       107 ECB             :      * Might be left over after ereport()
                                108                 :      */
 7147 tgl                       109 GIC        3435 :     if (YY_CURRENT_BUFFER)
                                110              30 :         yy_delete_buffer(YY_CURRENT_BUFFER);
                                111                 : 
                                112                 :     /*
                                113                 :      * Make a scan buffer with special termination needed by flex.
 7147 tgl                       114 ECB             :      */
  217 john.naylor               115 GNC        3435 :     *scanbuflen = slen;
 7147 tgl                       116 CBC        3435 :     scanbuf = palloc(slen + 2);
 7147 tgl                       117 GIC        3435 :     memcpy(scanbuf, str, slen);
                                118            3435 :     scanbuf[slen] = scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR;
                                119            3435 :     scanbufhandle = yy_scan_buffer(scanbuf, slen + 2);
                                120                 : 
 7147 tgl                       121 CBC        3435 :     BEGIN(INITIAL);
                                122            3435 : }
                                123                 : 
                                124                 : 
                                125                 : /*
                                126                 :  * Called after parsing is done to clean up after cube_scanner_init()
 7147 tgl                       127 ECB             :  */
                                128                 : void
 7147 tgl                       129 CBC        3405 : cube_scanner_finish(void)
 7147 tgl                       130 ECB             : {
 7147 tgl                       131 CBC        3405 :     yy_delete_buffer(scanbufhandle);
 7147 tgl                       132 GIC        3405 :     pfree(scanbuf);
 8154 tgl                       133 CBC        3405 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a