LCOV - differential code coverage report
Current view: top level - src/interfaces/ecpg/preproc - ecpg_keywords.c (source / functions) Coverage Total Hit CBC
Current: Differential Code Coverage HEAD vs 15 Lines: 100.0 % 8 8 8
Current Date: 2023-04-08 17:13:01 Functions: 100.0 % 1 1 1
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (240..) days: 100.0 % 8 8 8
Legend: Lines: hit not hit Function coverage date bins:
(240..) days: 100.0 % 1 1 1

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  * ecpg_keywords.c
                                  4                 :  *    lexical token lookup for reserved words in postgres embedded SQL
                                  5                 :  *
                                  6                 :  * IDENTIFICATION
                                  7                 :  *    src/interfaces/ecpg/preproc/ecpg_keywords.c
                                  8                 :  *
                                  9                 :  *-------------------------------------------------------------------------
                                 10                 :  */
                                 11                 : 
                                 12                 : #include "postgres_fe.h"
                                 13                 : 
                                 14                 : #include <ctype.h>
                                 15                 : 
                                 16                 : /* ScanKeywordList lookup data for ECPG keywords */
                                 17                 : #include "ecpg_kwlist_d.h"
                                 18                 : #include "preproc_extern.h"
                                 19                 : #include "preproc.h"
                                 20                 : 
                                 21                 : /* Token codes for ECPG keywords */
                                 22                 : #define PG_KEYWORD(kwname, value) value,
                                 23                 : 
                                 24                 : static const uint16 ECPGScanKeywordTokens[] = {
                                 25                 : #include "ecpg_kwlist.h"
                                 26                 : };
                                 27                 : 
                                 28                 : #undef PG_KEYWORD
                                 29                 : 
                                 30                 : 
                                 31                 : /*
                                 32                 :  * ScanECPGKeywordLookup - see if a given word is a keyword
                                 33                 :  *
                                 34                 :  * Returns the token value of the keyword, or -1 if no match.
                                 35                 :  *
                                 36                 :  * Keywords are matched using the same case-folding rules as in the backend.
                                 37                 :  */
                                 38                 : int
 5437 meskes                     39 CBC        5362 : ScanECPGKeywordLookup(const char *text)
                                 40                 : {
                                 41                 :     int         kwnum;
                                 42                 : 
                                 43                 :     /* First check SQL symbols defined by the backend. */
 1554 tgl                        44            5362 :     kwnum = ScanKeywordLookup(text, &ScanKeywords);
                                 45            5362 :     if (kwnum >= 0)
                                 46            2891 :         return SQLScanKeywordTokens[kwnum];
                                 47                 : 
                                 48                 :     /* Try ECPG-specific keywords. */
                                 49            2471 :     kwnum = ScanKeywordLookup(text, &ScanECPGKeywords);
                                 50            2471 :     if (kwnum >= 0)
                                 51             901 :         return ECPGScanKeywordTokens[kwnum];
                                 52                 : 
                                 53            1570 :     return -1;
                                 54                 : }
        

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