]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | #line 3 "ircd_lexer.c" | |
3 | ||
4 | #define YY_INT_ALIGNED short int | |
5 | ||
6 | /* A lexical scanner generated by flex */ | |
7 | ||
8 | #define FLEX_SCANNER | |
9 | #define YY_FLEX_MAJOR_VERSION 2 | |
10 | #define YY_FLEX_MINOR_VERSION 5 | |
11 | #define YY_FLEX_SUBMINOR_VERSION 35 | |
12 | #if YY_FLEX_SUBMINOR_VERSION > 0 | |
13 | #define FLEX_BETA | |
14 | #endif | |
15 | ||
16 | /* First, we deal with platform-specific or compiler-specific issues. */ | |
17 | ||
18 | /* begin standard C headers. */ | |
19 | #include <stdio.h> | |
20 | #include <string.h> | |
21 | #include <errno.h> | |
22 | #include <stdlib.h> | |
23 | ||
24 | /* end standard C headers. */ | |
25 | ||
26 | /* flex integer type definitions */ | |
27 | ||
28 | #ifndef FLEXINT_H | |
29 | #define FLEXINT_H | |
30 | ||
31 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | |
32 | ||
33 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L | |
34 | ||
35 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | |
36 | * if you want the limit (max/min) macros for int types. | |
37 | */ | |
38 | #ifndef __STDC_LIMIT_MACROS | |
39 | #define __STDC_LIMIT_MACROS 1 | |
40 | #endif | |
41 | ||
42 | #include <inttypes.h> | |
43 | typedef int8_t flex_int8_t; | |
44 | typedef uint8_t flex_uint8_t; | |
45 | typedef int16_t flex_int16_t; | |
46 | typedef uint16_t flex_uint16_t; | |
47 | typedef int32_t flex_int32_t; | |
48 | typedef uint32_t flex_uint32_t; | |
49 | typedef uint64_t flex_uint64_t; | |
50 | #else | |
51 | typedef signed char flex_int8_t; | |
52 | typedef short int flex_int16_t; | |
53 | typedef int flex_int32_t; | |
54 | typedef unsigned char flex_uint8_t; | |
55 | typedef unsigned short int flex_uint16_t; | |
56 | typedef unsigned int flex_uint32_t; | |
57 | #endif /* ! C99 */ | |
58 | ||
59 | /* Limits of integral types. */ | |
60 | #ifndef INT8_MIN | |
61 | #define INT8_MIN (-128) | |
62 | #endif | |
63 | #ifndef INT16_MIN | |
64 | #define INT16_MIN (-32767-1) | |
65 | #endif | |
66 | #ifndef INT32_MIN | |
67 | #define INT32_MIN (-2147483647-1) | |
68 | #endif | |
69 | #ifndef INT8_MAX | |
70 | #define INT8_MAX (127) | |
71 | #endif | |
72 | #ifndef INT16_MAX | |
73 | #define INT16_MAX (32767) | |
74 | #endif | |
75 | #ifndef INT32_MAX | |
76 | #define INT32_MAX (2147483647) | |
77 | #endif | |
78 | #ifndef UINT8_MAX | |
79 | #define UINT8_MAX (255U) | |
80 | #endif | |
81 | #ifndef UINT16_MAX | |
82 | #define UINT16_MAX (65535U) | |
83 | #endif | |
84 | #ifndef UINT32_MAX | |
85 | #define UINT32_MAX (4294967295U) | |
86 | #endif | |
87 | ||
88 | #endif /* ! FLEXINT_H */ | |
89 | ||
90 | #ifdef __cplusplus | |
91 | ||
92 | /* The "const" storage-class-modifier is valid. */ | |
93 | #define YY_USE_CONST | |
94 | ||
95 | #else /* ! __cplusplus */ | |
96 | ||
97 | /* C99 requires __STDC__ to be defined as 1. */ | |
98 | #if defined (__STDC__) | |
99 | ||
100 | #define YY_USE_CONST | |
101 | ||
102 | #endif /* defined (__STDC__) */ | |
103 | #endif /* ! __cplusplus */ | |
104 | ||
105 | #ifdef YY_USE_CONST | |
106 | #define yyconst const | |
107 | #else | |
108 | #define yyconst | |
109 | #endif | |
110 | ||
111 | /* Returned upon end-of-file. */ | |
112 | #define YY_NULL 0 | |
113 | ||
114 | /* Promotes a possibly negative, possibly signed char to an unsigned | |
115 | * integer for use as an array index. If the signed char is negative, | |
116 | * we want to instead treat it as an 8-bit unsigned char, hence the | |
117 | * double cast. | |
118 | */ | |
119 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | |
120 | ||
121 | /* Enter a start condition. This macro really ought to take a parameter, | |
122 | * but we do it the disgusting crufty way forced on us by the ()-less | |
123 | * definition of BEGIN. | |
124 | */ | |
125 | #define BEGIN (yy_start) = 1 + 2 * | |
126 | ||
127 | /* Translate the current start state into a value that can be later handed | |
128 | * to BEGIN to return to the state. The YYSTATE alias is for lex | |
129 | * compatibility. | |
130 | */ | |
131 | #define YY_START (((yy_start) - 1) / 2) | |
132 | #define YYSTATE YY_START | |
133 | ||
134 | /* Action number for EOF rule of a given start state. */ | |
135 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | |
136 | ||
137 | /* Special action meaning "start processing a new file". */ | |
138 | #define YY_NEW_FILE yyrestart(yyin ) | |
139 | ||
140 | #define YY_END_OF_BUFFER_CHAR 0 | |
141 | ||
142 | /* Size of default input buffer. */ | |
143 | #ifndef YY_BUF_SIZE | |
144 | #define YY_BUF_SIZE 16384 | |
145 | #endif | |
146 | ||
147 | /* The state buf must be large enough to hold one state per character in the main buffer. | |
148 | */ | |
149 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) | |
150 | ||
151 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | |
152 | #define YY_TYPEDEF_YY_BUFFER_STATE | |
153 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | |
154 | #endif | |
155 | ||
156 | #ifndef YY_TYPEDEF_YY_SIZE_T | |
157 | #define YY_TYPEDEF_YY_SIZE_T | |
158 | typedef size_t yy_size_t; | |
159 | #endif | |
160 | ||
161 | extern yy_size_t yyleng; | |
162 | ||
163 | extern FILE *yyin, *yyout; | |
164 | ||
165 | #define EOB_ACT_CONTINUE_SCAN 0 | |
166 | #define EOB_ACT_END_OF_FILE 1 | |
167 | #define EOB_ACT_LAST_MATCH 2 | |
168 | ||
169 | #define YY_LESS_LINENO(n) | |
170 | ||
171 | /* Return all but the first "n" matched characters back to the input stream. */ | |
172 | #define yyless(n) \ | |
173 | do \ | |
174 | { \ | |
175 | /* Undo effects of setting up yytext. */ \ | |
176 | int yyless_macro_arg = (n); \ | |
177 | YY_LESS_LINENO(yyless_macro_arg);\ | |
178 | *yy_cp = (yy_hold_char); \ | |
179 | YY_RESTORE_YY_MORE_OFFSET \ | |
180 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ | |
181 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ | |
182 | } \ | |
183 | while ( 0 ) | |
184 | ||
185 | #define unput(c) yyunput( c, (yytext_ptr) ) | |
186 | ||
187 | #ifndef YY_STRUCT_YY_BUFFER_STATE | |
188 | #define YY_STRUCT_YY_BUFFER_STATE | |
189 | struct yy_buffer_state | |
190 | { | |
191 | FILE *yy_input_file; | |
192 | ||
193 | char *yy_ch_buf; /* input buffer */ | |
194 | char *yy_buf_pos; /* current position in input buffer */ | |
195 | ||
196 | /* Size of input buffer in bytes, not including room for EOB | |
197 | * characters. | |
198 | */ | |
199 | yy_size_t yy_buf_size; | |
200 | ||
201 | /* Number of characters read into yy_ch_buf, not including EOB | |
202 | * characters. | |
203 | */ | |
204 | yy_size_t yy_n_chars; | |
205 | ||
206 | /* Whether we "own" the buffer - i.e., we know we created it, | |
207 | * and can realloc() it to grow it, and should free() it to | |
208 | * delete it. | |
209 | */ | |
210 | int yy_is_our_buffer; | |
211 | ||
212 | /* Whether this is an "interactive" input source; if so, and | |
213 | * if we're using stdio for input, then we want to use getc() | |
214 | * instead of fread(), to make sure we stop fetching input after | |
215 | * each newline. | |
216 | */ | |
217 | int yy_is_interactive; | |
218 | ||
219 | /* Whether we're considered to be at the beginning of a line. | |
220 | * If so, '^' rules will be active on the next match, otherwise | |
221 | * not. | |
222 | */ | |
223 | int yy_at_bol; | |
224 | ||
225 | int yy_bs_lineno; /**< The line count. */ | |
226 | int yy_bs_column; /**< The column count. */ | |
227 | ||
228 | /* Whether to try to fill the input buffer when we reach the | |
229 | * end of it. | |
230 | */ | |
231 | int yy_fill_buffer; | |
232 | ||
233 | int yy_buffer_status; | |
234 | ||
235 | #define YY_BUFFER_NEW 0 | |
236 | #define YY_BUFFER_NORMAL 1 | |
237 | /* When an EOF's been seen but there's still some text to process | |
238 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | |
239 | * shouldn't try reading from the input source any more. We might | |
240 | * still have a bunch of tokens to match, though, because of | |
241 | * possible backing-up. | |
242 | * | |
243 | * When we actually see the EOF, we change the status to "new" | |
244 | * (via yyrestart()), so that the user can continue scanning by | |
245 | * just pointing yyin at a new input file. | |
246 | */ | |
247 | #define YY_BUFFER_EOF_PENDING 2 | |
248 | ||
249 | }; | |
250 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | |
251 | ||
252 | /* Stack of input buffers. */ | |
253 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | |
254 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | |
255 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | |
256 | ||
257 | /* We provide macros for accessing buffer states in case in the | |
258 | * future we want to put the buffer states in a more general | |
259 | * "scanner state". | |
260 | * | |
261 | * Returns the top of the stack, or NULL. | |
262 | */ | |
263 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ | |
264 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ | |
265 | : NULL) | |
266 | ||
267 | /* Same as previous macro, but useful when we know that the buffer stack is not | |
268 | * NULL or when we need an lvalue. For internal use only. | |
269 | */ | |
270 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] | |
271 | ||
272 | /* yy_hold_char holds the character lost when yytext is formed. */ | |
273 | static char yy_hold_char; | |
274 | static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */ | |
275 | yy_size_t yyleng; | |
276 | ||
277 | /* Points to current character in buffer. */ | |
278 | static char *yy_c_buf_p = (char *) 0; | |
279 | static int yy_init = 0; /* whether we need to initialize */ | |
280 | static int yy_start = 0; /* start state number */ | |
281 | ||
282 | /* Flag which is used to allow yywrap()'s to do buffer switches | |
283 | * instead of setting up a fresh yyin. A bit of a hack ... | |
284 | */ | |
285 | static int yy_did_buffer_switch_on_eof; | |
286 | ||
287 | void yyrestart (FILE *input_file ); | |
288 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); | |
289 | YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); | |
290 | void yy_delete_buffer (YY_BUFFER_STATE b ); | |
291 | void yy_flush_buffer (YY_BUFFER_STATE b ); | |
292 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); | |
293 | void yypop_buffer_state (void ); | |
294 | ||
295 | static void yyensure_buffer_stack (void ); | |
296 | static void yy_load_buffer_state (void ); | |
297 | static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); | |
298 | ||
299 | #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) | |
300 | ||
301 | YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); | |
302 | YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); | |
303 | YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len ); | |
304 | ||
305 | void *yyalloc (yy_size_t ); | |
306 | void *yyrealloc (void *,yy_size_t ); | |
307 | void yyfree (void * ); | |
308 | ||
309 | #define yy_new_buffer yy_create_buffer | |
310 | ||
311 | #define yy_set_interactive(is_interactive) \ | |
312 | { \ | |
313 | if ( ! YY_CURRENT_BUFFER ){ \ | |
314 | yyensure_buffer_stack (); \ | |
315 | YY_CURRENT_BUFFER_LVALUE = \ | |
316 | yy_create_buffer(yyin,YY_BUF_SIZE ); \ | |
317 | } \ | |
318 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ | |
319 | } | |
320 | ||
321 | #define yy_set_bol(at_bol) \ | |
322 | { \ | |
323 | if ( ! YY_CURRENT_BUFFER ){\ | |
324 | yyensure_buffer_stack (); \ | |
325 | YY_CURRENT_BUFFER_LVALUE = \ | |
326 | yy_create_buffer(yyin,YY_BUF_SIZE ); \ | |
327 | } \ | |
328 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ | |
329 | } | |
330 | ||
331 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | |
332 | ||
333 | /* Begin user sect3 */ | |
334 | ||
335 | #define yywrap(n) 1 | |
336 | #define YY_SKIP_YYWRAP | |
337 | ||
338 | typedef unsigned char YY_CHAR; | |
339 | ||
340 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; | |
341 | ||
342 | typedef int yy_state_type; | |
343 | ||
344 | extern int yylineno; | |
345 | ||
346 | int yylineno = 1; | |
347 | ||
348 | extern char *yytext; | |
349 | #define yytext_ptr yytext | |
350 | ||
351 | static yy_state_type yy_get_previous_state (void ); | |
352 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | |
353 | static int yy_get_next_buffer (void ); | |
354 | static void yy_fatal_error (yyconst char msg[] ); | |
355 | ||
356 | /* Done after the current pattern has been matched and before the | |
357 | * corresponding action - sets up yytext. | |
358 | */ | |
359 | #define YY_DO_BEFORE_ACTION \ | |
360 | (yytext_ptr) = yy_bp; \ | |
361 | (yytext_ptr) -= (yy_more_len); \ | |
362 | yyleng = (yy_size_t) (yy_cp - (yytext_ptr)); \ | |
363 | (yy_hold_char) = *yy_cp; \ | |
364 | *yy_cp = '\0'; \ | |
365 | (yy_c_buf_p) = yy_cp; | |
366 | ||
367 | #define YY_NUM_RULES 12 | |
368 | #define YY_END_OF_BUFFER 13 | |
369 | /* This struct is not used in this scanner, | |
370 | but its presence is necessary. */ | |
371 | struct yy_trans_info | |
372 | { | |
373 | flex_int32_t yy_verify; | |
374 | flex_int32_t yy_nxt; | |
375 | }; | |
376 | static yyconst flex_int16_t yy_accept[47] = | |
377 | { 0, | |
378 | 4, 4, 13, 11, 4, 3, 11, 5, 11, 11, | |
379 | 6, 9, 9, 4, 3, 0, 7, 5, 10, 0, | |
380 | 2, 6, 9, 9, 0, 9, 0, 9, 0, 9, | |
381 | 0, 9, 0, 9, 0, 9, 0, 0, 0, 9, | |
382 | 0, 1, 0, 1, 8, 0 | |
383 | } ; | |
384 | ||
385 | static yyconst flex_int32_t yy_ec[256] = | |
386 | { 0, | |
387 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | |
388 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
389 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
390 | 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, | |
391 | 1, 6, 1, 1, 1, 7, 8, 9, 9, 9, | |
392 | 9, 9, 9, 9, 9, 9, 9, 10, 1, 11, | |
393 | 1, 12, 1, 1, 13, 10, 14, 15, 16, 10, | |
394 | 10, 10, 17, 10, 10, 18, 19, 20, 21, 10, | |
395 | 10, 10, 10, 10, 22, 10, 10, 10, 10, 10, | |
396 | 1, 1, 1, 1, 10, 1, 23, 10, 24, 25, | |
397 | ||
398 | 26, 10, 10, 10, 27, 10, 10, 28, 29, 30, | |
399 | 31, 10, 10, 10, 10, 10, 32, 10, 10, 10, | |
400 | 10, 10, 1, 1, 1, 33, 1, 1, 1, 1, | |
401 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
402 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
403 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
404 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
405 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
406 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
407 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
408 | ||
409 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
410 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
411 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
412 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
413 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | |
414 | 1, 1, 1, 1, 1 | |
415 | } ; | |
416 | ||
417 | static yyconst flex_int32_t yy_meta[34] = | |
418 | { 0, | |
419 | 1, 1, 2, 1, 1, 1, 1, 1, 3, 3, | |
420 | 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, | |
421 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, | |
422 | 3, 3, 1 | |
423 | } ; | |
424 | ||
425 | static yyconst flex_int16_t yy_base[54] = | |
426 | { 0, | |
427 | 0, 28, 81, 104, 78, 0, 10, 0, 31, 64, | |
428 | 56, 0, 20, 24, 0, 12, 104, 0, 104, 22, | |
429 | 104, 16, 0, 4, 29, 29, 27, 28, 27, 29, | |
430 | 46, 47, 47, 42, 64, 49, 74, 20, 11, 53, | |
431 | 18, 17, 8, 7, 0, 104, 85, 88, 91, 94, | |
432 | 7, 97, 100 | |
433 | } ; | |
434 | ||
435 | static yyconst flex_int16_t yy_def[54] = | |
436 | { 0, | |
437 | 47, 47, 46, 46, 46, 48, 49, 50, 46, 46, | |
438 | 46, 51, 51, 46, 48, 49, 46, 50, 46, 46, | |
439 | 46, 46, 51, 51, 46, 51, 46, 51, 46, 51, | |
440 | 46, 51, 46, 51, 46, 51, 46, 52, 53, 51, | |
441 | 52, 52, 53, 53, 51, 0, 46, 46, 46, 46, | |
442 | 46, 46, 46 | |
443 | } ; | |
444 | ||
445 | static yyconst flex_int16_t yy_nxt[138] = | |
446 | { 0, | |
447 | 4, 5, 6, 7, 8, 4, 9, 10, 11, 23, | |
448 | 4, 4, 17, 17, 17, 17, 26, 13, 44, 44, | |
449 | 42, 42, 44, 42, 22, 14, 26, 13, 4, 5, | |
450 | 6, 7, 8, 4, 9, 10, 11, 19, 4, 4, | |
451 | 24, 25, 27, 28, 29, 13, 30, 20, 31, 32, | |
452 | 24, 25, 27, 28, 29, 13, 30, 20, 31, 32, | |
453 | 33, 34, 35, 36, 22, 37, 40, 38, 45, 21, | |
454 | 33, 34, 35, 36, 39, 37, 40, 38, 45, 14, | |
455 | 46, 46, 46, 46, 39, 12, 12, 12, 15, 46, | |
456 | 15, 16, 16, 16, 18, 46, 18, 41, 46, 41, | |
457 | ||
458 | 43, 46, 43, 3, 46, 46, 46, 46, 46, 46, | |
459 | 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, | |
460 | 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, | |
461 | 46, 46, 46, 46, 46, 46, 46 | |
462 | } ; | |
463 | ||
464 | static yyconst flex_int16_t yy_chk[138] = | |
465 | { 0, | |
466 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 51, | |
467 | 1, 1, 7, 7, 16, 16, 24, 1, 44, 43, | |
468 | 42, 41, 39, 38, 22, 14, 24, 1, 2, 2, | |
469 | 2, 2, 2, 2, 2, 2, 2, 9, 2, 2, | |
470 | 13, 20, 25, 26, 27, 2, 28, 9, 29, 30, | |
471 | 13, 20, 25, 26, 27, 2, 28, 9, 29, 30, | |
472 | 31, 32, 33, 34, 11, 35, 36, 35, 40, 10, | |
473 | 31, 32, 33, 34, 35, 37, 36, 37, 40, 5, | |
474 | 3, 0, 0, 0, 37, 47, 47, 47, 48, 0, | |
475 | 48, 49, 49, 49, 50, 0, 50, 52, 0, 52, | |
476 | ||
477 | 53, 0, 53, 46, 46, 46, 46, 46, 46, 46, | |
478 | 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, | |
479 | 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, | |
480 | 46, 46, 46, 46, 46, 46, 46 | |
481 | } ; | |
482 | ||
483 | static yy_state_type yy_last_accepting_state; | |
484 | static char *yy_last_accepting_cpos; | |
485 | ||
486 | extern int yy_flex_debug; | |
487 | int yy_flex_debug = 0; | |
488 | ||
489 | /* The intent behind this definition is that it'll catch | |
490 | * any uses of REJECT which flex missed. | |
491 | */ | |
492 | #define REJECT reject_used_but_not_detected | |
493 | static int yy_more_flag = 0; | |
494 | static int yy_more_len = 0; | |
495 | #define yymore() ((yy_more_flag) = 1) | |
496 | #define YY_MORE_ADJ (yy_more_len) | |
497 | #define YY_RESTORE_YY_MORE_OFFSET | |
498 | char *yytext; | |
499 | #line 1 "ircd_lexer.l" | |
500 | /* src/ircd_lexer.l | |
501 | * | |
502 | * This program is free software; you can redistribute it and/or modify | |
503 | * it under the terms of the GNU General Public License as published by | |
504 | * the Free Software Foundation; either version 2 of the License, or | |
505 | * (at your option) any later version. | |
506 | * | |
507 | * This program is distributed in the hope that it will be useful, | |
508 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
509 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
510 | * GNU General Public License for more details. | |
511 | * | |
512 | * You should have received a copy of the GNU General Public License | |
513 | * along with this program; if not, write to the Free Software | |
514 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
515 | * USA | |
516 | * | |
517 | * $Id: ircd_lexer.l 3540 2007-07-30 17:26:00Z jilles $ | |
518 | */ | |
519 | #line 26 "ircd_lexer.l" | |
520 | #include <sys/types.h> | |
521 | #include <sys/stat.h> | |
522 | ||
523 | #include <netinet/in.h> | |
524 | ||
525 | #include <string.h> | |
526 | #include <errno.h> | |
527 | #include <limits.h> | |
528 | ||
529 | #define WE_ARE_MEMORY_C | |
530 | ||
531 | #include "stdinc.h" | |
532 | #include "ircd_defs.h" | |
533 | #include "common.h" | |
534 | #include "config.h" | |
535 | #include "logger.h" | |
536 | #include "s_conf.h" | |
537 | #include "newconf.h" | |
538 | ||
539 | #include "ircd_parser.h" | |
540 | ||
541 | int yylex(void); | |
542 | ||
543 | #define MAX_INCLUDE_DEPTH 10 | |
544 | ||
545 | YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; | |
546 | int include_stack_ptr=0; | |
547 | int lineno = 1; | |
548 | void ccomment(void); | |
549 | void cinclude(void); | |
550 | void hashcomment(void); | |
551 | int ieof(void); | |
552 | int lineno_stack[MAX_INCLUDE_DEPTH]; | |
553 | char conffile_stack[MAX_INCLUDE_DEPTH][IRCD_BUFSIZE]; | |
554 | char conffilebuf[IRCD_BUFSIZE+1]; | |
555 | char *current_file = conffilebuf; | |
556 | ||
557 | FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH]; | |
558 | ||
559 | char linebuf[512]; | |
560 | ||
561 | #undef YY_INPUT | |
562 | ||
563 | #define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg) | |
564 | ||
565 | #define YY_INPUT(buf,result,max_size) \ | |
566 | if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \ | |
567 | YY_FATAL_ERROR("input in flex scanner failed"); | |
568 | #line 569 "ircd_lexer.c" | |
569 | ||
570 | #define INITIAL 0 | |
571 | ||
572 | #ifndef YY_NO_UNISTD_H | |
573 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | |
574 | * down here because we want the user's section 1 to have been scanned first. | |
575 | * The user has a chance to override it with an option. | |
576 | */ | |
577 | #include <unistd.h> | |
578 | #endif | |
579 | ||
580 | #ifndef YY_EXTRA_TYPE | |
581 | #define YY_EXTRA_TYPE void * | |
582 | #endif | |
583 | ||
584 | static int yy_init_globals (void ); | |
585 | ||
586 | /* Accessor methods to globals. | |
587 | These are made visible to non-reentrant scanners for convenience. */ | |
588 | ||
589 | int yylex_destroy (void ); | |
590 | ||
591 | int yyget_debug (void ); | |
592 | ||
593 | void yyset_debug (int debug_flag ); | |
594 | ||
595 | YY_EXTRA_TYPE yyget_extra (void ); | |
596 | ||
597 | void yyset_extra (YY_EXTRA_TYPE user_defined ); | |
598 | ||
599 | FILE *yyget_in (void ); | |
600 | ||
601 | void yyset_in (FILE * in_str ); | |
602 | ||
603 | FILE *yyget_out (void ); | |
604 | ||
605 | void yyset_out (FILE * out_str ); | |
606 | ||
607 | yy_size_t yyget_leng (void ); | |
608 | ||
609 | char *yyget_text (void ); | |
610 | ||
611 | int yyget_lineno (void ); | |
612 | ||
613 | void yyset_lineno (int line_number ); | |
614 | ||
615 | /* Macros after this point can all be overridden by user definitions in | |
616 | * section 1. | |
617 | */ | |
618 | ||
619 | #ifndef YY_SKIP_YYWRAP | |
620 | #ifdef __cplusplus | |
621 | extern "C" int yywrap (void ); | |
622 | #else | |
623 | extern int yywrap (void ); | |
624 | #endif | |
625 | #endif | |
626 | ||
627 | #ifndef yytext_ptr | |
628 | static void yy_flex_strncpy (char *,yyconst char *,int ); | |
629 | #endif | |
630 | ||
631 | #ifdef YY_NEED_STRLEN | |
632 | static int yy_flex_strlen (yyconst char * ); | |
633 | #endif | |
634 | ||
635 | #ifndef YY_NO_INPUT | |
636 | ||
637 | #ifdef __cplusplus | |
638 | static int yyinput (void ); | |
639 | #else | |
640 | static int input (void ); | |
641 | #endif | |
642 | ||
643 | #endif | |
644 | ||
645 | /* Amount of stuff to slurp up with each read. */ | |
646 | #ifndef YY_READ_BUF_SIZE | |
647 | #define YY_READ_BUF_SIZE 8192 | |
648 | #endif | |
649 | ||
650 | /* Copy whatever the last rule matched to the standard output. */ | |
651 | #ifndef ECHO | |
652 | /* This used to be an fputs(), but since the string might contain NUL's, | |
653 | * we now use fwrite(). | |
654 | */ | |
655 | #define ECHO fwrite( yytext, yyleng, 1, yyout ) | |
656 | #endif | |
657 | ||
658 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | |
659 | * is returned in "result". | |
660 | */ | |
661 | #ifndef YY_INPUT | |
662 | #define YY_INPUT(buf,result,max_size) \ | |
663 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | |
664 | { \ | |
665 | int c = '*'; \ | |
666 | yy_size_t n; \ | |
667 | for ( n = 0; n < max_size && \ | |
668 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | |
669 | buf[n] = (char) c; \ | |
670 | if ( c == '\n' ) \ | |
671 | buf[n++] = (char) c; \ | |
672 | if ( c == EOF && ferror( yyin ) ) \ | |
673 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | |
674 | result = n; \ | |
675 | } \ | |
676 | else \ | |
677 | { \ | |
678 | errno=0; \ | |
679 | while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ | |
680 | { \ | |
681 | if( errno != EINTR) \ | |
682 | { \ | |
683 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | |
684 | break; \ | |
685 | } \ | |
686 | errno=0; \ | |
687 | clearerr(yyin); \ | |
688 | } \ | |
689 | }\ | |
690 | \ | |
691 | ||
692 | #endif | |
693 | ||
694 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | |
695 | * we don't want an extra ';' after the "return" because that will cause | |
696 | * some compilers to complain about unreachable statements. | |
697 | */ | |
698 | #ifndef yyterminate | |
699 | #define yyterminate() return YY_NULL | |
700 | #endif | |
701 | ||
702 | /* Number of entries by which start-condition stack grows. */ | |
703 | #ifndef YY_START_STACK_INCR | |
704 | #define YY_START_STACK_INCR 25 | |
705 | #endif | |
706 | ||
707 | /* Report a fatal error. */ | |
708 | #ifndef YY_FATAL_ERROR | |
709 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | |
710 | #endif | |
711 | ||
712 | /* end tables serialization structures and prototypes */ | |
713 | ||
714 | /* Default declaration of generated scanner - a define so the user can | |
715 | * easily add parameters. | |
716 | */ | |
717 | #ifndef YY_DECL | |
718 | #define YY_DECL_IS_OURS 1 | |
719 | ||
720 | extern int yylex (void); | |
721 | ||
722 | #define YY_DECL int yylex (void) | |
723 | #endif /* !YY_DECL */ | |
724 | ||
725 | /* Code executed at the beginning of each rule, after yytext and yyleng | |
726 | * have been set up. | |
727 | */ | |
728 | #ifndef YY_USER_ACTION | |
729 | #define YY_USER_ACTION | |
730 | #endif | |
731 | ||
732 | /* Code executed at the end of each rule. */ | |
733 | #ifndef YY_BREAK | |
734 | #define YY_BREAK break; | |
735 | #endif | |
736 | ||
737 | #define YY_RULE_SETUP \ | |
738 | YY_USER_ACTION | |
739 | ||
740 | /** The main scanner function which does all the work. | |
741 | */ | |
742 | YY_DECL | |
743 | { | |
744 | register yy_state_type yy_current_state; | |
745 | register char *yy_cp, *yy_bp; | |
746 | register int yy_act; | |
747 | ||
748 | #line 83 "ircd_lexer.l" | |
749 | ||
750 | #line 751 "ircd_lexer.c" | |
751 | ||
752 | if ( !(yy_init) ) | |
753 | { | |
754 | (yy_init) = 1; | |
755 | ||
756 | #ifdef YY_USER_INIT | |
757 | YY_USER_INIT; | |
758 | #endif | |
759 | ||
760 | if ( ! (yy_start) ) | |
761 | (yy_start) = 1; /* first start state */ | |
762 | ||
763 | if ( ! yyin ) | |
764 | yyin = stdin; | |
765 | ||
766 | if ( ! yyout ) | |
767 | yyout = stdout; | |
768 | ||
769 | if ( ! YY_CURRENT_BUFFER ) { | |
770 | yyensure_buffer_stack (); | |
771 | YY_CURRENT_BUFFER_LVALUE = | |
772 | yy_create_buffer(yyin,YY_BUF_SIZE ); | |
773 | } | |
774 | ||
775 | yy_load_buffer_state( ); | |
776 | } | |
777 | ||
778 | while ( 1 ) /* loops until end-of-file is reached */ | |
779 | { | |
780 | (yy_more_len) = 0; | |
781 | if ( (yy_more_flag) ) | |
782 | { | |
783 | (yy_more_len) = (yy_c_buf_p) - (yytext_ptr); | |
784 | (yy_more_flag) = 0; | |
785 | } | |
786 | yy_cp = (yy_c_buf_p); | |
787 | ||
788 | /* Support of yytext. */ | |
789 | *yy_cp = (yy_hold_char); | |
790 | ||
791 | /* yy_bp points to the position in yy_ch_buf of the start of | |
792 | * the current run. | |
793 | */ | |
794 | yy_bp = yy_cp; | |
795 | ||
796 | yy_current_state = (yy_start); | |
797 | yy_match: | |
798 | do | |
799 | { | |
800 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; | |
801 | if ( yy_accept[yy_current_state] ) | |
802 | { | |
803 | (yy_last_accepting_state) = yy_current_state; | |
804 | (yy_last_accepting_cpos) = yy_cp; | |
805 | } | |
806 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |
807 | { | |
808 | yy_current_state = (int) yy_def[yy_current_state]; | |
809 | if ( yy_current_state >= 47 ) | |
810 | yy_c = yy_meta[(unsigned int) yy_c]; | |
811 | } | |
812 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |
813 | ++yy_cp; | |
814 | } | |
815 | while ( yy_base[yy_current_state] != 104 ); | |
816 | ||
817 | yy_find_action: | |
818 | yy_act = yy_accept[yy_current_state]; | |
819 | if ( yy_act == 0 ) | |
820 | { /* have to back up */ | |
821 | yy_cp = (yy_last_accepting_cpos); | |
822 | yy_current_state = (yy_last_accepting_state); | |
823 | yy_act = yy_accept[yy_current_state]; | |
824 | } | |
825 | ||
826 | YY_DO_BEFORE_ACTION; | |
827 | ||
828 | do_action: /* This label is used only to access EOF actions. */ | |
829 | ||
830 | switch ( yy_act ) | |
831 | { /* beginning of action switch */ | |
832 | case 0: /* must back up */ | |
833 | /* undo the effects of YY_DO_BEFORE_ACTION */ | |
834 | *yy_cp = (yy_hold_char); | |
835 | yy_cp = (yy_last_accepting_cpos); | |
836 | yy_current_state = (yy_last_accepting_state); | |
837 | goto yy_find_action; | |
838 | ||
839 | case 1: | |
840 | YY_RULE_SETUP | |
841 | #line 84 "ircd_lexer.l" | |
842 | { cinclude(); } | |
843 | YY_BREAK | |
844 | case 2: | |
845 | YY_RULE_SETUP | |
846 | #line 85 "ircd_lexer.l" | |
847 | { ccomment(); } | |
848 | YY_BREAK | |
849 | case 3: | |
850 | /* rule 3 can match eol */ | |
851 | YY_RULE_SETUP | |
852 | #line 86 "ircd_lexer.l" | |
853 | { strcpy(linebuf, yytext+1); lineno++; yyless(1); } | |
854 | YY_BREAK | |
855 | case 4: | |
856 | YY_RULE_SETUP | |
857 | #line 88 "ircd_lexer.l" | |
858 | ; | |
859 | YY_BREAK | |
860 | case 5: | |
861 | YY_RULE_SETUP | |
862 | #line 89 "ircd_lexer.l" | |
863 | { hashcomment(); } | |
864 | YY_BREAK | |
865 | case 6: | |
866 | YY_RULE_SETUP | |
867 | #line 91 "ircd_lexer.l" | |
868 | { yylval.number = atoi(yytext); return NUMBER; } | |
869 | YY_BREAK | |
870 | case 7: | |
871 | /* rule 7 can match eol */ | |
872 | YY_RULE_SETUP | |
873 | #line 93 "ircd_lexer.l" | |
874 | { | |
875 | if(yytext[yyleng-2] == '\\') | |
876 | { | |
877 | yyless(yyleng-1); /* return last quote */ | |
878 | yymore(); /* append next string */ | |
879 | } | |
880 | else | |
881 | { | |
882 | strcpy(yylval.string, yytext + 1); | |
883 | if(yylval.string[yyleng-2] != '"') | |
884 | ilog(L_MAIN, "Unterminated character string"); | |
885 | else | |
886 | { | |
887 | int i,j; | |
888 | yylval.string[yyleng-2] = '\0'; /* remove close | |
889 | * quote | |
890 | */ | |
891 | ||
892 | for (j=i=0 ;yylval.string[i] != '\0'; i++,j++) | |
893 | { | |
894 | if (yylval.string[i] != '\\') | |
895 | { | |
896 | yylval.string[j] = yylval.string[i]; | |
897 | } | |
898 | else | |
899 | { | |
900 | i++; | |
901 | if (yylval.string[i] == '\0') /* XXX | |
902 | * should not | |
903 | * happen | |
904 | */ | |
905 | { | |
906 | ilog(L_MAIN, | |
907 | "Unterminated character string"); | |
908 | break; | |
909 | } | |
910 | yylval.string[j] = yylval.string[i]; | |
911 | } | |
912 | } | |
913 | yylval.string[j] = '\0'; | |
914 | return QSTRING; | |
915 | } | |
916 | } | |
917 | } | |
918 | YY_BREAK | |
919 | case 8: | |
920 | YY_RULE_SETUP | |
921 | #line 139 "ircd_lexer.l" | |
922 | { return LOADMODULE; } | |
923 | YY_BREAK | |
924 | case 9: | |
925 | YY_RULE_SETUP | |
926 | #line 140 "ircd_lexer.l" | |
927 | { | |
928 | strcpy(yylval.string, yytext); | |
929 | yylval.string[yyleng] = '\0'; | |
930 | return STRING; | |
931 | } | |
932 | YY_BREAK | |
933 | case 10: | |
934 | YY_RULE_SETUP | |
935 | #line 146 "ircd_lexer.l" | |
936 | { return TWODOTS; } | |
937 | YY_BREAK | |
938 | case 11: | |
939 | YY_RULE_SETUP | |
940 | #line 147 "ircd_lexer.l" | |
941 | { return yytext[0]; } | |
942 | YY_BREAK | |
943 | case YY_STATE_EOF(INITIAL): | |
944 | #line 148 "ircd_lexer.l" | |
945 | { if (ieof()) yyterminate(); } | |
946 | YY_BREAK | |
947 | case 12: | |
948 | YY_RULE_SETUP | |
949 | #line 149 "ircd_lexer.l" | |
950 | ECHO; | |
951 | YY_BREAK | |
952 | #line 953 "ircd_lexer.c" | |
953 | ||
954 | case YY_END_OF_BUFFER: | |
955 | { | |
956 | /* Amount of text matched not including the EOB char. */ | |
957 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; | |
958 | ||
959 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | |
960 | *yy_cp = (yy_hold_char); | |
961 | YY_RESTORE_YY_MORE_OFFSET | |
962 | ||
963 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) | |
964 | { | |
965 | /* We're scanning a new file or input source. It's | |
966 | * possible that this happened because the user | |
967 | * just pointed yyin at a new source and called | |
968 | * yylex(). If so, then we have to assure | |
969 | * consistency between YY_CURRENT_BUFFER and our | |
970 | * globals. Here is the right place to do so, because | |
971 | * this is the first action (other than possibly a | |
972 | * back-up) that will match for the new input source. | |
973 | */ | |
974 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | |
975 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; | |
976 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; | |
977 | } | |
978 | ||
979 | /* Note that here we test for yy_c_buf_p "<=" to the position | |
980 | * of the first EOB in the buffer, since yy_c_buf_p will | |
981 | * already have been incremented past the NUL character | |
982 | * (since all states make transitions on EOB to the | |
983 | * end-of-buffer state). Contrast this with the test | |
984 | * in input(). | |
985 | */ | |
986 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | |
987 | { /* This was really a NUL. */ | |
988 | yy_state_type yy_next_state; | |
989 | ||
990 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; | |
991 | ||
992 | yy_current_state = yy_get_previous_state( ); | |
993 | ||
994 | /* Okay, we're now positioned to make the NUL | |
995 | * transition. We couldn't have | |
996 | * yy_get_previous_state() go ahead and do it | |
997 | * for us because it doesn't know how to deal | |
998 | * with the possibility of jamming (and we don't | |
999 | * want to build jamming into it because then it | |
1000 | * will run more slowly). | |
1001 | */ | |
1002 | ||
1003 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | |
1004 | ||
1005 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | |
1006 | ||
1007 | if ( yy_next_state ) | |
1008 | { | |
1009 | /* Consume the NUL. */ | |
1010 | yy_cp = ++(yy_c_buf_p); | |
1011 | yy_current_state = yy_next_state; | |
1012 | goto yy_match; | |
1013 | } | |
1014 | ||
1015 | else | |
1016 | { | |
1017 | yy_cp = (yy_c_buf_p); | |
1018 | goto yy_find_action; | |
1019 | } | |
1020 | } | |
1021 | ||
1022 | else switch ( yy_get_next_buffer( ) ) | |
1023 | { | |
1024 | case EOB_ACT_END_OF_FILE: | |
1025 | { | |
1026 | (yy_did_buffer_switch_on_eof) = 0; | |
1027 | ||
1028 | if ( yywrap( ) ) | |
1029 | { | |
1030 | /* Note: because we've taken care in | |
1031 | * yy_get_next_buffer() to have set up | |
1032 | * yytext, we can now set up | |
1033 | * yy_c_buf_p so that if some total | |
1034 | * hoser (like flex itself) wants to | |
1035 | * call the scanner after we return the | |
1036 | * YY_NULL, it'll still work - another | |
1037 | * YY_NULL will get returned. | |
1038 | */ | |
1039 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; | |
1040 | ||
1041 | yy_act = YY_STATE_EOF(YY_START); | |
1042 | goto do_action; | |
1043 | } | |
1044 | ||
1045 | else | |
1046 | { | |
1047 | if ( ! (yy_did_buffer_switch_on_eof) ) | |
1048 | YY_NEW_FILE; | |
1049 | } | |
1050 | break; | |
1051 | } | |
1052 | ||
1053 | case EOB_ACT_CONTINUE_SCAN: | |
1054 | (yy_c_buf_p) = | |
1055 | (yytext_ptr) + yy_amount_of_matched_text; | |
1056 | ||
1057 | yy_current_state = yy_get_previous_state( ); | |
1058 | ||
1059 | yy_cp = (yy_c_buf_p); | |
1060 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | |
1061 | goto yy_match; | |
1062 | ||
1063 | case EOB_ACT_LAST_MATCH: | |
1064 | (yy_c_buf_p) = | |
1065 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; | |
1066 | ||
1067 | yy_current_state = yy_get_previous_state( ); | |
1068 | ||
1069 | yy_cp = (yy_c_buf_p); | |
1070 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | |
1071 | goto yy_find_action; | |
1072 | } | |
1073 | break; | |
1074 | } | |
1075 | ||
1076 | default: | |
1077 | YY_FATAL_ERROR( | |
1078 | "fatal flex scanner internal error--no action found" ); | |
1079 | } /* end of action switch */ | |
1080 | } /* end of scanning one token */ | |
1081 | } /* end of yylex */ | |
1082 | ||
1083 | /* yy_get_next_buffer - try to read in a new buffer | |
1084 | * | |
1085 | * Returns a code representing an action: | |
1086 | * EOB_ACT_LAST_MATCH - | |
1087 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | |
1088 | * EOB_ACT_END_OF_FILE - end of file | |
1089 | */ | |
1090 | static int yy_get_next_buffer (void) | |
1091 | { | |
1092 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | |
1093 | register char *source = (yytext_ptr); | |
1094 | register int number_to_move, i; | |
1095 | int ret_val; | |
1096 | ||
1097 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | |
1098 | YY_FATAL_ERROR( | |
1099 | "fatal flex scanner internal error--end of buffer missed" ); | |
1100 | ||
1101 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | |
1102 | { /* Don't try to fill the buffer, so this is an EOF. */ | |
1103 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | |
1104 | { | |
1105 | /* We matched a single character, the EOB, so | |
1106 | * treat this as a final EOF. | |
1107 | */ | |
1108 | return EOB_ACT_END_OF_FILE; | |
1109 | } | |
1110 | ||
1111 | else | |
1112 | { | |
1113 | /* We matched some text prior to the EOB, first | |
1114 | * process it. | |
1115 | */ | |
1116 | return EOB_ACT_LAST_MATCH; | |
1117 | } | |
1118 | } | |
1119 | ||
1120 | /* Try to read more data. */ | |
1121 | ||
1122 | /* First move last chars to start of buffer. */ | |
1123 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | |
1124 | ||
1125 | for ( i = 0; i < number_to_move; ++i ) | |
1126 | *(dest++) = *(source++); | |
1127 | ||
1128 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | |
1129 | /* don't do the read, it's not guaranteed to return an EOF, | |
1130 | * just force an EOF | |
1131 | */ | |
1132 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | |
1133 | ||
1134 | else | |
1135 | { | |
1136 | yy_size_t num_to_read = | |
1137 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | |
1138 | ||
1139 | while ( num_to_read <= 0 ) | |
1140 | { /* Not enough room in the buffer - grow it. */ | |
1141 | ||
1142 | /* just a shorter name for the current buffer */ | |
1143 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; | |
1144 | ||
1145 | int yy_c_buf_p_offset = | |
1146 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | |
1147 | ||
1148 | if ( b->yy_is_our_buffer ) | |
1149 | { | |
1150 | yy_size_t new_size = b->yy_buf_size * 2; | |
1151 | ||
1152 | if ( new_size <= 0 ) | |
1153 | b->yy_buf_size += b->yy_buf_size / 8; | |
1154 | else | |
1155 | b->yy_buf_size *= 2; | |
1156 | ||
1157 | b->yy_ch_buf = (char *) | |
1158 | /* Include room in for 2 EOB chars. */ | |
1159 | yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | |
1160 | } | |
1161 | else | |
1162 | /* Can't grow it, we don't own it. */ | |
1163 | b->yy_ch_buf = 0; | |
1164 | ||
1165 | if ( ! b->yy_ch_buf ) | |
1166 | YY_FATAL_ERROR( | |
1167 | "fatal error - scanner input buffer overflow" ); | |
1168 | ||
1169 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | |
1170 | ||
1171 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | |
1172 | number_to_move - 1; | |
1173 | ||
1174 | } | |
1175 | ||
1176 | if ( num_to_read > YY_READ_BUF_SIZE ) | |
1177 | num_to_read = YY_READ_BUF_SIZE; | |
1178 | ||
1179 | /* Read in more data. */ | |
1180 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | |
1181 | (yy_n_chars), num_to_read ); | |
1182 | ||
1183 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | |
1184 | } | |
1185 | ||
1186 | if ( (yy_n_chars) == 0 ) | |
1187 | { | |
1188 | if ( number_to_move == YY_MORE_ADJ ) | |
1189 | { | |
1190 | ret_val = EOB_ACT_END_OF_FILE; | |
1191 | yyrestart(yyin ); | |
1192 | } | |
1193 | ||
1194 | else | |
1195 | { | |
1196 | ret_val = EOB_ACT_LAST_MATCH; | |
1197 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = | |
1198 | YY_BUFFER_EOF_PENDING; | |
1199 | } | |
1200 | } | |
1201 | ||
1202 | else | |
1203 | ret_val = EOB_ACT_CONTINUE_SCAN; | |
1204 | ||
1205 | if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { | |
1206 | /* Extend the array by 50%, plus the number we really need. */ | |
1207 | yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); | |
1208 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); | |
1209 | if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | |
1210 | YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); | |
1211 | } | |
1212 | ||
1213 | (yy_n_chars) += number_to_move; | |
1214 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | |
1215 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | |
1216 | ||
1217 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | |
1218 | ||
1219 | return ret_val; | |
1220 | } | |
1221 | ||
1222 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | |
1223 | ||
1224 | static yy_state_type yy_get_previous_state (void) | |
1225 | { | |
1226 | register yy_state_type yy_current_state; | |
1227 | register char *yy_cp; | |
1228 | ||
1229 | yy_current_state = (yy_start); | |
1230 | ||
1231 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) | |
1232 | { | |
1233 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); | |
1234 | if ( yy_accept[yy_current_state] ) | |
1235 | { | |
1236 | (yy_last_accepting_state) = yy_current_state; | |
1237 | (yy_last_accepting_cpos) = yy_cp; | |
1238 | } | |
1239 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |
1240 | { | |
1241 | yy_current_state = (int) yy_def[yy_current_state]; | |
1242 | if ( yy_current_state >= 47 ) | |
1243 | yy_c = yy_meta[(unsigned int) yy_c]; | |
1244 | } | |
1245 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |
1246 | } | |
1247 | ||
1248 | return yy_current_state; | |
1249 | } | |
1250 | ||
1251 | /* yy_try_NUL_trans - try to make a transition on the NUL character | |
1252 | * | |
1253 | * synopsis | |
1254 | * next_state = yy_try_NUL_trans( current_state ); | |
1255 | */ | |
1256 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | |
1257 | { | |
1258 | register int yy_is_jam; | |
1259 | register char *yy_cp = (yy_c_buf_p); | |
1260 | ||
1261 | register YY_CHAR yy_c = 1; | |
1262 | if ( yy_accept[yy_current_state] ) | |
1263 | { | |
1264 | (yy_last_accepting_state) = yy_current_state; | |
1265 | (yy_last_accepting_cpos) = yy_cp; | |
1266 | } | |
1267 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) | |
1268 | { | |
1269 | yy_current_state = (int) yy_def[yy_current_state]; | |
1270 | if ( yy_current_state >= 47 ) | |
1271 | yy_c = yy_meta[(unsigned int) yy_c]; | |
1272 | } | |
1273 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; | |
1274 | yy_is_jam = (yy_current_state == 46); | |
1275 | ||
1276 | return yy_is_jam ? 0 : yy_current_state; | |
1277 | } | |
1278 | ||
1279 | #ifndef YY_NO_INPUT | |
1280 | #ifdef __cplusplus | |
1281 | static int yyinput (void) | |
1282 | #else | |
1283 | static int input (void) | |
1284 | #endif | |
1285 | ||
1286 | { | |
1287 | int c; | |
1288 | ||
1289 | *(yy_c_buf_p) = (yy_hold_char); | |
1290 | ||
1291 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) | |
1292 | { | |
1293 | /* yy_c_buf_p now points to the character we want to return. | |
1294 | * If this occurs *before* the EOB characters, then it's a | |
1295 | * valid NUL; if not, then we've hit the end of the buffer. | |
1296 | */ | |
1297 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | |
1298 | /* This was really a NUL. */ | |
1299 | *(yy_c_buf_p) = '\0'; | |
1300 | ||
1301 | else | |
1302 | { /* need more input */ | |
1303 | yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); | |
1304 | ++(yy_c_buf_p); | |
1305 | ||
1306 | switch ( yy_get_next_buffer( ) ) | |
1307 | { | |
1308 | case EOB_ACT_LAST_MATCH: | |
1309 | /* This happens because yy_g_n_b() | |
1310 | * sees that we've accumulated a | |
1311 | * token and flags that we need to | |
1312 | * try matching the token before | |
1313 | * proceeding. But for input(), | |
1314 | * there's no matching to consider. | |
1315 | * So convert the EOB_ACT_LAST_MATCH | |
1316 | * to EOB_ACT_END_OF_FILE. | |
1317 | */ | |
1318 | ||
1319 | /* Reset buffer status. */ | |
1320 | yyrestart(yyin ); | |
1321 | ||
1322 | /*FALLTHROUGH*/ | |
1323 | ||
1324 | case EOB_ACT_END_OF_FILE: | |
1325 | { | |
1326 | if ( yywrap( ) ) | |
1327 | return 0; | |
1328 | ||
1329 | if ( ! (yy_did_buffer_switch_on_eof) ) | |
1330 | YY_NEW_FILE; | |
1331 | #ifdef __cplusplus | |
1332 | return yyinput(); | |
1333 | #else | |
1334 | return input(); | |
1335 | #endif | |
1336 | } | |
1337 | ||
1338 | case EOB_ACT_CONTINUE_SCAN: | |
1339 | (yy_c_buf_p) = (yytext_ptr) + offset; | |
1340 | break; | |
1341 | } | |
1342 | } | |
1343 | } | |
1344 | ||
1345 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ | |
1346 | *(yy_c_buf_p) = '\0'; /* preserve yytext */ | |
1347 | (yy_hold_char) = *++(yy_c_buf_p); | |
1348 | ||
1349 | return c; | |
1350 | } | |
1351 | #endif /* ifndef YY_NO_INPUT */ | |
1352 | ||
1353 | /** Immediately switch to a different input stream. | |
1354 | * @param input_file A readable stream. | |
1355 | * | |
1356 | * @note This function does not reset the start condition to @c INITIAL . | |
1357 | */ | |
1358 | void yyrestart (FILE * input_file ) | |
1359 | { | |
1360 | ||
1361 | if ( ! YY_CURRENT_BUFFER ){ | |
1362 | yyensure_buffer_stack (); | |
1363 | YY_CURRENT_BUFFER_LVALUE = | |
1364 | yy_create_buffer(yyin,YY_BUF_SIZE ); | |
1365 | } | |
1366 | ||
1367 | yy_init_buffer(YY_CURRENT_BUFFER,input_file ); | |
1368 | yy_load_buffer_state( ); | |
1369 | } | |
1370 | ||
1371 | /** Switch to a different input buffer. | |
1372 | * @param new_buffer The new input buffer. | |
1373 | * | |
1374 | */ | |
1375 | void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) | |
1376 | { | |
1377 | ||
1378 | /* TODO. We should be able to replace this entire function body | |
1379 | * with | |
1380 | * yypop_buffer_state(); | |
1381 | * yypush_buffer_state(new_buffer); | |
1382 | */ | |
1383 | yyensure_buffer_stack (); | |
1384 | if ( YY_CURRENT_BUFFER == new_buffer ) | |
1385 | return; | |
1386 | ||
1387 | if ( YY_CURRENT_BUFFER ) | |
1388 | { | |
1389 | /* Flush out information for old buffer. */ | |
1390 | *(yy_c_buf_p) = (yy_hold_char); | |
1391 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | |
1392 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | |
1393 | } | |
1394 | ||
1395 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | |
1396 | yy_load_buffer_state( ); | |
1397 | ||
1398 | /* We don't actually know whether we did this switch during | |
1399 | * EOF (yywrap()) processing, but the only time this flag | |
1400 | * is looked at is after yywrap() is called, so it's safe | |
1401 | * to go ahead and always set it. | |
1402 | */ | |
1403 | (yy_did_buffer_switch_on_eof) = 1; | |
1404 | } | |
1405 | ||
1406 | static void yy_load_buffer_state (void) | |
1407 | { | |
1408 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | |
1409 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | |
1410 | yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | |
1411 | (yy_hold_char) = *(yy_c_buf_p); | |
1412 | } | |
1413 | ||
1414 | /** Allocate and initialize an input buffer state. | |
1415 | * @param file A readable stream. | |
1416 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | |
1417 | * | |
1418 | * @return the allocated buffer state. | |
1419 | */ | |
1420 | YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) | |
1421 | { | |
1422 | YY_BUFFER_STATE b; | |
1423 | ||
1424 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); | |
1425 | if ( ! b ) | |
1426 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | |
1427 | ||
1428 | b->yy_buf_size = size; | |
1429 | ||
1430 | /* yy_ch_buf has to be 2 characters longer than the size given because | |
1431 | * we need to put in 2 end-of-buffer characters. | |
1432 | */ | |
1433 | b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); | |
1434 | if ( ! b->yy_ch_buf ) | |
1435 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | |
1436 | ||
1437 | b->yy_is_our_buffer = 1; | |
1438 | ||
1439 | yy_init_buffer(b,file ); | |
1440 | ||
1441 | return b; | |
1442 | } | |
1443 | ||
1444 | /** Destroy the buffer. | |
1445 | * @param b a buffer created with yy_create_buffer() | |
1446 | * | |
1447 | */ | |
1448 | void yy_delete_buffer (YY_BUFFER_STATE b ) | |
1449 | { | |
1450 | ||
1451 | if ( ! b ) | |
1452 | return; | |
1453 | ||
1454 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ | |
1455 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; | |
1456 | ||
1457 | if ( b->yy_is_our_buffer ) | |
1458 | yyfree((void *) b->yy_ch_buf ); | |
1459 | ||
1460 | yyfree((void *) b ); | |
1461 | } | |
1462 | ||
1463 | #ifndef __cplusplus | |
1464 | extern int isatty (int ); | |
1465 | #endif /* __cplusplus */ | |
1466 | ||
1467 | /* Initializes or reinitializes a buffer. | |
1468 | * This function is sometimes called more than once on the same buffer, | |
1469 | * such as during a yyrestart() or at EOF. | |
1470 | */ | |
1471 | static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) | |
1472 | ||
1473 | { | |
1474 | int oerrno = errno; | |
1475 | ||
1476 | yy_flush_buffer(b ); | |
1477 | ||
1478 | b->yy_input_file = file; | |
1479 | b->yy_fill_buffer = 1; | |
1480 | ||
1481 | /* If b is the current buffer, then yy_init_buffer was _probably_ | |
1482 | * called from yyrestart() or through yy_get_next_buffer. | |
1483 | * In that case, we don't want to reset the lineno or column. | |
1484 | */ | |
1485 | if (b != YY_CURRENT_BUFFER){ | |
1486 | b->yy_bs_lineno = 1; | |
1487 | b->yy_bs_column = 0; | |
1488 | } | |
1489 | ||
1490 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | |
1491 | ||
1492 | errno = oerrno; | |
1493 | } | |
1494 | ||
1495 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | |
1496 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | |
1497 | * | |
1498 | */ | |
1499 | void yy_flush_buffer (YY_BUFFER_STATE b ) | |
1500 | { | |
1501 | if ( ! b ) | |
1502 | return; | |
1503 | ||
1504 | b->yy_n_chars = 0; | |
1505 | ||
1506 | /* We always need two end-of-buffer characters. The first causes | |
1507 | * a transition to the end-of-buffer state. The second causes | |
1508 | * a jam in that state. | |
1509 | */ | |
1510 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | |
1511 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | |
1512 | ||
1513 | b->yy_buf_pos = &b->yy_ch_buf[0]; | |
1514 | ||
1515 | b->yy_at_bol = 1; | |
1516 | b->yy_buffer_status = YY_BUFFER_NEW; | |
1517 | ||
1518 | if ( b == YY_CURRENT_BUFFER ) | |
1519 | yy_load_buffer_state( ); | |
1520 | } | |
1521 | ||
1522 | /** Pushes the new state onto the stack. The new state becomes | |
1523 | * the current state. This function will allocate the stack | |
1524 | * if necessary. | |
1525 | * @param new_buffer The new state. | |
1526 | * | |
1527 | */ | |
1528 | void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) | |
1529 | { | |
1530 | if (new_buffer == NULL) | |
1531 | return; | |
1532 | ||
1533 | yyensure_buffer_stack(); | |
1534 | ||
1535 | /* This block is copied from yy_switch_to_buffer. */ | |
1536 | if ( YY_CURRENT_BUFFER ) | |
1537 | { | |
1538 | /* Flush out information for old buffer. */ | |
1539 | *(yy_c_buf_p) = (yy_hold_char); | |
1540 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | |
1541 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | |
1542 | } | |
1543 | ||
1544 | /* Only push if top exists. Otherwise, replace top. */ | |
1545 | if (YY_CURRENT_BUFFER) | |
1546 | (yy_buffer_stack_top)++; | |
1547 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | |
1548 | ||
1549 | /* copied from yy_switch_to_buffer. */ | |
1550 | yy_load_buffer_state( ); | |
1551 | (yy_did_buffer_switch_on_eof) = 1; | |
1552 | } | |
1553 | ||
1554 | /** Removes and deletes the top of the stack, if present. | |
1555 | * The next element becomes the new top. | |
1556 | * | |
1557 | */ | |
1558 | void yypop_buffer_state (void) | |
1559 | { | |
1560 | if (!YY_CURRENT_BUFFER) | |
1561 | return; | |
1562 | ||
1563 | yy_delete_buffer(YY_CURRENT_BUFFER ); | |
1564 | YY_CURRENT_BUFFER_LVALUE = NULL; | |
1565 | if ((yy_buffer_stack_top) > 0) | |
1566 | --(yy_buffer_stack_top); | |
1567 | ||
1568 | if (YY_CURRENT_BUFFER) { | |
1569 | yy_load_buffer_state( ); | |
1570 | (yy_did_buffer_switch_on_eof) = 1; | |
1571 | } | |
1572 | } | |
1573 | ||
1574 | /* Allocates the stack if it does not exist. | |
1575 | * Guarantees space for at least one push. | |
1576 | */ | |
1577 | static void yyensure_buffer_stack (void) | |
1578 | { | |
1579 | yy_size_t num_to_alloc; | |
1580 | ||
1581 | if (!(yy_buffer_stack)) { | |
1582 | ||
1583 | /* First allocation is just for 2 elements, since we don't know if this | |
1584 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | |
1585 | * immediate realloc on the next call. | |
1586 | */ | |
1587 | num_to_alloc = 1; | |
1588 | (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc | |
1589 | (num_to_alloc * sizeof(struct yy_buffer_state*) | |
1590 | ); | |
1591 | if ( ! (yy_buffer_stack) ) | |
1592 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); | |
1593 | ||
1594 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | |
1595 | ||
1596 | (yy_buffer_stack_max) = num_to_alloc; | |
1597 | (yy_buffer_stack_top) = 0; | |
1598 | return; | |
1599 | } | |
1600 | ||
1601 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ | |
1602 | ||
1603 | /* Increase the buffer to prepare for a possible push. */ | |
1604 | int grow_size = 8 /* arbitrary grow size */; | |
1605 | ||
1606 | num_to_alloc = (yy_buffer_stack_max) + grow_size; | |
1607 | (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc | |
1608 | ((yy_buffer_stack), | |
1609 | num_to_alloc * sizeof(struct yy_buffer_state*) | |
1610 | ); | |
1611 | if ( ! (yy_buffer_stack) ) | |
1612 | YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); | |
1613 | ||
1614 | /* zero only the new slots.*/ | |
1615 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | |
1616 | (yy_buffer_stack_max) = num_to_alloc; | |
1617 | } | |
1618 | } | |
1619 | ||
1620 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | |
1621 | * @param base the character buffer | |
1622 | * @param size the size in bytes of the character buffer | |
1623 | * | |
1624 | * @return the newly allocated buffer state object. | |
1625 | */ | |
1626 | YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) | |
1627 | { | |
1628 | YY_BUFFER_STATE b; | |
1629 | ||
1630 | if ( size < 2 || | |
1631 | base[size-2] != YY_END_OF_BUFFER_CHAR || | |
1632 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | |
1633 | /* They forgot to leave room for the EOB's. */ | |
1634 | return 0; | |
1635 | ||
1636 | b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); | |
1637 | if ( ! b ) | |
1638 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); | |
1639 | ||
1640 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | |
1641 | b->yy_buf_pos = b->yy_ch_buf = base; | |
1642 | b->yy_is_our_buffer = 0; | |
1643 | b->yy_input_file = 0; | |
1644 | b->yy_n_chars = b->yy_buf_size; | |
1645 | b->yy_is_interactive = 0; | |
1646 | b->yy_at_bol = 1; | |
1647 | b->yy_fill_buffer = 0; | |
1648 | b->yy_buffer_status = YY_BUFFER_NEW; | |
1649 | ||
1650 | yy_switch_to_buffer(b ); | |
1651 | ||
1652 | return b; | |
1653 | } | |
1654 | ||
1655 | /** Setup the input buffer state to scan a string. The next call to yylex() will | |
1656 | * scan from a @e copy of @a str. | |
1657 | * @param yystr a NUL-terminated string to scan | |
1658 | * | |
1659 | * @return the newly allocated buffer state object. | |
1660 | * @note If you want to scan bytes that may contain NUL values, then use | |
1661 | * yy_scan_bytes() instead. | |
1662 | */ | |
1663 | YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | |
1664 | { | |
1665 | ||
1666 | return yy_scan_bytes(yystr,strlen(yystr) ); | |
1667 | } | |
1668 | ||
1669 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will | |
1670 | * scan from a @e copy of @a bytes. | |
1671 | * @param bytes the byte buffer to scan | |
1672 | * @param len the number of bytes in the buffer pointed to by @a bytes. | |
1673 | * | |
1674 | * @return the newly allocated buffer state object. | |
1675 | */ | |
1676 | YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) | |
1677 | { | |
1678 | YY_BUFFER_STATE b; | |
1679 | char *buf; | |
1680 | yy_size_t n, i; | |
1681 | ||
1682 | /* Get memory for full buffer, including space for trailing EOB's. */ | |
1683 | n = _yybytes_len + 2; | |
1684 | buf = (char *) yyalloc(n ); | |
1685 | if ( ! buf ) | |
1686 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); | |
1687 | ||
1688 | for ( i = 0; i < _yybytes_len; ++i ) | |
1689 | buf[i] = yybytes[i]; | |
1690 | ||
1691 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; | |
1692 | ||
1693 | b = yy_scan_buffer(buf,n ); | |
1694 | if ( ! b ) | |
1695 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); | |
1696 | ||
1697 | /* It's okay to grow etc. this buffer, and we should throw it | |
1698 | * away when we're done. | |
1699 | */ | |
1700 | b->yy_is_our_buffer = 1; | |
1701 | ||
1702 | return b; | |
1703 | } | |
1704 | ||
1705 | #ifndef YY_EXIT_FAILURE | |
1706 | #define YY_EXIT_FAILURE 2 | |
1707 | #endif | |
1708 | ||
1709 | static void yy_fatal_error (yyconst char* msg ) | |
1710 | { | |
1711 | (void) fprintf( stderr, "%s\n", msg ); | |
1712 | exit( YY_EXIT_FAILURE ); | |
1713 | } | |
1714 | ||
1715 | /* Redefine yyless() so it works in section 3 code. */ | |
1716 | ||
1717 | #undef yyless | |
1718 | #define yyless(n) \ | |
1719 | do \ | |
1720 | { \ | |
1721 | /* Undo effects of setting up yytext. */ \ | |
1722 | int yyless_macro_arg = (n); \ | |
1723 | YY_LESS_LINENO(yyless_macro_arg);\ | |
1724 | yytext[yyleng] = (yy_hold_char); \ | |
1725 | (yy_c_buf_p) = yytext + yyless_macro_arg; \ | |
1726 | (yy_hold_char) = *(yy_c_buf_p); \ | |
1727 | *(yy_c_buf_p) = '\0'; \ | |
1728 | yyleng = yyless_macro_arg; \ | |
1729 | } \ | |
1730 | while ( 0 ) | |
1731 | ||
1732 | /* Accessor methods (get/set functions) to struct members. */ | |
1733 | ||
1734 | /** Get the current line number. | |
1735 | * | |
1736 | */ | |
1737 | int yyget_lineno (void) | |
1738 | { | |
1739 | ||
1740 | return yylineno; | |
1741 | } | |
1742 | ||
1743 | /** Get the input stream. | |
1744 | * | |
1745 | */ | |
1746 | FILE *yyget_in (void) | |
1747 | { | |
1748 | return yyin; | |
1749 | } | |
1750 | ||
1751 | /** Get the output stream. | |
1752 | * | |
1753 | */ | |
1754 | FILE *yyget_out (void) | |
1755 | { | |
1756 | return yyout; | |
1757 | } | |
1758 | ||
1759 | /** Get the length of the current token. | |
1760 | * | |
1761 | */ | |
1762 | yy_size_t yyget_leng (void) | |
1763 | { | |
1764 | return yyleng; | |
1765 | } | |
1766 | ||
1767 | /** Get the current token. | |
1768 | * | |
1769 | */ | |
1770 | ||
1771 | char *yyget_text (void) | |
1772 | { | |
1773 | return yytext; | |
1774 | } | |
1775 | ||
1776 | /** Set the current line number. | |
1777 | * @param line_number | |
1778 | * | |
1779 | */ | |
1780 | void yyset_lineno (int line_number ) | |
1781 | { | |
1782 | ||
1783 | yylineno = line_number; | |
1784 | } | |
1785 | ||
1786 | /** Set the input stream. This does not discard the current | |
1787 | * input buffer. | |
1788 | * @param in_str A readable stream. | |
1789 | * | |
1790 | * @see yy_switch_to_buffer | |
1791 | */ | |
1792 | void yyset_in (FILE * in_str ) | |
1793 | { | |
1794 | yyin = in_str ; | |
1795 | } | |
1796 | ||
1797 | void yyset_out (FILE * out_str ) | |
1798 | { | |
1799 | yyout = out_str ; | |
1800 | } | |
1801 | ||
1802 | int yyget_debug (void) | |
1803 | { | |
1804 | return yy_flex_debug; | |
1805 | } | |
1806 | ||
1807 | void yyset_debug (int bdebug ) | |
1808 | { | |
1809 | yy_flex_debug = bdebug ; | |
1810 | } | |
1811 | ||
1812 | static int yy_init_globals (void) | |
1813 | { | |
1814 | /* Initialization is the same as for the non-reentrant scanner. | |
1815 | * This function is called from yylex_destroy(), so don't allocate here. | |
1816 | */ | |
1817 | ||
1818 | (yy_buffer_stack) = 0; | |
1819 | (yy_buffer_stack_top) = 0; | |
1820 | (yy_buffer_stack_max) = 0; | |
1821 | (yy_c_buf_p) = (char *) 0; | |
1822 | (yy_init) = 0; | |
1823 | (yy_start) = 0; | |
1824 | ||
1825 | /* Defined in main.c */ | |
1826 | #ifdef YY_STDINIT | |
1827 | yyin = stdin; | |
1828 | yyout = stdout; | |
1829 | #else | |
1830 | yyin = (FILE *) 0; | |
1831 | yyout = (FILE *) 0; | |
1832 | #endif | |
1833 | ||
1834 | /* For future reference: Set errno on error, since we are called by | |
1835 | * yylex_init() | |
1836 | */ | |
1837 | return 0; | |
1838 | } | |
1839 | ||
1840 | /* yylex_destroy is for both reentrant and non-reentrant scanners. */ | |
1841 | int yylex_destroy (void) | |
1842 | { | |
1843 | ||
1844 | /* Pop the buffer stack, destroying each element. */ | |
1845 | while(YY_CURRENT_BUFFER){ | |
1846 | yy_delete_buffer(YY_CURRENT_BUFFER ); | |
1847 | YY_CURRENT_BUFFER_LVALUE = NULL; | |
1848 | yypop_buffer_state(); | |
1849 | } | |
1850 | ||
1851 | /* Destroy the stack itself. */ | |
1852 | yyfree((yy_buffer_stack) ); | |
1853 | (yy_buffer_stack) = NULL; | |
1854 | ||
1855 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | |
1856 | * yylex() is called, initialization will occur. */ | |
1857 | yy_init_globals( ); | |
1858 | ||
1859 | return 0; | |
1860 | } | |
1861 | ||
1862 | /* | |
1863 | * Internal utility routines. | |
1864 | */ | |
1865 | ||
1866 | #ifndef yytext_ptr | |
1867 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | |
1868 | { | |
1869 | register int i; | |
1870 | for ( i = 0; i < n; ++i ) | |
1871 | s1[i] = s2[i]; | |
1872 | } | |
1873 | #endif | |
1874 | ||
1875 | #ifdef YY_NEED_STRLEN | |
1876 | static int yy_flex_strlen (yyconst char * s ) | |
1877 | { | |
1878 | register int n; | |
1879 | for ( n = 0; s[n]; ++n ) | |
1880 | ; | |
1881 | ||
1882 | return n; | |
1883 | } | |
1884 | #endif | |
1885 | ||
1886 | void *yyalloc (yy_size_t size ) | |
1887 | { | |
1888 | return (void *) malloc( size ); | |
1889 | } | |
1890 | ||
1891 | void *yyrealloc (void * ptr, yy_size_t size ) | |
1892 | { | |
1893 | /* The cast to (char *) in the following accommodates both | |
1894 | * implementations that use char* generic pointers, and those | |
1895 | * that use void* generic pointers. It works with the latter | |
1896 | * because both ANSI C and C++ allow castless assignment from | |
1897 | * any pointer type to void*, and deal with argument conversions | |
1898 | * as though doing an assignment. | |
1899 | */ | |
1900 | return (void *) realloc( (char *) ptr, size ); | |
1901 | } | |
1902 | ||
1903 | void yyfree (void * ptr ) | |
1904 | { | |
1905 | free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ | |
1906 | } | |
1907 | ||
1908 | #define YYTABLES_NAME "yytables" | |
1909 | ||
1910 | #line 149 "ircd_lexer.l" | |
1911 | ||
1912 | ||
1913 | ||
1914 | /* C-comment ignoring routine -kre*/ | |
1915 | void ccomment() | |
1916 | { | |
1917 | int c; | |
1918 | ||
1919 | /* log(L_NOTICE, "got comment"); */ | |
1920 | while (1) | |
1921 | { | |
1922 | while ((c = input()) != '*' && c != EOF) | |
1923 | if (c == '\n') ++lineno; | |
1924 | if (c == '*') | |
1925 | { | |
1926 | while ((c = input()) == '*'); | |
1927 | if (c == '/') | |
1928 | break; | |
1929 | if (c == '\n') ++lineno; | |
1930 | } | |
1931 | if (c == EOF) | |
1932 | { | |
1933 | YY_FATAL_ERROR("EOF in comment"); | |
1934 | /* XXX hack alert this disables | |
1935 | * the stupid unused function warning | |
1936 | * gcc generates | |
1937 | */ | |
1938 | yy_fatal_error("EOF in comment"); | |
1939 | break; | |
1940 | } | |
1941 | } | |
1942 | } | |
1943 | ||
1944 | void cinclude(void) | |
1945 | { | |
1946 | char *c; | |
1947 | if ((c = strchr(yytext, '<')) == NULL) | |
1948 | *strchr(c = strchr(yytext, '"') + 1, '"') = 0; | |
1949 | else | |
1950 | *strchr(++c, '>') = 0; | |
1951 | ||
1952 | /* do stacking and co. */ | |
1953 | if (include_stack_ptr >= MAX_INCLUDE_DEPTH) | |
1954 | conf_report_error("Includes nested too deep (max is %d)", MAX_INCLUDE_DEPTH); | |
1955 | else | |
1956 | { | |
1957 | FILE *tmp_fbfile_in; | |
1958 | ||
1959 | tmp_fbfile_in = fopen(c, "r"); | |
1960 | ||
1961 | if (tmp_fbfile_in == NULL) | |
1962 | { | |
1963 | /* if its not found in PREFIX, look in ETCPATH */ | |
1964 | char fnamebuf[IRCD_BUFSIZE]; | |
1965 | ||
1966 | snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ETCPATH, c); | |
1967 | tmp_fbfile_in = fopen(fnamebuf, "r"); | |
1968 | ||
1969 | /* wasnt found there either.. error. */ | |
1970 | if(tmp_fbfile_in == NULL) | |
1971 | { | |
1972 | conf_report_error("Include %s: %s.", c, strerror(errno)); | |
1973 | return; | |
1974 | } | |
1975 | } | |
1976 | lineno_stack[include_stack_ptr] = lineno; | |
1977 | lineno = 1; | |
1978 | inc_fbfile_in[include_stack_ptr] = conf_fbfile_in; | |
1979 | strcpy(conffile_stack[include_stack_ptr], c); | |
1980 | current_file = conffile_stack[include_stack_ptr]; | |
1981 | include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; | |
1982 | conf_fbfile_in = tmp_fbfile_in; | |
1983 | yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE)); | |
1984 | } | |
1985 | } | |
1986 | ||
1987 | int ieof(void) | |
1988 | { | |
1989 | if (include_stack_ptr) | |
1990 | fclose(conf_fbfile_in); | |
1991 | if (--include_stack_ptr < 0) | |
1992 | { | |
1993 | /* We will now exit the lexer - restore init values if we get /rehash | |
1994 | * later and reenter lexer -kre */ | |
1995 | include_stack_ptr = 0; | |
1996 | lineno = 1; | |
1997 | return 1; | |
1998 | } | |
1999 | /* switch buffer */ | |
2000 | yy_delete_buffer(YY_CURRENT_BUFFER); | |
2001 | lineno = lineno_stack[include_stack_ptr]; | |
2002 | conf_fbfile_in = inc_fbfile_in[include_stack_ptr]; | |
2003 | ||
2004 | if(include_stack_ptr) | |
2005 | current_file = conffile_stack[include_stack_ptr]; | |
2006 | else | |
2007 | current_file = conffilebuf; | |
2008 | ||
2009 | yy_switch_to_buffer(include_stack[include_stack_ptr]); | |
2010 | return 0; | |
2011 | } | |
2012 | ||
2013 | /* #-comment style, look for #include */ | |
2014 | #define INCLUDE "#include" | |
2015 | ||
2016 | void hashcomment(void) | |
2017 | { | |
2018 | if (strlen(yytext) < sizeof(INCLUDE) - 1) | |
2019 | return; | |
2020 | ||
2021 | if (!strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1)) | |
2022 | yyerror("You probably meant '.include', skipping"); | |
2023 | } | |
2024 |