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