mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
207 lines
7.3 KiB
Plaintext
207 lines
7.3 KiB
Plaintext
/* C code produced by gperf version 2.7.2 */
|
|
/* Command-line: ../src/gperf -D -t -k'1,$' */
|
|
|
|
/* Command-line: gperf -L KR-C -F ', 0, 0' -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
|
|
struct resword { const char *name; short token; enum rid rid; };
|
|
|
|
#define TOTAL_KEYWORDS 83
|
|
#define MIN_WORD_LENGTH 2
|
|
#define MAX_WORD_LENGTH 20
|
|
#define MIN_HASH_VALUE 4
|
|
#define MAX_HASH_VALUE 127
|
|
/* maximum key range = 124, duplicates = 8 */
|
|
|
|
#ifdef __GNUC__
|
|
__inline
|
|
#else
|
|
#ifdef __cplusplus
|
|
inline
|
|
#endif
|
|
#endif
|
|
static unsigned int
|
|
hash (str, len)
|
|
register const char *str;
|
|
register unsigned int len;
|
|
{
|
|
static unsigned char asso_values[] =
|
|
{
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 0, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 5, 128, 0, 15, 50,
|
|
55, 0, 15, 35, 65, 60, 128, 40, 0, 60,
|
|
65, 10, 128, 128, 15, 20, 30, 20, 40, 0,
|
|
20, 15, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
|
|
128, 128, 128, 128, 128, 128
|
|
};
|
|
return len + asso_values[(unsigned char)str[len - 1]] + asso_values[(unsigned char)str[0]];
|
|
}
|
|
|
|
#ifdef __GNUC__
|
|
__inline
|
|
#endif
|
|
struct resword *
|
|
in_word_set (str, len)
|
|
register const char *str;
|
|
register unsigned int len;
|
|
{
|
|
static struct resword wordlist[] =
|
|
{
|
|
{"else", ELSE, NORID},
|
|
{"while", WHILE, NORID},
|
|
{"@encode", ENCODE, NORID},
|
|
{"@private", PRIVATE, NORID},
|
|
{"@protocol", PROTOCOL, NORID},
|
|
{"@interface", INTERFACE, NORID},
|
|
{"__real", REALPART, NORID},
|
|
{"__inline", SCSPEC, RID_INLINE},
|
|
{"auto", SCSPEC, RID_AUTO},
|
|
{"__volatile", TYPE_QUAL, RID_VOLATILE},
|
|
{"__attribute", ATTRIBUTE, NORID},
|
|
{"__asm__", ASM_KEYWORD, NORID},
|
|
{"__imag__", IMAGPART, NORID},
|
|
{"__real__", REALPART, NORID},
|
|
{"__const__", TYPE_QUAL, RID_CONST},
|
|
{"__label__", LABEL, NORID},
|
|
{"__inline__", SCSPEC, RID_INLINE},
|
|
{"__typeof__", TYPEOF, NORID},
|
|
{"__signed__", TYPESPEC, RID_SIGNED},
|
|
{"__alignof__", ALIGNOF, NORID},
|
|
{"__complex__", TYPESPEC, RID_COMPLEX},
|
|
{"__iterator__", SCSPEC, RID_ITERATOR},
|
|
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
|
|
{"__restrict__", TYPE_QUAL, RID_RESTRICT},
|
|
{"__attribute__", ATTRIBUTE, NORID},
|
|
{"__extension__", EXTENSION, NORID},
|
|
{"@selector", SELECTOR, NORID},
|
|
{"@defs", DEFS, NORID},
|
|
{"@class", CLASS, NORID},
|
|
{"__typeof", TYPEOF, NORID},
|
|
{"__alignof", ALIGNOF, NORID},
|
|
{"__iterator", SCSPEC, RID_ITERATOR},
|
|
{"oneway", TYPE_QUAL, RID_ONEWAY},
|
|
{"for", FOR, NORID},
|
|
{"__complex", TYPESPEC, RID_COMPLEX},
|
|
{"byref", TYPE_QUAL, RID_BYREF},
|
|
{"bycopy", TYPE_QUAL, RID_BYCOPY},
|
|
{"register", SCSPEC, RID_REGISTER},
|
|
{"long", TYPESPEC, RID_LONG},
|
|
{"@compatibility_alias", ALIAS, NORID},
|
|
{"sizeof", SIZEOF, NORID},
|
|
{"__const", TYPE_QUAL, RID_CONST},
|
|
{"out", TYPE_QUAL, RID_OUT},
|
|
{"__restrict", TYPE_QUAL, RID_RESTRICT},
|
|
{"__imag", IMAGPART, NORID},
|
|
{"volatile", TYPE_QUAL, RID_VOLATILE},
|
|
{"goto", GOTO, NORID},
|
|
{"float", TYPESPEC, RID_FLOAT},
|
|
{"typeof", TYPEOF, NORID},
|
|
{"typedef", SCSPEC, RID_TYPEDEF},
|
|
{"restrict", TYPE_QUAL, RID_RESTRICT},
|
|
{"case", CASE, NORID},
|
|
{"short", TYPESPEC, RID_SHORT},
|
|
{"struct", STRUCT, NORID},
|
|
{"@public", PUBLIC, NORID},
|
|
{"continue", CONTINUE, NORID},
|
|
{"@end", END, NORID},
|
|
{"break", BREAK, NORID},
|
|
{"double", TYPESPEC, RID_DOUBLE},
|
|
{"asm", ASM_KEYWORD, NORID},
|
|
{"enum", ENUM, NORID},
|
|
{"@protected", PROTECTED, NORID},
|
|
{"inline", SCSPEC, RID_INLINE},
|
|
{"do", DO, NORID},
|
|
{"__signed", TYPESPEC, RID_SIGNED},
|
|
{"char", TYPESPEC, RID_CHAR},
|
|
{"__asm", ASM_KEYWORD, NORID},
|
|
{"extern", SCSPEC, RID_EXTERN},
|
|
{"static", SCSPEC, RID_STATIC},
|
|
{"if", IF, NORID},
|
|
{"@implementation", IMPLEMENTATION, NORID},
|
|
{"signed", TYPESPEC, RID_SIGNED},
|
|
{"unsigned", TYPESPEC, RID_UNSIGNED},
|
|
{"const", TYPE_QUAL, RID_CONST},
|
|
{"return", RETURN, NORID},
|
|
{"union", UNION, NORID},
|
|
{"switch", SWITCH, NORID},
|
|
{"default", DEFAULT, NORID},
|
|
{"int", TYPESPEC, RID_INT},
|
|
{"inout", TYPE_QUAL, RID_INOUT},
|
|
{"void", TYPESPEC, RID_VOID},
|
|
{"id", OBJECTNAME, RID_ID},
|
|
{"in", TYPE_QUAL, RID_IN}
|
|
};
|
|
|
|
static short lookup[] =
|
|
{
|
|
-1, -1, -1, -1, 0, 1, -1, 2,
|
|
3, 4, 5, 6, -1, 7, 8, 9,
|
|
10, 11, -184, -180, -171, -162, -158, -156,
|
|
26, 27, 28, -1, 29, 30, 31, 32,
|
|
-1, 33, 34, 35, 36, -1, 37, 38,
|
|
39, 40, 41, 42, -1, 43, 44, -1,
|
|
45, 46, 47, 48, 49, 50, 51, 52,
|
|
53, 54, 55, 56, 57, 58, -1, 59,
|
|
60, 61, 62, 63, 64, 65, 66, 67,
|
|
-59, -2, -62, -3, 68, 69, -64, -2,
|
|
70, 71, -1, 72, -1, 73, 74, -67,
|
|
-3, -1, 75, 76, 77, 78, -1, 79,
|
|
-69, -2, -1, 80, -71, -2, -1, -1,
|
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
|
-1, -1, -1, -1, -1, 81, -1, -1,
|
|
-1, -1, -1, -1, -1, -1, -1, 82
|
|
};
|
|
|
|
if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
|
|
{
|
|
register int key = hash (str, len);
|
|
|
|
if (key <= MAX_HASH_VALUE && key >= 0)
|
|
{
|
|
register int index = lookup[key];
|
|
|
|
if (index >= 0)
|
|
{
|
|
register const char *s = wordlist[index].name;
|
|
|
|
if (*str == *s && !strcmp (str + 1, s + 1))
|
|
return &wordlist[index];
|
|
}
|
|
else if (index < -TOTAL_KEYWORDS)
|
|
{
|
|
register int offset = - 1 - TOTAL_KEYWORDS - index;
|
|
register struct resword *wordptr = &wordlist[TOTAL_KEYWORDS + lookup[offset]];
|
|
register struct resword *wordendptr = wordptr + -lookup[offset + 1];
|
|
|
|
while (wordptr < wordendptr)
|
|
{
|
|
register const char *s = wordptr->name;
|
|
|
|
if (*str == *s && !strcmp (str + 1, s + 1))
|
|
return wordptr;
|
|
wordptr++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|