5 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
6 && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \
7 && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \
8 && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \
9 && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \
10 && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \
11 && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \
12 && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \
13 && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \
14 && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \
15 && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \
16 && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \
17 && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \
18 && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \
19 && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \
20 && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \
21 && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \
22 && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \
23 && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \
24 && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \
25 && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \
26 && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \
27 && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126))
28 /* The character set is not based on ISO-646. */
29 #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gperf@gnu.org>."
32 #line 1 "../libinterp/parse-tree/octave.gperf"
37 // Copyright (C) 1995-2023 The Octave Project Developers
39 // See the file COPYRIGHT.md in the top-level directory of this
40 // distribution or <https://octave.org/copyright/>.
42 // This file is part of Octave.
44 // Octave is free software: you can redistribute it and/or modify it
45 // under the terms of the GNU General Public License as published by
46 // the Free Software Foundation, either version 3 of the License, or
47 // (at your option) any later version.
49 // Octave is distributed in the hope that it will be useful, but
50 // WITHOUT ANY WARRANTY; without even the implied warranty of
51 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
52 // GNU General Public License for more details.
54 // You should have received a copy of the GNU General Public License
55 // along with Octave; see the file COPYING. If not, see
56 // <https://www.gnu.org/licenses/>.
58 // NOTE: gperf 2.7.2 will silently generate bad code if there are blank
59 // lines following the "%{" marker above. This comment block seems to be
77 end_unwind_protect_kw,
112 unwind_protect_cleanup_kw,
116 #line 86 "../libinterp/parse-tree/octave.gperf"
117 struct octave_kw { const char *name; int tok; octave_kw_id kw_id; };
119 #define TOTAL_KEYWORDS 48
120 #define MIN_WORD_LENGTH 2
121 #define MAX_WORD_LENGTH 22
122 #define MIN_HASH_VALUE 2
123 #define MAX_HASH_VALUE 71
124 /* maximum key range = 70, duplicates = 0 */
129 static inline unsigned int hash (const char *str, size_t len);
131 static const struct octave_kw *in_word_set (const char *str, size_t len);
135 octave_kw_hash::hash (const char *str, size_t len)
137 static const unsigned char asso_values[] =
139 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
140 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
141 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
142 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
143 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
144 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
145 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
146 72, 72, 72, 72, 72, 72, 55, 72, 5, 72,
147 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
148 72, 72, 72, 72, 72, 5, 72, 25, 0, 10,
149 0, 0, 30, 40, 50, 30, 72, 0, 30, 5,
150 10, 10, 10, 72, 0, 5, 25, 35, 35, 20,
151 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
152 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
153 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
154 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
155 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
156 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
157 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
158 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
159 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
160 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
161 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
162 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
163 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
164 72, 72, 72, 72, 72, 72
166 unsigned int hval = len;
171 hval += asso_values[static_cast<unsigned char>(str[4])];
177 hval += asso_values[static_cast<unsigned char>(str[0])];
183 static const struct octave_kw wordlist[] =
185 #line 95 "../libinterp/parse-tree/octave.gperf"
187 #line 98 "../libinterp/parse-tree/octave.gperf"
188 {"end", END, end_kw},
189 #line 96 "../libinterp/parse-tree/octave.gperf"
190 {"else", ELSE, else_kw},
191 #line 90 "../libinterp/parse-tree/octave.gperf"
192 {"break", BREAK, break_kw},
193 #line 126 "../libinterp/parse-tree/octave.gperf"
194 {"return", FUNC_RET, return_kw},
195 #line 127 "../libinterp/parse-tree/octave.gperf"
196 {"set", SET, set_kw},
197 #line 128 "../libinterp/parse-tree/octave.gperf"
198 {"spmd", SPMD, spmd_kw},
199 #line 108 "../libinterp/parse-tree/octave.gperf"
200 {"endmethods", END, endmethods_kw},
201 #line 114 "../libinterp/parse-tree/octave.gperf"
202 {"enumeration", ENUMERATION, enumeration_kw},
203 #line 101 "../libinterp/parse-tree/octave.gperf"
204 {"endarguments", END, endarguments_kw},
205 #line 110 "../libinterp/parse-tree/octave.gperf"
206 {"endproperties", END, endproperties_kw},
207 #line 91 "../libinterp/parse-tree/octave.gperf"
208 {"case", CASE, case_kw},
209 #line 105 "../libinterp/parse-tree/octave.gperf"
210 {"endfor", END, endfor_kw},
211 #line 111 "../libinterp/parse-tree/octave.gperf"
212 {"endspmd", END, endspmd_kw},
213 #line 136 "../libinterp/parse-tree/octave.gperf"
214 {"__LINE__", NUMBER, magic_line_kw},
215 #line 122 "../libinterp/parse-tree/octave.gperf"
216 {"otherwise", OTHERWISE, otherwise_kw},
217 #line 125 "../libinterp/parse-tree/octave.gperf"
218 {"properties", PROPERTIES, properties_kw},
219 #line 129 "../libinterp/parse-tree/octave.gperf"
220 {"switch", SWITCH, switch_kw},
221 #line 121 "../libinterp/parse-tree/octave.gperf"
222 {"methods", METHODS, methods_kw},
223 #line 93 "../libinterp/parse-tree/octave.gperf"
224 {"classdef", CLASSDEF, classdef_kw},
225 #line 103 "../libinterp/parse-tree/octave.gperf"
226 {"endenumeration", END, endenumeration_kw},
227 #line 134 "../libinterp/parse-tree/octave.gperf"
228 {"while", WHILE, while_kw},
229 #line 123 "../libinterp/parse-tree/octave.gperf"
230 {"parfor", PARFOR, parfor_kw},
231 #line 130 "../libinterp/parse-tree/octave.gperf"
232 {"try", TRY, try_kw},
233 #line 112 "../libinterp/parse-tree/octave.gperf"
234 {"endswitch", END, endswitch_kw},
235 #line 115 "../libinterp/parse-tree/octave.gperf"
236 {"events", EVENTS, events_kw},
237 #line 120 "../libinterp/parse-tree/octave.gperf"
239 #line 116 "../libinterp/parse-tree/octave.gperf"
240 {"for", FOR, for_kw},
241 #line 109 "../libinterp/parse-tree/octave.gperf"
242 {"endparfor", END, endparfor_kw},
243 #line 107 "../libinterp/parse-tree/octave.gperf"
244 {"endif", END, endif_kw},
245 #line 97 "../libinterp/parse-tree/octave.gperf"
246 {"elseif", ELSEIF, elseif_kw},
247 #line 99 "../libinterp/parse-tree/octave.gperf"
248 {"end_try_catch", END, end_try_catch_kw},
249 #line 89 "../libinterp/parse-tree/octave.gperf"
250 {"arguments", ARGUMENTS, arguments_kw},
251 #line 102 "../libinterp/parse-tree/octave.gperf"
252 {"endclassdef", END, endclassdef_kw},
253 #line 118 "../libinterp/parse-tree/octave.gperf"
254 {"get", GET, get_kw},
255 #line 104 "../libinterp/parse-tree/octave.gperf"
256 {"endevents", END, endevents_kw},
257 #line 106 "../libinterp/parse-tree/octave.gperf"
258 {"endfunction", END, endfunction_kw},
259 #line 94 "../libinterp/parse-tree/octave.gperf"
260 {"continue", CONTINUE, continue_kw},
261 #line 124 "../libinterp/parse-tree/octave.gperf"
262 {"persistent", PERSISTENT, persistent_kw},
263 #line 100 "../libinterp/parse-tree/octave.gperf"
264 {"end_unwind_protect", END, end_unwind_protect_kw},
265 #line 113 "../libinterp/parse-tree/octave.gperf"
266 {"endwhile", END, endwhile_kw},
267 #line 132 "../libinterp/parse-tree/octave.gperf"
268 {"unwind_protect", UNWIND, unwind_protect_kw},
269 #line 117 "../libinterp/parse-tree/octave.gperf"
270 {"function", FCN, function_kw},
271 #line 92 "../libinterp/parse-tree/octave.gperf"
272 {"catch", CATCH, catch_kw},
273 #line 133 "../libinterp/parse-tree/octave.gperf"
274 {"unwind_protect_cleanup", CLEANUP, unwind_protect_cleanup_kw},
275 #line 135 "../libinterp/parse-tree/octave.gperf"
276 {"__FILE__", DQ_STRING, magic_file_kw},
277 #line 131 "../libinterp/parse-tree/octave.gperf"
278 {"until", UNTIL, until_kw},
279 #line 119 "../libinterp/parse-tree/octave.gperf"
280 {"global", GLOBAL, global_kw}
283 static const signed char gperf_lookup[] =
285 -1, -1, 0, 1, 2, 3, 4, -1, 5, 6, 7, 8, 9, 10,
286 11, -1, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
287 23, 24, -1, 25, 26, 27, 28, 29, 30, -1, 31, 32, -1, 33,
288 -1, 34, 35, -1, 36, -1, 37, -1, 38, -1, -1, 39, -1, -1,
289 -1, -1, 40, 41, -1, -1, -1, 42, -1, 43, -1, 44, 45, -1,
293 const struct octave_kw *
294 octave_kw_hash::in_word_set (const char *str, size_t len)
296 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
298 unsigned int key = hash (str, len);
300 if (key <= MAX_HASH_VALUE)
302 int index = gperf_lookup[key];
306 const char *s = wordlist[index].name;
308 if (*str == *s && !strcmp (str + 1, s + 1))
309 return &wordlist[index];