| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * keywords.h |
| 4 | * lexical token lookup for key words in PostgreSQL |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2017, PostgreSQL Global Development PGGroup |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * src/include/common/keywords.h |
| 11 | * |
| 12 | *------------------------------------------------------------------------- |
| 13 | */ |
| 14 | #pragma once |
| 15 | |
| 16 | #include <cstdint> |
| 17 | |
| 18 | /* Keyword categories --- should match lists in gram.y */ |
| 19 | #define UNRESERVED_KEYWORD 0 |
| 20 | #define COL_NAME_KEYWORD 1 |
| 21 | #define TYPE_FUNC_NAME_KEYWORD 2 |
| 22 | #define RESERVED_KEYWORD 3 |
| 23 | |
| 24 | namespace duckdb_libpgquery { |
| 25 | |
| 26 | typedef struct PGScanKeyword { |
| 27 | const char *name; /* in lower case */ |
| 28 | int16_t value; /* grammar's token code */ |
| 29 | int16_t category; /* see codes above */ |
| 30 | } PGScanKeyword; |
| 31 | |
| 32 | const PGScanKeyword *ScanKeywordLookup(const char *text, const PGScanKeyword *keywords, int num_keywords); |
| 33 | } |