LCOV - differential code coverage report
Current view: top level - src/backend/bootstrap - bootscanner.l (source / functions) Coverage Total Hit UNC LBC UIC UBC GBC GIC GNC CBC EUB ECB DCB
Current: Differential Code Coverage HEAD vs 15 Lines: 82.0 % 50 41 2 1 5 1 1 2 20 18 7 5 17
Current Date: 2023-04-08 17:13:01 Functions: 0.0 % 2 0 1 1 2
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (180,240] days: 90.9 % 22 20 2 20
Legend: Lines: hit not hit (240..) days: 75.0 % 28 21 1 5 1 1 2 18 5 5
Function coverage date bins:
(180,240] days: 0.0 % 1 0 1
(240..) days: 0.0 % 2 0 1 1

 Age         Owner                  TLA  Line data    Source code
                                  1                 : %top{
                                  2                 : /*-------------------------------------------------------------------------
                                  3                 :  *
                                  4                 :  * bootscanner.l
                                  5                 :  *    a lexical scanner for the bootstrap parser
                                  6                 :  *
                                  7                 :  * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
                                  8                 :  * Portions Copyright (c) 1994, Regents of the University of California
                                  9                 :  *
                                 10                 :  *
                                 11                 :  * IDENTIFICATION
                                 12                 :  *    src/backend/bootstrap/bootscanner.l
                                 13                 :  *
                                 14                 :  *-------------------------------------------------------------------------
                                 15                 :  */
                                 16                 : #include "postgres.h"
                                 17                 : 
                                 18                 : /*
                                 19                 :  * NB: include bootparse.h only AFTER including bootstrap.h, because bootstrap.h
                                 20                 :  * includes node definitions needed for YYSTYPE.
                                 21                 :  */
                                 22                 : #include "bootstrap/bootstrap.h"
                                 23                 : #include "bootparse.h"
                                 24                 : #include "utils/guc.h"
                                 25                 : 
                                 26                 : }
                                 27                 : 
                                 28                 : %{
                                 29                 : 
                                 30                 : /* LCOV_EXCL_START */
                                 31                 : 
                                 32                 : /* Avoid exit() on fatal scanner errors (a bit ugly -- see yy_fatal_error) */
                                 33                 : #undef fprintf
                                 34                 : #define fprintf(file, fmt, msg)  fprintf_to_ereport(fmt, msg)
                                 35                 : 
                                 36                 : static void
 3738 tgl                        37 UIC           0 : fprintf_to_ereport(const char *fmt, const char *msg)
                                 38                 : {
                                 39               0 :     ereport(ERROR, (errmsg_internal("%s", msg)));
                                 40                 : }
                                 41                 : 
                                 42                 : 
 6878 tgl                        43 EUB             : static int  yyline = 1;         /* line number for error reporting */
                                 44                 : 
 9770 scrappy                    45                 : %}
                                 46                 : 
                                 47                 : %option 8bit
                                 48                 : %option never-interactive
                                 49                 : %option nodefault
                                 50                 : %option noinput
                                 51                 : %option nounput
                                 52                 : %option noyywrap
                                 53                 : %option warn
                                 54                 : %option prefix="boot_yy"
                                 55                 : 
                                 56                 : 
                                 57                 : id      [-A-Za-z0-9_]+
                                 58                 : sid     \'([^']|\'\')*\'
                                 59                 : 
                                 60                 : /*
                                 61                 :  * Keyword tokens return the keyword text (as a constant string) in boot_yylval.kw,
                                 62                 :  * just in case that's needed because we want to treat the keyword as an
                                 63                 :  * unreserved identifier.  Note that _null_ is not treated as a keyword
                                 64                 :  * for this purpose; it's the one "reserved word" in the bootstrap syntax.
                                 65                 :  *
                                 66                 :  * Notice that all the keywords are case-sensitive, and for historical
                                 67                 :  * reasons some must be upper case.
                                 68                 :  *
                                 69                 :  * String tokens return a palloc'd string in boot_yylval.str.
                                 70                 :  */
                                 71                 : 
                                 72                 : %%
                                 73                 : 
  217 john.naylor                74 GNC       18300 : open            { boot_yylval.kw = "open"; return OPEN; }
                                 75                 : 
                                 76           19520 : close           { boot_yylval.kw = "close"; return XCLOSE; }
 9770 scrappy                    77 GIC       19520 : 
  217 john.naylor                78 GNC       19520 : create          { boot_yylval.kw = "create"; return XCREATE; }
 9770 scrappy                    79 GIC       19520 : 
  217 john.naylor                80 UNC           0 : OID             { boot_yylval.kw = "OID"; return OBJ_ID; }
  217 john.naylor                81 GNC        1220 : bootstrap       { boot_yylval.kw = "bootstrap"; return XBOOTSTRAP; }
                                 82            3355 : shared_relation { boot_yylval.kw = "shared_relation"; return XSHARED_RELATION; }
                                 83            3965 : rowtype_oid     { boot_yylval.kw = "rowtype_oid"; return XROWTYPE_OID; }
 1800 tgl                        84 CBC        3355 : 
  217 john.naylor                85 GNC     3218360 : insert          { boot_yylval.kw = "insert"; return INSERT_TUPLE; }
 9770 scrappy                    86 GBC     3215615 : 
 1800 tgl                        87 CBC     9345813 : _null_          { return NULLVAL; }
 9770 scrappy                    88         9345813 : 
 2061 peter_e                    89          187270 : ","               { return COMMA; }
                                 90          369355 : "="               { return EQUALS; }
                                 91         3272955 : "("               { return LPAREN; }
                                 92         3455040 : ")"               { return RPAREN; }
 9770 scrappy                    93         3272955 : 
 9344 bruce                      94         3272955 : [\n]            { yyline++; }
 1800 tgl                        95         3543490 : [\r\t ]         ;
                                 96        58971445 : 
  879 peter                      97        55427955 : ^\#[^\n]*       ;       /* drop everything after "#" for comments */
 1800 tgl                        98             305 : 
  217 john.naylor                99 GNC       48800 : declare         { boot_yylval.kw = "declare"; return XDECLARE; }
                                100           49105 : build           { boot_yylval.kw = "build"; return XBUILD; }
                                101             305 : indices         { boot_yylval.kw = "indices"; return INDICES; }
                                102           33855 : unique          { boot_yylval.kw = "unique"; return UNIQUE; }
                                103           38125 : index           { boot_yylval.kw = "index"; return INDEX; }
                                104           82350 : on              { boot_yylval.kw = "on"; return ON; }
                                105           75640 : using           { boot_yylval.kw = "using"; return USING; }
                                106           59780 : toast           { boot_yylval.kw = "toast"; return XTOAST; }
                                107           48800 : FORCE           { boot_yylval.kw = "FORCE"; return XFORCE; }
                                108           21350 : NOT             { boot_yylval.kw = "NOT"; return XNOT; }
                                109           21960 : NULL            { boot_yylval.kw = "NULL"; return XNULL; }
 7912 tgl                       110 CBC       10370 : 
 9344 bruce                     111           10980 : {id}            {
  217 john.naylor               112 GNC    36926655 :                     boot_yylval.str = pstrdup(yytext);
 2061 peter_e                   113 CBC    36926655 :                     return ID;
 9344 bruce                     114 ECB             :                 }
                                115                 : {sid}           {
  917 tgl                       116 CBC     2169462 :                     /* strip quotes and escapes */
  217 john.naylor               117 GNC     2169462 :                     boot_yylval.str = DeescapeQuotedString(yytext);
 2061 peter_e                   118 CBC     4338924 :                     return ID;
 9344 bruce                     119 ECB             :                 }
                                120                 : 
 9344 bruce                     121 UIC           0 : .               {
 7201 tgl                       122 LBC           0 :                     elog(ERROR, "syntax error at line %d: unexpected character \"%s\"", yyline, yytext);
 9344 bruce                     123 ECB             :                 }
 9770 scrappy                   124                 : 
 9770 scrappy                   125 UIC           0 : %%
                                126               0 : 
 2068 peter_e                   127 EUB             : /* LCOV_EXCL_STOP */
                                128                 : 
                                129                 : void
  217 john.naylor               130 UNC           0 : boot_yyerror(const char *message)
 9770 scrappy                   131 EUB             : {
 6878 tgl                       132 UBC           0 :     elog(ERROR, "%s at line %d", message, yyline);
                                133                 : }
        

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