Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/C/Postgres/src/interfaces/ecpg/preproc/   (Postgres Database Version 18.4©)  Datei vom 11.4.2026 mit Größe 1 kB image not shown  

Quelle  c_keywords.c

  Sprache: C
 

/*-------------------------------------------------------------------------
 *
 * c_keywords.c
 *   lexical token lookup for reserved words in postgres embedded SQL
 *
 * src/interfaces/ecpg/preproc/c_keywords.c
 *
 *-------------------------------------------------------------------------
 */

#include "postgres_fe.h"

/* ScanKeywordList lookup data for C keywords */
#include "c_kwlist_d.h"
#include "preproc_extern.h"
#include "preproc.h"

/* Token codes for C keywords */
#define PG_KEYWORD(kwname, value) value,

static const uint16 ScanCKeywordTokens[] = {
#include "c_kwlist.h"
};

#undef PG_KEYWORD


/*
 * ScanCKeywordLookup - see if a given word is a keyword
 *
 * Returns the token value of the keyword, or -1 if no match.
 *
 * Do a hash search using plain strcmp() comparison.  This is much like
 * ScanKeywordLookup(), except we want case-sensitive matching.
 */

int
ScanCKeywordLookup(const char *text)
{
 size_t  len;
 int   h;
 const char *kw;

 /*
  * Reject immediately if too long to be any keyword.  This saves useless
  * hashing work on long strings.
 */

 len = strlen(text);
 if (len > ScanCKeywords.max_kw_len)
  return -1;

 /*
  * Compute the hash function.  Since it's a perfect hash, we need only
  * match to the specific keyword it identifies.
 */

 h = ScanCKeywords_hash_func(text, len);

 /* An out-of-range result implies no match */
 if (h < 0 || h >= ScanCKeywords.num_keywords)
  return -1;

 kw = GetScanKeyword(h, &ScanCKeywords);

 if (strcmp(kw, text) == 0)
  return ScanCKeywordTokens[h];

 return -1;
}

Messung V0.5 in Prozent
C=90 H=100 G=95

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-08-07) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.