Initial import
[ratbox-ambernet.git] / src / lex.yy.c
blobf9b63c0d140c364fb5838da8b8c37c4596ea6045
2 #line 3 "lex.yy.c"
4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 31
12 #if YY_FLEX_SUBMINOR_VERSION > 0
13 #define FLEX_BETA
14 #endif
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
19 #include <stdio.h>
20 #include <string.h>
21 #include <errno.h>
22 #include <stdlib.h>
24 /* end standard C headers. */
26 /* flex integer type definitions */
28 #ifndef FLEXINT_H
29 #define FLEXINT_H
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
34 #include <inttypes.h>
35 typedef int8_t flex_int8_t;
36 typedef uint8_t flex_uint8_t;
37 typedef int16_t flex_int16_t;
38 typedef uint16_t flex_uint16_t;
39 typedef int32_t flex_int32_t;
40 typedef uint32_t flex_uint32_t;
41 #else
42 typedef signed char flex_int8_t;
43 typedef short int flex_int16_t;
44 typedef int flex_int32_t;
45 typedef unsigned char flex_uint8_t;
46 typedef unsigned short int flex_uint16_t;
47 typedef unsigned int flex_uint32_t;
48 #endif /* ! C99 */
50 /* Limits of integral types. */
51 #ifndef INT8_MIN
52 #define INT8_MIN (-128)
53 #endif
54 #ifndef INT16_MIN
55 #define INT16_MIN (-32767-1)
56 #endif
57 #ifndef INT32_MIN
58 #define INT32_MIN (-2147483647-1)
59 #endif
60 #ifndef INT8_MAX
61 #define INT8_MAX (127)
62 #endif
63 #ifndef INT16_MAX
64 #define INT16_MAX (32767)
65 #endif
66 #ifndef INT32_MAX
67 #define INT32_MAX (2147483647)
68 #endif
69 #ifndef UINT8_MAX
70 #define UINT8_MAX (255U)
71 #endif
72 #ifndef UINT16_MAX
73 #define UINT16_MAX (65535U)
74 #endif
75 #ifndef UINT32_MAX
76 #define UINT32_MAX (4294967295U)
77 #endif
79 #endif /* ! FLEXINT_H */
81 #ifdef __cplusplus
83 /* The "const" storage-class-modifier is valid. */
84 #define YY_USE_CONST
86 #else /* ! __cplusplus */
88 #if __STDC__
90 #define YY_USE_CONST
92 #endif /* __STDC__ */
93 #endif /* ! __cplusplus */
95 #ifdef YY_USE_CONST
96 #define yyconst const
97 #else
98 #define yyconst
99 #endif
101 /* Returned upon end-of-file. */
102 #define YY_NULL 0
104 /* Promotes a possibly negative, possibly signed char to an unsigned
105 * integer for use as an array index. If the signed char is negative,
106 * we want to instead treat it as an 8-bit unsigned char, hence the
107 * double cast.
109 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
111 /* Enter a start condition. This macro really ought to take a parameter,
112 * but we do it the disgusting crufty way forced on us by the ()-less
113 * definition of BEGIN.
115 #define BEGIN (yy_start) = 1 + 2 *
117 /* Translate the current start state into a value that can be later handed
118 * to BEGIN to return to the state. The YYSTATE alias is for lex
119 * compatibility.
121 #define YY_START (((yy_start) - 1) / 2)
122 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
127 /* Special action meaning "start processing a new file". */
128 #define YY_NEW_FILE yyrestart(yyin )
130 #define YY_END_OF_BUFFER_CHAR 0
132 /* Size of default input buffer. */
133 #ifndef YY_BUF_SIZE
134 #define YY_BUF_SIZE 16384
135 #endif
137 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
138 #define YY_TYPEDEF_YY_BUFFER_STATE
139 typedef struct yy_buffer_state *YY_BUFFER_STATE;
140 #endif
142 extern int yyleng;
144 extern FILE *yyin, *yyout;
146 #define EOB_ACT_CONTINUE_SCAN 0
147 #define EOB_ACT_END_OF_FILE 1
148 #define EOB_ACT_LAST_MATCH 2
150 #define YY_LESS_LINENO(n)
152 /* Return all but the first "n" matched characters back to the input stream. */
153 #define yyless(n) \
154 do \
156 /* Undo effects of setting up yytext. */ \
157 int yyless_macro_arg = (n); \
158 YY_LESS_LINENO(yyless_macro_arg);\
159 *yy_cp = (yy_hold_char); \
160 YY_RESTORE_YY_MORE_OFFSET \
161 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
162 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
164 while ( 0 )
166 #define unput(c) yyunput( c, (yytext_ptr) )
168 /* The following is because we cannot portably get our hands on size_t
169 * (without autoconf's help, which isn't available because we want
170 * flex-generated scanners to compile on their own).
173 #ifndef YY_TYPEDEF_YY_SIZE_T
174 #define YY_TYPEDEF_YY_SIZE_T
175 typedef unsigned int yy_size_t;
176 #endif
178 #ifndef YY_STRUCT_YY_BUFFER_STATE
179 #define YY_STRUCT_YY_BUFFER_STATE
180 struct yy_buffer_state
182 FILE *yy_input_file;
184 char *yy_ch_buf; /* input buffer */
185 char *yy_buf_pos; /* current position in input buffer */
187 /* Size of input buffer in bytes, not including room for EOB
188 * characters.
190 yy_size_t yy_buf_size;
192 /* Number of characters read into yy_ch_buf, not including EOB
193 * characters.
195 int yy_n_chars;
197 /* Whether we "own" the buffer - i.e., we know we created it,
198 * and can realloc() it to grow it, and should free() it to
199 * delete it.
201 int yy_is_our_buffer;
203 /* Whether this is an "interactive" input source; if so, and
204 * if we're using stdio for input, then we want to use getc()
205 * instead of fread(), to make sure we stop fetching input after
206 * each newline.
208 int yy_is_interactive;
210 /* Whether we're considered to be at the beginning of a line.
211 * If so, '^' rules will be active on the next match, otherwise
212 * not.
214 int yy_at_bol;
216 int yy_bs_lineno; /**< The line count. */
217 int yy_bs_column; /**< The column count. */
219 /* Whether to try to fill the input buffer when we reach the
220 * end of it.
222 int yy_fill_buffer;
224 int yy_buffer_status;
226 #define YY_BUFFER_NEW 0
227 #define YY_BUFFER_NORMAL 1
228 /* When an EOF's been seen but there's still some text to process
229 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
230 * shouldn't try reading from the input source any more. We might
231 * still have a bunch of tokens to match, though, because of
232 * possible backing-up.
234 * When we actually see the EOF, we change the status to "new"
235 * (via yyrestart()), so that the user can continue scanning by
236 * just pointing yyin at a new input file.
238 #define YY_BUFFER_EOF_PENDING 2
241 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
243 /* Stack of input buffers. */
244 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
245 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
246 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
248 /* We provide macros for accessing buffer states in case in the
249 * future we want to put the buffer states in a more general
250 * "scanner state".
252 * Returns the top of the stack, or NULL.
254 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
255 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
256 : NULL)
258 /* Same as previous macro, but useful when we know that the buffer stack is not
259 * NULL or when we need an lvalue. For internal use only.
261 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
263 /* yy_hold_char holds the character lost when yytext is formed. */
264 static char yy_hold_char;
265 static int yy_n_chars; /* number of characters read into yy_ch_buf */
266 int yyleng;
268 /* Points to current character in buffer. */
269 static char *yy_c_buf_p = (char *) 0;
270 static int yy_init = 1; /* whether we need to initialize */
271 static int yy_start = 0; /* start state number */
273 /* Flag which is used to allow yywrap()'s to do buffer switches
274 * instead of setting up a fresh yyin. A bit of a hack ...
276 static int yy_did_buffer_switch_on_eof;
278 void yyrestart (FILE *input_file );
279 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
280 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
281 void yy_delete_buffer (YY_BUFFER_STATE b );
282 void yy_flush_buffer (YY_BUFFER_STATE b );
283 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
284 void yypop_buffer_state (void );
286 static void yyensure_buffer_stack (void );
287 static void yy_load_buffer_state (void );
288 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
290 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
292 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
293 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
294 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
296 void *yyalloc (yy_size_t );
297 void *yyrealloc (void *,yy_size_t );
298 void yyfree (void * );
300 #define yy_new_buffer yy_create_buffer
302 #define yy_set_interactive(is_interactive) \
304 if ( ! YY_CURRENT_BUFFER ){ \
305 yyensure_buffer_stack (); \
306 YY_CURRENT_BUFFER_LVALUE = \
307 yy_create_buffer(yyin,YY_BUF_SIZE ); \
309 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312 #define yy_set_bol(at_bol) \
314 if ( ! YY_CURRENT_BUFFER ){\
315 yyensure_buffer_stack (); \
316 YY_CURRENT_BUFFER_LVALUE = \
317 yy_create_buffer(yyin,YY_BUF_SIZE ); \
319 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
324 /* Begin user sect3 */
326 #define yywrap() 1
327 #define YY_SKIP_YYWRAP
329 typedef unsigned char YY_CHAR;
331 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
333 typedef int yy_state_type;
335 extern int yylineno;
337 int yylineno = 1;
339 extern char *yytext;
340 #define yytext_ptr yytext
342 static yy_state_type yy_get_previous_state (void );
343 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
344 static int yy_get_next_buffer (void );
345 static void yy_fatal_error (yyconst char msg[] );
347 /* Done after the current pattern has been matched and before the
348 * corresponding action - sets up yytext.
350 #define YY_DO_BEFORE_ACTION \
351 (yytext_ptr) = yy_bp; \
352 (yytext_ptr) -= (yy_more_len); \
353 yyleng = (size_t) (yy_cp - (yytext_ptr)); \
354 (yy_hold_char) = *yy_cp; \
355 *yy_cp = '\0'; \
356 (yy_c_buf_p) = yy_cp;
358 #define YY_NUM_RULES 12
359 #define YY_END_OF_BUFFER 13
360 /* This struct is not used in this scanner,
361 but its presence is necessary. */
362 struct yy_trans_info
364 flex_int32_t yy_verify;
365 flex_int32_t yy_nxt;
367 static yyconst flex_int16_t yy_accept[47] =
368 { 0,
369 4, 4, 13, 11, 4, 3, 11, 5, 11, 11,
370 6, 9, 9, 4, 3, 0, 7, 5, 10, 0,
371 2, 6, 9, 9, 0, 9, 0, 9, 0, 9,
372 0, 9, 0, 9, 0, 9, 0, 0, 0, 9,
373 0, 1, 0, 1, 8, 0
376 static yyconst flex_int32_t yy_ec[256] =
377 { 0,
378 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
379 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
382 1, 6, 1, 1, 1, 7, 8, 9, 9, 9,
383 9, 9, 9, 9, 9, 9, 9, 1, 1, 10,
384 1, 11, 1, 1, 13, 12, 14, 15, 16, 12,
385 12, 12, 17, 12, 12, 18, 19, 20, 21, 12,
386 12, 12, 12, 12, 22, 12, 12, 12, 12, 12,
387 1, 1, 1, 1, 12, 1, 13, 12, 14, 15,
389 16, 12, 12, 12, 17, 12, 12, 18, 19, 20,
390 21, 12, 12, 12, 12, 12, 22, 12, 12, 12,
391 12, 12, 1, 1, 1, 23, 1, 1, 1, 1,
392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
394 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
395 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
396 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 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
408 static yyconst flex_int32_t yy_meta[24] =
409 { 0,
410 1, 1, 2, 1, 1, 1, 1, 1, 3, 1,
411 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
412 3, 3, 1
415 static yyconst flex_int16_t yy_base[53] =
416 { 0,
417 0, 0, 74, 75, 71, 0, 21, 0, 19, 66,
418 62, 0, 49, 67, 0, 24, 75, 0, 75, 48,
419 75, 58, 0, 53, 51, 49, 45, 43, 39, 39,
420 44, 43, 41, 34, 27, 37, 28, 50, 41, 33,
421 42, 36, 24, 23, 0, 75, 38, 41, 44, 30,
422 47, 50
425 static yyconst flex_int16_t yy_def[53] =
426 { 0,
427 46, 1, 46, 46, 46, 47, 48, 49, 46, 46,
428 46, 50, 50, 46, 47, 48, 46, 49, 46, 46,
429 46, 46, 50, 50, 46, 50, 46, 50, 46, 50,
430 46, 50, 46, 50, 46, 50, 46, 51, 52, 50,
431 51, 51, 52, 52, 50, 0, 46, 46, 46, 46,
432 46, 46
435 static yyconst flex_int16_t yy_nxt[99] =
436 { 0,
437 4, 5, 6, 7, 8, 4, 9, 10, 11, 4,
438 4, 12, 12, 12, 12, 12, 12, 13, 12, 12,
439 12, 12, 12, 17, 17, 19, 17, 17, 37, 37,
440 38, 38, 23, 44, 44, 20, 39, 39, 15, 42,
441 15, 16, 16, 16, 18, 42, 18, 41, 45, 41,
442 43, 44, 43, 42, 40, 36, 35, 34, 33, 32,
443 31, 30, 29, 28, 27, 26, 22, 25, 14, 24,
444 22, 21, 14, 46, 3, 46, 46, 46, 46, 46,
445 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
446 46, 46, 46, 46, 46, 46, 46, 46
450 static yyconst flex_int16_t yy_chk[99] =
451 { 0,
452 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
454 1, 1, 1, 7, 7, 9, 16, 16, 35, 37,
455 35, 37, 50, 44, 43, 9, 35, 37, 47, 42,
456 47, 48, 48, 48, 49, 41, 49, 51, 40, 51,
457 52, 39, 52, 38, 36, 34, 33, 32, 31, 30,
458 29, 28, 27, 26, 25, 24, 22, 20, 14, 13,
459 11, 10, 5, 3, 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, 46
465 static yy_state_type yy_last_accepting_state;
466 static char *yy_last_accepting_cpos;
468 extern int yy_flex_debug;
469 int yy_flex_debug = 0;
471 /* The intent behind this definition is that it'll catch
472 * any uses of REJECT which flex missed.
474 #define REJECT reject_used_but_not_detected
475 static int yy_more_flag = 0;
476 static int yy_more_len = 0;
477 #define yymore() ((yy_more_flag) = 1)
478 #define YY_MORE_ADJ (yy_more_len)
479 #define YY_RESTORE_YY_MORE_OFFSET
480 char *yytext;
481 #line 1 "ircd_lexer.l"
482 /* src/ircd_lexer.l
484 * This program is free software; you can redistribute it and/or modify
485 * it under the terms of the GNU General Public License as published by
486 * the Free Software Foundation; either version 2 of the License, or
487 * (at your option) any later version.
489 * This program is distributed in the hope that it will be useful,
490 * but WITHOUT ANY WARRANTY; without even the implied warranty of
491 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
492 * GNU General Public License for more details.
494 * You should have received a copy of the GNU General Public License
495 * along with this program; if not, write to the Free Software
496 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
497 * USA
499 * $Id: ircd_lexer.l 18482 2005-02-16 00:13:29Z leeh $
501 #line 26 "ircd_lexer.l"
502 #include <sys/types.h>
503 #include <sys/stat.h>
505 #include <netinet/in.h>
507 #include <string.h>
508 #include <errno.h>
509 #include <limits.h>
511 #define WE_ARE_MEMORY_C
513 #include "stdinc.h"
514 #include "ircd_defs.h"
515 #include "common.h"
516 #include "config.h"
517 #include "s_log.h"
518 #include "s_conf.h"
519 #include "newconf.h"
521 #include "y.tab.h"
523 int yylex(void);
525 /* here to fixup gcc 3.3 errors */
526 int yyget_lineno(void);
527 FILE *yyget_in(void);
528 FILE *yyget_out(void);
529 int yyget_leng(void);
530 char *yyget_text(void);
531 void yyset_lineno(int line_number);
532 void yyset_in(FILE * in_str);
533 void yyset_out(FILE * out_str);
534 int yyget_debug(void);
535 void yyset_debug(int bdebug);
536 int yylex_destroy(void);
539 #define MAX_INCLUDE_DEPTH 10
541 YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH];
542 int include_stack_ptr=0;
543 int lineno = 1;
544 void ccomment(void);
545 void cinclude(void);
546 void hashcomment(void);
547 int ieof(void);
548 int lineno_stack[MAX_INCLUDE_DEPTH];
549 char conffile_stack[MAX_INCLUDE_DEPTH][IRCD_BUFSIZE];
550 char conffilebuf[IRCD_BUFSIZE+1];
551 char *current_file = conffilebuf;
553 FILE *inc_fbfile_in[MAX_INCLUDE_DEPTH];
555 char linebuf[512];
557 #undef YY_INPUT
559 #define YY_FATAL_ERROR(msg) conf_yy_fatal_error(msg)
561 #define YY_INPUT(buf,result,max_size) \
562 if (!(result = conf_fgets(buf, max_size, conf_fbfile_in))) \
563 YY_FATAL_ERROR("input in flex scanner failed");
564 #line 565 "lex.yy.c"
566 #define INITIAL 0
568 #ifndef YY_NO_UNISTD_H
569 /* Special case for "unistd.h", since it is non-ANSI. We include it way
570 * down here because we want the user's section 1 to have been scanned first.
571 * The user has a chance to override it with an option.
573 #include <unistd.h>
574 #endif
576 #ifndef YY_EXTRA_TYPE
577 #define YY_EXTRA_TYPE void *
578 #endif
580 /* Macros after this point can all be overridden by user definitions in
581 * section 1.
584 #ifndef YY_SKIP_YYWRAP
585 #ifdef __cplusplus
586 extern "C" int yywrap (void );
587 #else
588 extern int yywrap (void );
589 #endif
590 #endif
592 #ifndef yytext_ptr
593 static void yy_flex_strncpy (char *,yyconst char *,int );
594 #endif
596 #ifdef YY_NEED_STRLEN
597 static int yy_flex_strlen (yyconst char * );
598 #endif
600 #ifndef YY_NO_INPUT
602 #ifdef __cplusplus
603 static int yyinput (void );
604 #else
605 static int input (void );
606 #endif
608 #endif
610 /* Amount of stuff to slurp up with each read. */
611 #ifndef YY_READ_BUF_SIZE
612 #define YY_READ_BUF_SIZE 8192
613 #endif
615 /* Copy whatever the last rule matched to the standard output. */
616 #ifndef ECHO
617 /* This used to be an fputs(), but since the string might contain NUL's,
618 * we now use fwrite().
620 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
621 #endif
623 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
624 * is returned in "result".
626 #ifndef YY_INPUT
627 #define YY_INPUT(buf,result,max_size) \
628 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
630 int c = '*'; \
631 size_t n; \
632 for ( n = 0; n < max_size && \
633 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
634 buf[n] = (char) c; \
635 if ( c == '\n' ) \
636 buf[n++] = (char) c; \
637 if ( c == EOF && ferror( yyin ) ) \
638 YY_FATAL_ERROR( "input in flex scanner failed" ); \
639 result = n; \
641 else \
643 errno=0; \
644 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
646 if( errno != EINTR) \
648 YY_FATAL_ERROR( "input in flex scanner failed" ); \
649 break; \
651 errno=0; \
652 clearerr(yyin); \
657 #endif
659 /* No semi-colon after return; correct usage is to write "yyterminate();" -
660 * we don't want an extra ';' after the "return" because that will cause
661 * some compilers to complain about unreachable statements.
663 #ifndef yyterminate
664 #define yyterminate() return YY_NULL
665 #endif
667 /* Number of entries by which start-condition stack grows. */
668 #ifndef YY_START_STACK_INCR
669 #define YY_START_STACK_INCR 25
670 #endif
672 /* Report a fatal error. */
673 #ifndef YY_FATAL_ERROR
674 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
675 #endif
677 /* end tables serialization structures and prototypes */
679 /* Default declaration of generated scanner - a define so the user can
680 * easily add parameters.
682 #ifndef YY_DECL
683 #define YY_DECL_IS_OURS 1
685 extern int yylex (void);
687 #define YY_DECL int yylex (void)
688 #endif /* !YY_DECL */
690 /* Code executed at the beginning of each rule, after yytext and yyleng
691 * have been set up.
693 #ifndef YY_USER_ACTION
694 #define YY_USER_ACTION
695 #endif
697 /* Code executed at the end of each rule. */
698 #ifndef YY_BREAK
699 #define YY_BREAK break;
700 #endif
702 #define YY_RULE_SETUP \
703 YY_USER_ACTION
705 /** The main scanner function which does all the work.
707 YY_DECL
709 register yy_state_type yy_current_state;
710 register char *yy_cp, *yy_bp;
711 register int yy_act;
713 #line 97 "ircd_lexer.l"
715 #line 716 "lex.yy.c"
717 if ( (yy_init) )
719 (yy_init) = 0;
721 #ifdef YY_USER_INIT
722 YY_USER_INIT;
723 #endif
725 if ( ! (yy_start) )
726 (yy_start) = 1; /* first start state */
728 if ( ! yyin )
729 yyin = stdin;
731 if ( ! yyout )
732 yyout = stdout;
734 if ( ! YY_CURRENT_BUFFER ) {
735 yyensure_buffer_stack ();
736 YY_CURRENT_BUFFER_LVALUE =
737 yy_create_buffer(yyin,YY_BUF_SIZE );
740 yy_load_buffer_state( );
743 while ( 1 ) /* loops until end-of-file is reached */
745 (yy_more_len) = 0;
746 if ( (yy_more_flag) )
748 (yy_more_len) = (yy_c_buf_p) - (yytext_ptr);
749 (yy_more_flag) = 0;
751 yy_cp = (yy_c_buf_p);
753 /* Support of yytext. */
754 *yy_cp = (yy_hold_char);
756 /* yy_bp points to the position in yy_ch_buf of the start of
757 * the current run.
759 yy_bp = yy_cp;
761 yy_current_state = (yy_start);
762 yy_match:
765 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
766 if ( yy_accept[yy_current_state] )
768 (yy_last_accepting_state) = yy_current_state;
769 (yy_last_accepting_cpos) = yy_cp;
771 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
773 yy_current_state = (int) yy_def[yy_current_state];
774 if ( yy_current_state >= 47 )
775 yy_c = yy_meta[(unsigned int) yy_c];
777 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
778 ++yy_cp;
780 while ( yy_base[yy_current_state] != 75 );
782 yy_find_action:
783 yy_act = yy_accept[yy_current_state];
784 if ( yy_act == 0 )
785 { /* have to back up */
786 yy_cp = (yy_last_accepting_cpos);
787 yy_current_state = (yy_last_accepting_state);
788 yy_act = yy_accept[yy_current_state];
791 YY_DO_BEFORE_ACTION;
793 do_action: /* This label is used only to access EOF actions. */
795 switch ( yy_act )
796 { /* beginning of action switch */
797 case 0: /* must back up */
798 /* undo the effects of YY_DO_BEFORE_ACTION */
799 *yy_cp = (yy_hold_char);
800 yy_cp = (yy_last_accepting_cpos);
801 yy_current_state = (yy_last_accepting_state);
802 goto yy_find_action;
804 case 1:
805 YY_RULE_SETUP
806 #line 98 "ircd_lexer.l"
807 { cinclude(); }
808 YY_BREAK
809 case 2:
810 YY_RULE_SETUP
811 #line 99 "ircd_lexer.l"
812 { ccomment(); }
813 YY_BREAK
814 case 3:
815 /* rule 3 can match eol */
816 YY_RULE_SETUP
817 #line 100 "ircd_lexer.l"
818 { strcpy(linebuf, yytext+1); lineno++; yyless(1); }
819 YY_BREAK
820 case 4:
821 YY_RULE_SETUP
822 #line 102 "ircd_lexer.l"
824 YY_BREAK
825 case 5:
826 YY_RULE_SETUP
827 #line 103 "ircd_lexer.l"
828 { hashcomment(); }
829 YY_BREAK
830 case 6:
831 YY_RULE_SETUP
832 #line 105 "ircd_lexer.l"
833 { yylval.number = atoi(yytext); return NUMBER; }
834 YY_BREAK
835 case 7:
836 /* rule 7 can match eol */
837 YY_RULE_SETUP
838 #line 107 "ircd_lexer.l"
840 if(yytext[yyleng-2] == '\\')
842 yyless(yyleng-1); /* return last quote */
843 yymore(); /* append next string */
845 else
847 strcpy(yylval.string, yytext + 1);
848 if(yylval.string[yyleng-2] != '"')
849 ilog(L_MAIN, "Unterminated character string");
850 else
852 int i,j;
853 yylval.string[yyleng-2] = '\0'; /* remove close
854 * quote
857 for (j=i=0 ;yylval.string[i] != '\0'; i++,j++)
859 if (yylval.string[i] != '\\')
861 yylval.string[j] = yylval.string[i];
863 else
865 i++;
866 if (yylval.string[i] == '\0') /* XXX
867 * should not
868 * happen
871 ilog(L_MAIN,
872 "Unterminated character string");
873 break;
875 yylval.string[j] = yylval.string[i];
878 yylval.string[j] = '\0';
879 return QSTRING;
883 YY_BREAK
884 case 8:
885 YY_RULE_SETUP
886 #line 153 "ircd_lexer.l"
887 { return LOADMODULE; }
888 YY_BREAK
889 case 9:
890 YY_RULE_SETUP
891 #line 154 "ircd_lexer.l"
893 strcpy(yylval.string, yytext);
894 yylval.string[yyleng] = '\0';
895 return STRING;
897 YY_BREAK
898 case 10:
899 YY_RULE_SETUP
900 #line 160 "ircd_lexer.l"
901 { return TWODOTS; }
902 YY_BREAK
903 case 11:
904 YY_RULE_SETUP
905 #line 161 "ircd_lexer.l"
906 { return yytext[0]; }
907 YY_BREAK
908 case YY_STATE_EOF(INITIAL):
909 #line 162 "ircd_lexer.l"
910 { if (ieof()) yyterminate(); }
911 YY_BREAK
912 case 12:
913 YY_RULE_SETUP
914 #line 163 "ircd_lexer.l"
915 ECHO;
916 YY_BREAK
917 #line 918 "lex.yy.c"
919 case YY_END_OF_BUFFER:
921 /* Amount of text matched not including the EOB char. */
922 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
924 /* Undo the effects of YY_DO_BEFORE_ACTION. */
925 *yy_cp = (yy_hold_char);
926 YY_RESTORE_YY_MORE_OFFSET
928 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
930 /* We're scanning a new file or input source. It's
931 * possible that this happened because the user
932 * just pointed yyin at a new source and called
933 * yylex(). If so, then we have to assure
934 * consistency between YY_CURRENT_BUFFER and our
935 * globals. Here is the right place to do so, because
936 * this is the first action (other than possibly a
937 * back-up) that will match for the new input source.
939 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
940 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
941 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
944 /* Note that here we test for yy_c_buf_p "<=" to the position
945 * of the first EOB in the buffer, since yy_c_buf_p will
946 * already have been incremented past the NUL character
947 * (since all states make transitions on EOB to the
948 * end-of-buffer state). Contrast this with the test
949 * in input().
951 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
952 { /* This was really a NUL. */
953 yy_state_type yy_next_state;
955 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
957 yy_current_state = yy_get_previous_state( );
959 /* Okay, we're now positioned to make the NUL
960 * transition. We couldn't have
961 * yy_get_previous_state() go ahead and do it
962 * for us because it doesn't know how to deal
963 * with the possibility of jamming (and we don't
964 * want to build jamming into it because then it
965 * will run more slowly).
968 yy_next_state = yy_try_NUL_trans( yy_current_state );
970 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
972 if ( yy_next_state )
974 /* Consume the NUL. */
975 yy_cp = ++(yy_c_buf_p);
976 yy_current_state = yy_next_state;
977 goto yy_match;
980 else
982 yy_cp = (yy_c_buf_p);
983 goto yy_find_action;
987 else switch ( yy_get_next_buffer( ) )
989 case EOB_ACT_END_OF_FILE:
991 (yy_did_buffer_switch_on_eof) = 0;
993 if ( yywrap( ) )
995 /* Note: because we've taken care in
996 * yy_get_next_buffer() to have set up
997 * yytext, we can now set up
998 * yy_c_buf_p so that if some total
999 * hoser (like flex itself) wants to
1000 * call the scanner after we return the
1001 * YY_NULL, it'll still work - another
1002 * YY_NULL will get returned.
1004 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1006 yy_act = YY_STATE_EOF(YY_START);
1007 goto do_action;
1010 else
1012 if ( ! (yy_did_buffer_switch_on_eof) )
1013 YY_NEW_FILE;
1015 break;
1018 case EOB_ACT_CONTINUE_SCAN:
1019 (yy_c_buf_p) =
1020 (yytext_ptr) + yy_amount_of_matched_text;
1022 yy_current_state = yy_get_previous_state( );
1024 yy_cp = (yy_c_buf_p);
1025 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1026 goto yy_match;
1028 case EOB_ACT_LAST_MATCH:
1029 (yy_c_buf_p) =
1030 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1032 yy_current_state = yy_get_previous_state( );
1034 yy_cp = (yy_c_buf_p);
1035 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1036 goto yy_find_action;
1038 break;
1041 default:
1042 YY_FATAL_ERROR(
1043 "fatal flex scanner internal error--no action found" );
1044 } /* end of action switch */
1045 } /* end of scanning one token */
1046 } /* end of yylex */
1048 /* yy_get_next_buffer - try to read in a new buffer
1050 * Returns a code representing an action:
1051 * EOB_ACT_LAST_MATCH -
1052 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1053 * EOB_ACT_END_OF_FILE - end of file
1055 static int yy_get_next_buffer (void)
1057 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1058 register char *source = (yytext_ptr);
1059 register int number_to_move, i;
1060 int ret_val;
1062 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1063 YY_FATAL_ERROR(
1064 "fatal flex scanner internal error--end of buffer missed" );
1066 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1067 { /* Don't try to fill the buffer, so this is an EOF. */
1068 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1070 /* We matched a single character, the EOB, so
1071 * treat this as a final EOF.
1073 return EOB_ACT_END_OF_FILE;
1076 else
1078 /* We matched some text prior to the EOB, first
1079 * process it.
1081 return EOB_ACT_LAST_MATCH;
1085 /* Try to read more data. */
1087 /* First move last chars to start of buffer. */
1088 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1090 for ( i = 0; i < number_to_move; ++i )
1091 *(dest++) = *(source++);
1093 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1094 /* don't do the read, it's not guaranteed to return an EOF,
1095 * just force an EOF
1097 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1099 else
1101 size_t num_to_read =
1102 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1104 while ( num_to_read <= 0 )
1105 { /* Not enough room in the buffer - grow it. */
1107 /* just a shorter name for the current buffer */
1108 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1110 int yy_c_buf_p_offset =
1111 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1113 if ( b->yy_is_our_buffer )
1115 int new_size = b->yy_buf_size * 2;
1117 if ( new_size <= 0 )
1118 b->yy_buf_size += b->yy_buf_size / 8;
1119 else
1120 b->yy_buf_size *= 2;
1122 b->yy_ch_buf = (char *)
1123 /* Include room in for 2 EOB chars. */
1124 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1126 else
1127 /* Can't grow it, we don't own it. */
1128 b->yy_ch_buf = 0;
1130 if ( ! b->yy_ch_buf )
1131 YY_FATAL_ERROR(
1132 "fatal error - scanner input buffer overflow" );
1134 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1136 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1137 number_to_move - 1;
1141 if ( num_to_read > YY_READ_BUF_SIZE )
1142 num_to_read = YY_READ_BUF_SIZE;
1144 /* Read in more data. */
1145 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1146 (yy_n_chars), num_to_read );
1148 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1151 if ( (yy_n_chars) == 0 )
1153 if ( number_to_move == YY_MORE_ADJ )
1155 ret_val = EOB_ACT_END_OF_FILE;
1156 yyrestart(yyin );
1159 else
1161 ret_val = EOB_ACT_LAST_MATCH;
1162 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1163 YY_BUFFER_EOF_PENDING;
1167 else
1168 ret_val = EOB_ACT_CONTINUE_SCAN;
1170 (yy_n_chars) += number_to_move;
1171 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1172 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1174 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1176 return ret_val;
1179 /* yy_get_previous_state - get the state just before the EOB char was reached */
1181 static yy_state_type yy_get_previous_state (void)
1183 register yy_state_type yy_current_state;
1184 register char *yy_cp;
1186 yy_current_state = (yy_start);
1188 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1190 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1191 if ( yy_accept[yy_current_state] )
1193 (yy_last_accepting_state) = yy_current_state;
1194 (yy_last_accepting_cpos) = yy_cp;
1196 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1198 yy_current_state = (int) yy_def[yy_current_state];
1199 if ( yy_current_state >= 47 )
1200 yy_c = yy_meta[(unsigned int) yy_c];
1202 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1205 return yy_current_state;
1208 /* yy_try_NUL_trans - try to make a transition on the NUL character
1210 * synopsis
1211 * next_state = yy_try_NUL_trans( current_state );
1213 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1215 register int yy_is_jam;
1216 register char *yy_cp = (yy_c_buf_p);
1218 register YY_CHAR yy_c = 1;
1219 if ( yy_accept[yy_current_state] )
1221 (yy_last_accepting_state) = yy_current_state;
1222 (yy_last_accepting_cpos) = yy_cp;
1224 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1226 yy_current_state = (int) yy_def[yy_current_state];
1227 if ( yy_current_state >= 47 )
1228 yy_c = yy_meta[(unsigned int) yy_c];
1230 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1231 yy_is_jam = (yy_current_state == 46);
1233 return yy_is_jam ? 0 : yy_current_state;
1236 #ifndef YY_NO_INPUT
1237 #ifdef __cplusplus
1238 static int yyinput (void)
1239 #else
1240 static int input (void)
1241 #endif
1244 int c;
1246 *(yy_c_buf_p) = (yy_hold_char);
1248 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1250 /* yy_c_buf_p now points to the character we want to return.
1251 * If this occurs *before* the EOB characters, then it's a
1252 * valid NUL; if not, then we've hit the end of the buffer.
1254 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1255 /* This was really a NUL. */
1256 *(yy_c_buf_p) = '\0';
1258 else
1259 { /* need more input */
1260 int offset = (yy_c_buf_p) - (yytext_ptr);
1261 ++(yy_c_buf_p);
1263 switch ( yy_get_next_buffer( ) )
1265 case EOB_ACT_LAST_MATCH:
1266 /* This happens because yy_g_n_b()
1267 * sees that we've accumulated a
1268 * token and flags that we need to
1269 * try matching the token before
1270 * proceeding. But for input(),
1271 * there's no matching to consider.
1272 * So convert the EOB_ACT_LAST_MATCH
1273 * to EOB_ACT_END_OF_FILE.
1276 /* Reset buffer status. */
1277 yyrestart(yyin );
1279 /*FALLTHROUGH*/
1281 case EOB_ACT_END_OF_FILE:
1283 if ( yywrap( ) )
1284 return EOF;
1286 if ( ! (yy_did_buffer_switch_on_eof) )
1287 YY_NEW_FILE;
1288 #ifdef __cplusplus
1289 return yyinput();
1290 #else
1291 return input();
1292 #endif
1295 case EOB_ACT_CONTINUE_SCAN:
1296 (yy_c_buf_p) = (yytext_ptr) + offset;
1297 break;
1302 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1303 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1304 (yy_hold_char) = *++(yy_c_buf_p);
1306 return c;
1308 #endif /* ifndef YY_NO_INPUT */
1310 /** Immediately switch to a different input stream.
1311 * @param input_file A readable stream.
1313 * @note This function does not reset the start condition to @c INITIAL .
1315 void yyrestart (FILE * input_file )
1318 if ( ! YY_CURRENT_BUFFER ){
1319 yyensure_buffer_stack ();
1320 YY_CURRENT_BUFFER_LVALUE =
1321 yy_create_buffer(yyin,YY_BUF_SIZE );
1324 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1325 yy_load_buffer_state( );
1328 /** Switch to a different input buffer.
1329 * @param new_buffer The new input buffer.
1332 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1335 /* TODO. We should be able to replace this entire function body
1336 * with
1337 * yypop_buffer_state();
1338 * yypush_buffer_state(new_buffer);
1340 yyensure_buffer_stack ();
1341 if ( YY_CURRENT_BUFFER == new_buffer )
1342 return;
1344 if ( YY_CURRENT_BUFFER )
1346 /* Flush out information for old buffer. */
1347 *(yy_c_buf_p) = (yy_hold_char);
1348 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1349 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1352 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1353 yy_load_buffer_state( );
1355 /* We don't actually know whether we did this switch during
1356 * EOF (yywrap()) processing, but the only time this flag
1357 * is looked at is after yywrap() is called, so it's safe
1358 * to go ahead and always set it.
1360 (yy_did_buffer_switch_on_eof) = 1;
1363 static void yy_load_buffer_state (void)
1365 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1366 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1367 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1368 (yy_hold_char) = *(yy_c_buf_p);
1371 /** Allocate and initialize an input buffer state.
1372 * @param file A readable stream.
1373 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1375 * @return the allocated buffer state.
1377 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1379 YY_BUFFER_STATE b;
1381 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1382 if ( ! b )
1383 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1385 b->yy_buf_size = size;
1387 /* yy_ch_buf has to be 2 characters longer than the size given because
1388 * we need to put in 2 end-of-buffer characters.
1390 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1391 if ( ! b->yy_ch_buf )
1392 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1394 b->yy_is_our_buffer = 1;
1396 yy_init_buffer(b,file );
1398 return b;
1401 /** Destroy the buffer.
1402 * @param b a buffer created with yy_create_buffer()
1405 void yy_delete_buffer (YY_BUFFER_STATE b )
1408 if ( ! b )
1409 return;
1411 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1412 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1414 if ( b->yy_is_our_buffer )
1415 yyfree((void *) b->yy_ch_buf );
1417 yyfree((void *) b );
1420 #ifndef __cplusplus
1421 extern int isatty (int );
1422 #endif /* __cplusplus */
1424 /* Initializes or reinitializes a buffer.
1425 * This function is sometimes called more than once on the same buffer,
1426 * such as during a yyrestart() or at EOF.
1428 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1431 int oerrno = errno;
1433 yy_flush_buffer(b );
1435 b->yy_input_file = file;
1436 b->yy_fill_buffer = 1;
1438 /* If b is the current buffer, then yy_init_buffer was _probably_
1439 * called from yyrestart() or through yy_get_next_buffer.
1440 * In that case, we don't want to reset the lineno or column.
1442 if (b != YY_CURRENT_BUFFER){
1443 b->yy_bs_lineno = 1;
1444 b->yy_bs_column = 0;
1447 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1449 errno = oerrno;
1452 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1453 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1456 void yy_flush_buffer (YY_BUFFER_STATE b )
1458 if ( ! b )
1459 return;
1461 b->yy_n_chars = 0;
1463 /* We always need two end-of-buffer characters. The first causes
1464 * a transition to the end-of-buffer state. The second causes
1465 * a jam in that state.
1467 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1468 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1470 b->yy_buf_pos = &b->yy_ch_buf[0];
1472 b->yy_at_bol = 1;
1473 b->yy_buffer_status = YY_BUFFER_NEW;
1475 if ( b == YY_CURRENT_BUFFER )
1476 yy_load_buffer_state( );
1479 /** Pushes the new state onto the stack. The new state becomes
1480 * the current state. This function will allocate the stack
1481 * if necessary.
1482 * @param new_buffer The new state.
1485 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1487 if (new_buffer == NULL)
1488 return;
1490 yyensure_buffer_stack();
1492 /* This block is copied from yy_switch_to_buffer. */
1493 if ( YY_CURRENT_BUFFER )
1495 /* Flush out information for old buffer. */
1496 *(yy_c_buf_p) = (yy_hold_char);
1497 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1498 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1501 /* Only push if top exists. Otherwise, replace top. */
1502 if (YY_CURRENT_BUFFER)
1503 (yy_buffer_stack_top)++;
1504 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1506 /* copied from yy_switch_to_buffer. */
1507 yy_load_buffer_state( );
1508 (yy_did_buffer_switch_on_eof) = 1;
1511 /** Removes and deletes the top of the stack, if present.
1512 * The next element becomes the new top.
1515 void yypop_buffer_state (void)
1517 if (!YY_CURRENT_BUFFER)
1518 return;
1520 yy_delete_buffer(YY_CURRENT_BUFFER );
1521 YY_CURRENT_BUFFER_LVALUE = NULL;
1522 if ((yy_buffer_stack_top) > 0)
1523 --(yy_buffer_stack_top);
1525 if (YY_CURRENT_BUFFER) {
1526 yy_load_buffer_state( );
1527 (yy_did_buffer_switch_on_eof) = 1;
1531 /* Allocates the stack if it does not exist.
1532 * Guarantees space for at least one push.
1534 static void yyensure_buffer_stack (void)
1536 int num_to_alloc;
1538 if (!(yy_buffer_stack)) {
1540 /* First allocation is just for 2 elements, since we don't know if this
1541 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1542 * immediate realloc on the next call.
1544 num_to_alloc = 1;
1545 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1546 (num_to_alloc * sizeof(struct yy_buffer_state*)
1549 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1551 (yy_buffer_stack_max) = num_to_alloc;
1552 (yy_buffer_stack_top) = 0;
1553 return;
1556 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1558 /* Increase the buffer to prepare for a possible push. */
1559 int grow_size = 8 /* arbitrary grow size */;
1561 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1562 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1563 ((yy_buffer_stack),
1564 num_to_alloc * sizeof(struct yy_buffer_state*)
1567 /* zero only the new slots.*/
1568 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1569 (yy_buffer_stack_max) = num_to_alloc;
1573 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1574 * @param base the character buffer
1575 * @param size the size in bytes of the character buffer
1577 * @return the newly allocated buffer state object.
1579 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1581 YY_BUFFER_STATE b;
1583 if ( size < 2 ||
1584 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1585 base[size-1] != YY_END_OF_BUFFER_CHAR )
1586 /* They forgot to leave room for the EOB's. */
1587 return 0;
1589 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1590 if ( ! b )
1591 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1593 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1594 b->yy_buf_pos = b->yy_ch_buf = base;
1595 b->yy_is_our_buffer = 0;
1596 b->yy_input_file = 0;
1597 b->yy_n_chars = b->yy_buf_size;
1598 b->yy_is_interactive = 0;
1599 b->yy_at_bol = 1;
1600 b->yy_fill_buffer = 0;
1601 b->yy_buffer_status = YY_BUFFER_NEW;
1603 yy_switch_to_buffer(b );
1605 return b;
1608 /** Setup the input buffer state to scan a string. The next call to yylex() will
1609 * scan from a @e copy of @a str.
1610 * @param yy_str a NUL-terminated string to scan
1612 * @return the newly allocated buffer state object.
1613 * @note If you want to scan bytes that may contain NUL values, then use
1614 * yy_scan_bytes() instead.
1616 YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str )
1619 return yy_scan_bytes(yy_str,strlen(yy_str) );
1622 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1623 * scan from a @e copy of @a bytes.
1624 * @param bytes the byte buffer to scan
1625 * @param len the number of bytes in the buffer pointed to by @a bytes.
1627 * @return the newly allocated buffer state object.
1629 YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len )
1631 YY_BUFFER_STATE b;
1632 char *buf;
1633 yy_size_t n;
1634 int i;
1636 /* Get memory for full buffer, including space for trailing EOB's. */
1637 n = len + 2;
1638 buf = (char *) yyalloc(n );
1639 if ( ! buf )
1640 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1642 for ( i = 0; i < len; ++i )
1643 buf[i] = bytes[i];
1645 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1647 b = yy_scan_buffer(buf,n );
1648 if ( ! b )
1649 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1651 /* It's okay to grow etc. this buffer, and we should throw it
1652 * away when we're done.
1654 b->yy_is_our_buffer = 1;
1656 return b;
1659 #ifndef YY_EXIT_FAILURE
1660 #define YY_EXIT_FAILURE 2
1661 #endif
1663 static void yy_fatal_error (yyconst char* msg )
1665 (void) fprintf( stderr, "%s\n", msg );
1666 exit( YY_EXIT_FAILURE );
1669 /* Redefine yyless() so it works in section 3 code. */
1671 #undef yyless
1672 #define yyless(n) \
1673 do \
1675 /* Undo effects of setting up yytext. */ \
1676 int yyless_macro_arg = (n); \
1677 YY_LESS_LINENO(yyless_macro_arg);\
1678 yytext[yyleng] = (yy_hold_char); \
1679 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1680 (yy_hold_char) = *(yy_c_buf_p); \
1681 *(yy_c_buf_p) = '\0'; \
1682 yyleng = yyless_macro_arg; \
1684 while ( 0 )
1686 /* Accessor methods (get/set functions) to struct members. */
1688 /** Get the current line number.
1691 int yyget_lineno (void)
1694 return yylineno;
1697 /** Get the input stream.
1700 FILE *yyget_in (void)
1702 return yyin;
1705 /** Get the output stream.
1708 FILE *yyget_out (void)
1710 return yyout;
1713 /** Get the length of the current token.
1716 int yyget_leng (void)
1718 return yyleng;
1721 /** Get the current token.
1725 char *yyget_text (void)
1727 return yytext;
1730 /** Set the current line number.
1731 * @param line_number
1734 void yyset_lineno (int line_number )
1737 yylineno = line_number;
1740 /** Set the input stream. This does not discard the current
1741 * input buffer.
1742 * @param in_str A readable stream.
1744 * @see yy_switch_to_buffer
1746 void yyset_in (FILE * in_str )
1748 yyin = in_str ;
1751 void yyset_out (FILE * out_str )
1753 yyout = out_str ;
1756 int yyget_debug (void)
1758 return yy_flex_debug;
1761 void yyset_debug (int bdebug )
1763 yy_flex_debug = bdebug ;
1766 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1767 int yylex_destroy (void)
1770 /* Pop the buffer stack, destroying each element. */
1771 while(YY_CURRENT_BUFFER){
1772 yy_delete_buffer(YY_CURRENT_BUFFER );
1773 YY_CURRENT_BUFFER_LVALUE = NULL;
1774 yypop_buffer_state();
1777 /* Destroy the stack itself. */
1778 yyfree((yy_buffer_stack) );
1779 (yy_buffer_stack) = NULL;
1781 return 0;
1785 * Internal utility routines.
1788 #ifndef yytext_ptr
1789 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1791 register int i;
1792 for ( i = 0; i < n; ++i )
1793 s1[i] = s2[i];
1795 #endif
1797 #ifdef YY_NEED_STRLEN
1798 static int yy_flex_strlen (yyconst char * s )
1800 register int n;
1801 for ( n = 0; s[n]; ++n )
1804 return n;
1806 #endif
1808 void *yyalloc (yy_size_t size )
1810 return (void *) malloc( size );
1813 void *yyrealloc (void * ptr, yy_size_t size )
1815 /* The cast to (char *) in the following accommodates both
1816 * implementations that use char* generic pointers, and those
1817 * that use void* generic pointers. It works with the latter
1818 * because both ANSI C and C++ allow castless assignment from
1819 * any pointer type to void*, and deal with argument conversions
1820 * as though doing an assignment.
1822 return (void *) realloc( (char *) ptr, size );
1825 void yyfree (void * ptr )
1827 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1830 #define YYTABLES_NAME "yytables"
1832 #undef YY_NEW_FILE
1833 #undef YY_FLUSH_BUFFER
1834 #undef yy_set_bol
1835 #undef yy_new_buffer
1836 #undef yy_set_interactive
1837 #undef yytext_ptr
1838 #undef YY_DO_BEFORE_ACTION
1840 #ifdef YY_DECL_IS_OURS
1841 #undef YY_DECL_IS_OURS
1842 #undef YY_DECL
1843 #endif
1844 #line 163 "ircd_lexer.l"
1848 /* C-comment ignoring routine -kre*/
1849 void ccomment()
1851 int c;
1853 /* log(L_NOTICE, "got comment"); */
1854 while (1)
1856 while ((c = input()) != '*' && c != EOF)
1857 if (c == '\n') ++lineno;
1858 if (c == '*')
1860 while ((c = input()) == '*');
1861 if (c == '/')
1862 break;
1864 if (c == EOF)
1866 YY_FATAL_ERROR("EOF in comment");
1867 /* XXX hack alert this disables
1868 * the stupid unused function warning
1869 * gcc generates
1871 yy_fatal_error("EOF in comment");
1872 break;
1877 void cinclude(void)
1879 char *c;
1880 if ((c = strchr(yytext, '<')) == NULL)
1881 *strchr(c = strchr(yytext, '"') + 1, '"') = 0;
1882 else
1883 *strchr(++c, '>') = 0;
1885 /* do stacking and co. */
1886 if (include_stack_ptr >= MAX_INCLUDE_DEPTH)
1887 conf_report_error("Includes nested too deep (max is %d)", MAX_INCLUDE_DEPTH);
1888 else
1890 FILE *tmp_fbfile_in;
1892 tmp_fbfile_in = fopen(c, "r");
1894 if (tmp_fbfile_in == NULL)
1896 /* if its not found in PREFIX, look in ETCPATH */
1897 char fnamebuf[IRCD_BUFSIZE];
1899 snprintf(fnamebuf, sizeof(fnamebuf), "%s/%s", ETCPATH, c);
1900 tmp_fbfile_in = fopen(fnamebuf, "r");
1902 /* wasnt found there either.. error. */
1903 if(tmp_fbfile_in == NULL)
1905 conf_report_error("Include %s: %s.", c, strerror(errno));
1906 return;
1909 lineno_stack[include_stack_ptr] = lineno;
1910 lineno = 1;
1911 inc_fbfile_in[include_stack_ptr] = conf_fbfile_in;
1912 strcpy(conffile_stack[include_stack_ptr], c);
1913 current_file = conffile_stack[include_stack_ptr];
1914 include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER;
1915 conf_fbfile_in = tmp_fbfile_in;
1916 yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE));
1920 int ieof(void)
1922 if (include_stack_ptr)
1923 fclose(conf_fbfile_in);
1924 if (--include_stack_ptr < 0)
1926 /* We will now exit the lexer - restore init values if we get /rehash
1927 * later and reenter lexer -kre */
1928 include_stack_ptr = 0;
1929 lineno = 1;
1930 return 1;
1932 /* switch buffer */
1933 yy_delete_buffer(YY_CURRENT_BUFFER);
1934 lineno = lineno_stack[include_stack_ptr];
1935 conf_fbfile_in = inc_fbfile_in[include_stack_ptr];
1937 if(include_stack_ptr)
1938 current_file = conffile_stack[include_stack_ptr];
1939 else
1940 current_file = conffilebuf;
1942 yy_switch_to_buffer(include_stack[include_stack_ptr]);
1943 return 0;
1946 /* #-comment style, look for #include */
1947 #define INCLUDE "#include"
1949 void hashcomment(void)
1951 if (strlen(yytext) < sizeof(INCLUDE) - 1)
1952 return;
1954 if (!strncasecmp(yytext, INCLUDE, sizeof(INCLUDE) - 1))
1955 yyerror("You probably meant '.include', skipping");