freebsd-dev/contrib/gperf/tests/test-4.exp
2000-03-25 07:45:29 +00:00

163 lines
5.3 KiB
Plaintext

/* C code produced by gperf version 2.7 */
/* Command-line: ../src/gperf -D -p -t */
/* Command-line: gperf -p -j1 -i 1 -g -o -t -N is_reserved_word -k1,3,$ c-parse.gperf */
struct resword { char *name; short token; enum rid rid; };
#define TOTAL_KEYWORDS 51
#define MIN_WORD_LENGTH 2
#define MAX_WORD_LENGTH 13
#define MIN_HASH_VALUE 4
#define MAX_HASH_VALUE 82
/* maximum key range = 79, duplicates = 2 */
#ifdef __GNUC__
__inline
#endif
static unsigned int
hash (str, len)
register const char *str;
register unsigned int len;
{
static unsigned char asso_values[] =
{
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 0, 83, 40, 20, 50,
25, 10, 30, 0, 0, 50, 83, 0, 15, 0,
35, 0, 83, 83, 20, 0, 10, 40, 5, 15,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83, 83, 83, 83, 83,
83, 83, 83, 83, 83, 83
};
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[] =
{
{"goto", GOTO, NORID},
{"__asm", ASM, NORID},
{"switch", SWITCH, NORID},
{"__asm__", ASM, NORID},
{"__const__", TYPE_QUAL, RID_CONST},
{"__inline__", SCSPEC, RID_INLINE},
{"__typeof__", TYPEOF, NORID},
{"__signed__", TYPESPEC, RID_SIGNED},
{"__alignof__", ALIGNOF, NORID},
{"__volatile__", TYPE_QUAL, RID_VOLATILE},
{"__attribute__", ATTRIBUTE, NORID},
{"enum", ENUM, NORID},
{"short", TYPESPEC, RID_SHORT},
{"struct", STRUCT, NORID},
{"__const", TYPE_QUAL, RID_CONST},
{"__inline", SCSPEC, RID_INLINE},
{"long", TYPESPEC, RID_LONG},
{"__volatile", TYPE_QUAL, RID_VOLATILE},
{"__attribute", ATTRIBUTE, NORID},
{"volatile", TYPE_QUAL, RID_VOLATILE},
{"else", ELSE, NORID},
{"break", BREAK, NORID},
{"do", DO, NORID},
{"while", WHILE, NORID},
{"signed", TYPESPEC, RID_SIGNED},
{"__signed", TYPESPEC, RID_SIGNED},
{"void", TYPESPEC, RID_VOID},
{"sizeof", SIZEOF, NORID},
{"__typeof", TYPEOF, NORID},
{"__alignof", ALIGNOF, NORID},
{"double", TYPESPEC, RID_DOUBLE},
{"default", DEFAULT, NORID},
{"asm", ASM, NORID},
{"auto", SCSPEC, RID_AUTO},
{"float", TYPESPEC, RID_FLOAT},
{"typeof", TYPEOF, NORID},
{"typedef", SCSPEC, RID_TYPEDEF},
{"register", SCSPEC, RID_REGISTER},
{"extern", SCSPEC, RID_EXTERN},
{"for", FOR, NORID},
{"static", SCSPEC, RID_STATIC},
{"return", RETURN, NORID},
{"int", TYPESPEC, RID_INT},
{"case", CASE, NORID},
{"const", TYPE_QUAL, RID_CONST},
{"inline", SCSPEC, RID_INLINE},
{"continue", CONTINUE, NORID},
{"unsigned", TYPESPEC, RID_UNSIGNED},
{"char", TYPESPEC, RID_CHAR},
{"union", UNION, NORID},
{"if", IF, NORID}
};
static short lookup[] =
{
-1, -1, -1, -1, 0, 1, 2, 3, -1, 4,
-80, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, -1, 19, 20, 21, -1, 22, -46, -3,
23, 24, -1, 25, 26, -1, 27, -1, 28, 29,
-1, 30, 31, 32, 33, 34, 35, 36, 37, -1,
-1, 38, -1, 39, -1, -1, 40, -1, -1, -1,
-1, 41, -1, 42, 43, 44, 45, -1, 46, -1,
-1, -1, -1, 47, 48, -1, -1, -1, -1, -1,
49, -1, 50
};
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;
}