source: heimdal/trunk/lib/hx509/sel-lex.c@ 3

Last change on this file since 3 was 1, checked in by Paul Smedley, 10 years ago

Initial commit of Heimdal 1.5.3

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