mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 21:19:24 +00:00
213 lines
7.6 KiB
Plaintext
213 lines
7.6 KiB
Plaintext
/* C code produced by gperf version 2.7.2 */
|
|
/* Command-line: ../src/gperf -D -p -t -k'1,$' */
|
|
|
|
/* Command-line: gperf -L KR-C -F ', 0, 0' -p -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 6
|
|
#define MAX_HASH_VALUE 170
|
|
/* maximum key range = 165, 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[] =
|
|
{
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 30, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 0, 171, 10, 80, 60,
|
|
15, 20, 85, 45, 0, 30, 171, 0, 40, 35,
|
|
45, 20, 171, 171, 60, 0, 10, 15, 35, 0,
|
|
5, 60, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
|
|
171, 171, 171, 171, 171, 171
|
|
};
|
|
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[] =
|
|
{
|
|
{"switch", SWITCH, 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},
|
|
{"__complex", TYPESPEC, RID_COMPLEX},
|
|
{"short", TYPESPEC, RID_SHORT},
|
|
{"struct", STRUCT, NORID},
|
|
{"__const", TYPE_QUAL, RID_CONST},
|
|
{"__restrict", TYPE_QUAL, RID_RESTRICT},
|
|
{"signed", TYPESPEC, RID_SIGNED},
|
|
{"__signed", TYPESPEC, RID_SIGNED},
|
|
{"while", WHILE, NORID},
|
|
{"__inline", SCSPEC, RID_INLINE},
|
|
{"__volatile", TYPE_QUAL, RID_VOLATILE},
|
|
{"__attribute", ATTRIBUTE, NORID},
|
|
{"default", DEFAULT, NORID},
|
|
{"out", TYPE_QUAL, RID_OUT},
|
|
{"auto", SCSPEC, RID_AUTO},
|
|
{"@defs", DEFS, NORID},
|
|
{"@class", CLASS, NORID},
|
|
{"do", DO, NORID},
|
|
{"unsigned", TYPESPEC, RID_UNSIGNED},
|
|
{"__asm", ASM_KEYWORD, NORID},
|
|
{"double", TYPESPEC, RID_DOUBLE},
|
|
{"int", TYPESPEC, RID_INT},
|
|
{"else", ELSE, NORID},
|
|
{"inout", TYPE_QUAL, RID_INOUT},
|
|
{"__real", REALPART, NORID},
|
|
{"id", OBJECTNAME, RID_ID},
|
|
{"asm", ASM_KEYWORD, NORID},
|
|
{"@end", END, NORID},
|
|
{"@compatibility_alias", ALIAS, NORID},
|
|
{"__imag", IMAGPART, NORID},
|
|
{"void", TYPESPEC, RID_VOID},
|
|
{"@protected", PROTECTED, NORID},
|
|
{"inline", SCSPEC, RID_INLINE},
|
|
{"@encode", ENCODE, NORID},
|
|
{"@private", PRIVATE, NORID},
|
|
{"enum", ENUM, NORID},
|
|
{"@interface", INTERFACE, NORID},
|
|
{"volatile", TYPE_QUAL, RID_VOLATILE},
|
|
{"union", UNION, NORID},
|
|
{"static", SCSPEC, RID_STATIC},
|
|
{"goto", GOTO, NORID},
|
|
{"__iterator", SCSPEC, RID_ITERATOR},
|
|
{"extern", SCSPEC, RID_EXTERN},
|
|
{"const", TYPE_QUAL, RID_CONST},
|
|
{"in", TYPE_QUAL, RID_IN},
|
|
{"restrict", TYPE_QUAL, RID_RESTRICT},
|
|
{"@protocol", PROTOCOL, NORID},
|
|
{"case", CASE, NORID},
|
|
{"break", BREAK, NORID},
|
|
{"oneway", TYPE_QUAL, RID_ONEWAY},
|
|
{"continue", CONTINUE, NORID},
|
|
{"long", TYPESPEC, RID_LONG},
|
|
{"@implementation", IMPLEMENTATION, NORID},
|
|
{"sizeof", SIZEOF, NORID},
|
|
{"__typeof", TYPEOF, NORID},
|
|
{"__alignof", ALIGNOF, NORID},
|
|
{"@public", PUBLIC, NORID},
|
|
{"@selector", SELECTOR, NORID},
|
|
{"float", TYPESPEC, RID_FLOAT},
|
|
{"typeof", TYPEOF, NORID},
|
|
{"typedef", SCSPEC, RID_TYPEDEF},
|
|
{"return", RETURN, NORID},
|
|
{"if", IF, NORID},
|
|
{"char", TYPESPEC, RID_CHAR},
|
|
{"register", SCSPEC, RID_REGISTER},
|
|
{"bycopy", TYPE_QUAL, RID_BYCOPY},
|
|
{"for", FOR, NORID},
|
|
{"byref", TYPE_QUAL, RID_BYREF}
|
|
};
|
|
|
|
static short lookup[] =
|
|
{
|
|
-1, -1, -1, -1, -1, -1, 0, 1,
|
|
-156, -151, -145, -136, -110, -102, 16, 17,
|
|
18, 19, -69, -2, 20, 21, -1, 22,
|
|
-1, 23, -72, -3, 24, -1, 25, 26,
|
|
27, 28, 29, 30, 31, 32, 33, -1,
|
|
34, 35, -1, 36, 37, 38, 39, 40,
|
|
41, 42, 43, 44, -74, -2, 45, 46,
|
|
47, 48, 49, 50, 51, -77, -3, 52,
|
|
-1, 53, 54, -79, -2, 55, 56, 57,
|
|
-81, -2, -1, 58, -1, 59, 60, 61,
|
|
-1, -1, -1, -1, 62, 63, 64, -1,
|
|
65, 66, 67, 68, -1, 69, 70, -1,
|
|
-1, 71, -1, 72, 73, 74, 75, -1,
|
|
-1, -1, -1, -1, -1, -1, -1, 76,
|
|
-1, -1, -1, -1, -1, 77, -1, -1,
|
|
-1, -1, -1, -1, 78, -1, -1, -1,
|
|
79, -1, -1, -1, -1, -1, -1, -1,
|
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
|
-1, -1, 80, -1, 81, -1, -1, -1,
|
|
-1, -1, -1, -1, -1, -1, -1, -1,
|
|
-1, -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;
|
|
}
|