summaryrefslogtreecommitdiffstats
path: root/src/interfaces/ecpg/preproc/keywords.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
commit293913568e6a7a86fd1479e1cff8e2ecb58d6568 (patch)
treefc3b469a3ec5ab71b36ea97cc7aaddb838423a0c /src/interfaces/ecpg/preproc/keywords.c
parentInitial commit. (diff)
downloadpostgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.tar.xz
postgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.zip
Adding upstream version 16.2.upstream/16.2
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..e7956ab
--- /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-2023, 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