forked from orafce/orafce
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_keyword.c
More file actions
51 lines (35 loc) · 742 Bytes
/
parse_keyword.c
File metadata and controls
51 lines (35 loc) · 742 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include "postgres.h"
#include "parse_keyword.h"
#include "parser/gramparse.h"
#if PG_VERSION_NUM >= 90600
#include "common/keywords.h"
#else
#include "parser/keywords.h"
#endif
#if PG_VERSION_NUM >= 120000
const char *
orafce_scan_keyword(const char *text, int *keycode)
{
int kwnum;
kwnum = ScanKeywordLookup(text, &ScanKeywords);
if (kwnum >= 0)
{
*keycode = ScanKeywordTokens[kwnum];
return GetScanKeyword(kwnum, &ScanKeywords);
}
return NULL;
}
#else
const char *
orafce_scan_keyword(const char *text, int *keycode)
{
const ScanKeyword *keyword;
keyword = ScanKeywordLookup(text, ScanKeywords, NumScanKeywords);
if (keyword)
{
*keycode = keyword->value;
return keyword->name;
}
return NULL;
}
#endif