source: trunk/server/source4/heimdal/lib/hx509/sel-lex.c

Last change on this file was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

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