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