summaryrefslogtreecommitdiffstats
path: root/src/interfaces/ecpg/preproc/keywords.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /src/interfaces/ecpg/preproc/keywords.c
parentInitial commit. (diff)
downloadpostgresql-14-upstream.tar.xz
postgresql-14-upstream.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/interfaces/ecpg/preproc/keywords.c')
-rw-r--r--src/interfaces/ecpg/preproc/keywords.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c
new file mode 100644
index 0000000..83609e3
--- /dev/null
+++ b/src/interfaces/ecpg/preproc/keywords.c
@@ -0,0 +1,38 @@
+/*-------------------------------------------------------------------------
+ *
+ * keywords.c
+ * lexical token lookup for key words in PostgreSQL
+ *
+ *
+ * Portions Copyright (c) 1996-2021, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ *
+ * IDENTIFICATION
+ * src/interfaces/ecpg/preproc/keywords.c
+ *
+ *-------------------------------------------------------------------------
+ */
+#include "postgres_fe.h"
+
+/*
+ * This is much trickier than it looks. We are #include'ing kwlist.h
+ * but the token numbers that go into the table are from preproc.h
+ * not the backend's gram.h. Therefore this token table will match
+ * the ScanKeywords table supplied from common/keywords.c, including all
+ * keywords known to the backend, but it will supply the token numbers used
+ * by ecpg's grammar, which is what we need. The ecpg grammar must
+ * define all the same token names the backend does, else we'll get
+ * undefined-symbol failures in this compile.
+ */
+
+#include "preproc_extern.h"
+#include "preproc.h"
+
+#define PG_KEYWORD(kwname, value, category, collabel) value,
+
+const uint16 SQLScanKeywordTokens[] = {
+#include "parser/kwlist.h"
+};
+
+#undef PG_KEYWORD