mirror of
https://github.com/postgres/postgres.git
synced 2025-10-18 04:29:09 +03:00
Move keywords.c/kwlookup.c into src/common/.
Now that we have src/common/ for code shared between frontend and backend, we can get rid of (most of) the klugy ways that the keyword table and keyword lookup code were formerly shared between different uses. This is a first step towards a more general plan of getting rid of special-purpose kluges for sharing code in src/bin/. I chose to merge kwlookup.c back into keywords.c, as it once was, and always has been so far as keywords.h is concerned. We could have kept them separate, but there is noplace that uses ScanKeywordLookup without also wanting access to the backend's keyword list, so there seems little point. ecpg is still a bit weird, but at least now the trickiness is documented. I think that the MSVC build script should require no adjustments beyond what's done here ... but we'll soon find out.
This commit is contained in:
39
src/include/common/keywords.h
Normal file
39
src/include/common/keywords.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* keywords.h
|
||||
* lexical token lookup for key words in PostgreSQL
|
||||
*
|
||||
*
|
||||
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* src/include/common/keywords.h
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef KEYWORDS_H
|
||||
#define KEYWORDS_H
|
||||
|
||||
/* Keyword categories --- should match lists in gram.y */
|
||||
#define UNRESERVED_KEYWORD 0
|
||||
#define COL_NAME_KEYWORD 1
|
||||
#define TYPE_FUNC_NAME_KEYWORD 2
|
||||
#define RESERVED_KEYWORD 3
|
||||
|
||||
|
||||
typedef struct ScanKeyword
|
||||
{
|
||||
const char *name; /* in lower case */
|
||||
int16 value; /* grammar's token code */
|
||||
int16 category; /* see codes above */
|
||||
} ScanKeyword;
|
||||
|
||||
extern PGDLLIMPORT const ScanKeyword ScanKeywords[];
|
||||
extern PGDLLIMPORT const int NumScanKeywords;
|
||||
|
||||
|
||||
extern const ScanKeyword *ScanKeywordLookup(const char *text,
|
||||
const ScanKeyword *keywords,
|
||||
int num_keywords);
|
||||
|
||||
#endif /* KEYWORDS_H */
|
Reference in New Issue
Block a user