1 /* C code produced by gperf version 2.7.2 */
2 /* Command-line: gperf -p -j1 -i 1 -g -o -t -N rb_reserved_word -k'1,3,$' ./keywords */
9 #define TOTAL_KEYWORDS 40
10 #define MIN_WORD_LENGTH 2
11 #define MAX_WORD_LENGTH 8
12 #define MIN_HASH_VALUE 6
13 #define MAX_HASH_VALUE 55
14 /* maximum key range = 50, duplicates = 0 */
24 hash (register const char *str, register unsigned int len)
26 static const unsigned char asso_values[] =
28 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
29 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
30 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
31 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
32 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
33 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
34 56, 56, 56, 11, 56, 56, 36, 56, 1, 37,
35 31, 1, 56, 56, 56, 56, 29, 56, 1, 56,
36 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
37 56, 56, 56, 56, 56, 1, 56, 32, 1, 2,
38 1, 1, 4, 23, 56, 17, 56, 20, 9, 2,
39 9, 26, 14, 56, 5, 1, 1, 16, 56, 21,
40 20, 9, 56, 56, 56, 56, 56, 56, 56, 56,
41 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
42 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
43 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
44 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
45 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
46 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
47 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
48 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
49 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
50 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
51 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
52 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
53 56, 56, 56, 56, 56, 56
55 register int hval = len;
61 hval += asso_values[(unsigned char)str[2]];
64 hval += asso_values[(unsigned char)str[0]];
67 return hval + asso_values[(unsigned char)str[len - 1]];
73 const struct kwtable *
74 syd_reserved_word (register const char *str, register unsigned int len)
76 static const struct kwtable wordlist[] =
78 {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}},
79 {{kEND, kEND}, EXPR_END, "end"},
80 {{kELSE, kELSE}, EXPR_BEG, "else"},
81 {{kCASE, kCASE}, EXPR_BEG, "case"},
82 {{kENSURE, kENSURE}, EXPR_BEG, "ensure"},
83 {{kMODULE, kMODULE}, EXPR_BEG, "module"},
84 {{kELSIF, kELSIF}, EXPR_BEG, "elsif"},
85 {{kDEF, kDEF}, EXPR_FNAME, "def"},
86 {{kRESCUE, kRESCUE_MOD}, EXPR_MID, "rescue"},
87 {{kNOT, kNOT}, EXPR_BEG, "not"},
88 {{kTHEN, kTHEN}, EXPR_BEG, "then"},
89 {{kYIELD, kYIELD}, EXPR_ARG, "yield"},
90 {{kFOR, kFOR}, EXPR_BEG, "for"},
91 {{kSELF, kSELF}, EXPR_END, "self"},
92 {{kFALSE, kFALSE}, EXPR_END, "false"},
93 {{kRETRY, kRETRY}, EXPR_END, "retry"},
94 {{kRETURN, kRETURN}, EXPR_MID, "return"},
95 {{kTRUE, kTRUE}, EXPR_END, "true"},
96 {{kIF, kIF_MOD}, EXPR_BEG, "if"},
97 {{kDEFINED, kDEFINED}, EXPR_ARG, "defined?"},
98 {{kSUPER, kSUPER}, EXPR_ARG, "super"},
99 {{kUNDEF, kUNDEF}, EXPR_FNAME, "undef"},
100 {{kBREAK, kBREAK}, EXPR_MID, "break"},
101 {{kIN, kIN}, EXPR_BEG, "in"},
102 {{kDO, kDO}, EXPR_BEG, "do"},
103 {{kNIL, kNIL}, EXPR_END, "nil"},
104 {{kUNTIL, kUNTIL_MOD}, EXPR_BEG, "until"},
105 {{kUNLESS, kUNLESS_MOD}, EXPR_BEG, "unless"},
106 {{kOR, kOR}, EXPR_BEG, "or"},
107 {{kNEXT, kNEXT}, EXPR_MID, "next"},
108 {{kWHEN, kWHEN}, EXPR_BEG, "when"},
109 {{kREDO, kREDO}, EXPR_END, "redo"},
110 {{kAND, kAND}, EXPR_BEG, "and"},
111 {{kBEGIN, kBEGIN}, EXPR_BEG, "begin"},
112 {{k__LINE__, k__LINE__}, EXPR_END, "__LINE__"},
113 {{kCLASS, kCLASS}, EXPR_CLASS, "class"},
114 {{k__FILE__, k__FILE__}, EXPR_END, "__FILE__"},
115 {{klEND, klEND}, EXPR_END, "END"},
116 {{klBEGIN, klBEGIN}, EXPR_END, "BEGIN"},
117 {{kWHILE, kWHILE_MOD}, EXPR_BEG, "while"},
118 {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}},
119 {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}}, {{0, 0}},
120 {{kALIAS, kALIAS}, EXPR_FNAME, "alias"}
123 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
125 register int key = hash (str, len);
127 if (key <= MAX_HASH_VALUE && key >= 0)
129 register const char *s = wordlist[key].name;
131 if (*str == *s && !strcmp (str + 1, s + 1))
132 return &wordlist[key];