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
52
53
54
55
56
57
|
/*-------------------------------------------------------------------------
*
* keywords.c
* lexical token lookup for reserved words in postgres embedded SQL
*
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/c_keywords.c,v 1.21 2007/08/22 08:20:58 meskes Exp $
* §
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include <ctype.h>
#include "extern.h"
#include "preproc.h"
/*
* List of (keyword-name, keyword-token-value) pairs.
*
* !!WARNING!!: This list must be sorted, because binary
* search is used to locate entries.
*/
static const ScanKeyword ScanCKeywords[] = {
/* name value */
{"VARCHAR", VARCHAR},
{"auto", S_AUTO},
{"bool", SQL_BOOL},
{"char", CHAR_P},
{"const", S_CONST},
{"enum", ENUM_P},
{"extern", S_EXTERN},
{"float", FLOAT_P},
{"hour", HOUR_P},
{"int", INT_P},
{"long", SQL_LONG},
{"minute", MINUTE_P},
{"month", MONTH_P},
{"register", S_REGISTER},
{"second", SECOND_P},
{"short", SQL_SHORT},
{"signed", SQL_SIGNED},
{"static", S_STATIC},
{"struct", SQL_STRUCT},
{"to", TO},
{"typedef", S_TYPEDEF},
{"union", UNION},
{"unsigned", SQL_UNSIGNED},
{"varchar", VARCHAR},
{"volatile", S_VOLATILE},
{"year", YEAR_P},
};
const ScanKeyword *
ScanCKeywordLookup(char *text)
{
return DoLookup(text, &ScanCKeywords[0], endof(ScanCKeywords) - 1);
}
|