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