| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * keywords.c |
| 4 | * lexical token lookup for key words in PostgreSQL |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * |
| 11 | * IDENTIFICATION |
| 12 | * src/interfaces/ecpg/preproc/keywords.c |
| 13 | * |
| 14 | *------------------------------------------------------------------------- |
| 15 | */ |
| 16 | #include "postgres_fe.h" |
| 17 | |
| 18 | /* |
| 19 | * This is much trickier than it looks. We are #include'ing kwlist.h |
| 20 | * but the token numbers that go into the table are from preproc.h |
| 21 | * not the backend's gram.h. Therefore this token table will match |
| 22 | * the ScanKeywords table supplied from common/keywords.c, including all |
| 23 | * keywords known to the backend, but it will supply the token numbers used |
| 24 | * by ecpg's grammar, which is what we need. The ecpg grammar must |
| 25 | * define all the same token names the backend does, else we'll get |
| 26 | * undefined-symbol failures in this compile. |
| 27 | */ |
| 28 | |
| 29 | #include "preproc_extern.h" |
| 30 | #include "preproc.h" |
| 31 | |
| 32 | #define PG_KEYWORD(kwname, value, category) value, |
| 33 | |
| 34 | const uint16 SQLScanKeywordTokens[] = { |
| 35 | #include "parser/kwlist.h" |
| 36 | }; |
| 37 | |
| 38 | #undef PG_KEYWORD |
| 39 | |