1
2 #line 3 "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 160
355 #define YY_END_OF_BUFFER 161
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[420] =
364 { 0,
365 0, 0, 161, 159, 136, 63, 137, 135, 103, 159,
366 104, 53, 102, 105, 159, 64, 65, 94, 92, 52,
367 93, 56, 96, 140, 154, 132, 51, 116, 91, 117,
368 130, 158, 67, 68, 107, 158, 158, 158, 158, 158,
369 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
370 158, 158, 69, 106, 70, 108, 158, 158, 158, 136,
371 135, 2, 114, 0, 139, 0, 79, 122, 89, 0,
372 138, 0, 100, 73, 66, 110, 71, 112, 72, 57,
373 0, 157, 0, 1, 98, 75, 157, 141, 154, 0,
374 0, 0, 0, 131, 126, 118, 61, 113, 59, 120,
375
376 128, 158, 86, 158, 158, 158, 158, 158, 158, 10,
377 158, 158, 158, 158, 158, 158, 158, 158, 158, 11,
378 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
379 158, 158, 158, 158, 158, 158, 158, 158, 158, 90,
380 124, 109, 133, 134, 95, 97, 158, 158, 158, 158,
381 158, 158, 158, 158, 158, 0, 2, 139, 87, 138,
382 80, 54, 157, 0, 77, 156, 157, 0, 0, 157,
383 0, 146, 0, 142, 0, 150, 82, 84, 158, 158,
384 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
385 158, 9, 158, 158, 158, 158, 24, 158, 158, 158,
386
387 158, 158, 158, 158, 158, 158, 158, 158, 158, 158,
388 158, 158, 19, 158, 158, 158, 158, 158, 88, 74,
389 76, 55, 101, 58, 60, 123, 125, 115, 119, 121,
390 62, 111, 127, 129, 99, 157, 0, 0, 149, 0,
391 149, 0, 145, 0, 145, 0, 153, 0, 153, 150,
392 3, 23, 158, 16, 158, 158, 158, 158, 12, 34,
393 158, 158, 158, 28, 158, 41, 40, 158, 158, 158,
394 158, 158, 22, 158, 158, 158, 158, 26, 158, 158,
395 158, 158, 158, 158, 158, 37, 158, 158, 158, 35,
396 158, 81, 83, 85, 78, 155, 0, 148, 149, 0,
397
398 0, 149, 0, 144, 145, 0, 0, 145, 153, 0,
399 152, 153, 153, 0, 0, 150, 150, 14, 20, 4,
400 158, 158, 158, 158, 38, 158, 158, 158, 158, 158,
401 158, 158, 158, 158, 45, 158, 158, 158, 158, 158,
402 158, 158, 158, 21, 158, 33, 8, 149, 0, 0,
403 145, 0, 0, 153, 153, 153, 0, 153, 153, 0,
404 153, 158, 158, 158, 48, 158, 158, 5, 158, 43,
405 158, 158, 158, 47, 158, 18, 158, 6, 27, 32,
406 13, 31, 158, 147, 143, 0, 151, 158, 17, 158,
407 36, 158, 158, 49, 158, 158, 158, 158, 39, 158,
408
409 15, 158, 7, 158, 158, 158, 25, 158, 158, 44,
410 158, 42, 46, 29, 158, 50, 158, 30, 0
411 } ;
412
413 static const YY_CHAR yy_ec[256] =
414 { 0,
415 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
416 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
418 1, 5, 6, 7, 8, 9, 10, 11, 12, 13,
419 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
420 23, 23, 23, 23, 23, 24, 24, 25, 26, 27,
421 28, 29, 30, 1, 31, 31, 31, 31, 32, 31,
422 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
423 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
424 34, 35, 36, 37, 38, 1, 39, 40, 41, 42,
425
426 43, 44, 45, 46, 47, 33, 48, 49, 50, 51,
427 52, 53, 33, 54, 55, 56, 57, 58, 59, 60,
428 61, 33, 62, 63, 64, 65, 1, 66, 33, 33,
429 33, 33, 33, 67, 68, 69, 70, 71, 33, 33,
430 33, 33, 33, 33, 72, 73, 33, 33, 33, 33,
431 74, 33, 33, 33, 33, 33, 33, 33, 33, 75,
432 76, 77, 33, 78, 79, 80, 81, 82, 33, 83,
433 84, 85, 33, 33, 33, 33, 33, 86, 87, 33,
434 33, 33, 88, 33, 33, 89, 33, 33, 90, 33,
435 33, 33, 33, 91, 92, 33, 33, 33, 33, 33,
436
437 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
438 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
439 33, 33, 33, 33, 33, 93, 33, 33, 33, 33,
440 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
441 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
442 33, 33, 33, 33, 33
443 } ;
444
445 static const YY_CHAR yy_meta[94] =
446 { 0,
447 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
448 1, 1, 1, 1, 1, 3, 1, 3, 4, 1,
449 5, 5, 5, 5, 1, 1, 1, 1, 1, 1,
450 5, 5, 6, 1, 1, 1, 1, 5, 5, 5,
451 5, 5, 5, 5, 6, 6, 6, 6, 6, 6,
452 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
453 6, 7, 1, 8, 1, 6, 6, 6, 6, 6,
454 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
455 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
456 6, 6, 6
457
458 } ;
459
460 static const flex_int16_t yy_base[432] =
461 { 0,
462 0, 92, 793, 794, 794, 794, 794, 794, 764, 88,
463 794, 794, 763, 85, 86, 794, 794, 84, 86, 794,
464 87, 85, 102, 105, 112, 765, 794, 111, 82, 91,
465 794, 0, 794, 794, 761, 731, 49, 102, 99, 107,
466 114, 738, 747, 118, 746, 118, 120, 121, 128, 733,
467 731, 736, 794, 97, 794, 794, 98, 58, 124, 194,
468 195, 794, 794, 169, 794, 171, 794, 753, 794, 174,
469 794, 176, 752, 794, 794, 794, 794, 794, 794, 794,
470 760, 191, 195, 794, 750, 794, 203, 226, 238, 250,
471 217, 256, 758, 794, 748, 794, 794, 794, 794, 794,
472
473 747, 0, 794, 718, 721, 729, 165, 720, 726, 0,
474 714, 711, 154, 718, 717, 711, 713, 711, 707, 0,
475 708, 704, 721, 708, 708, 704, 715, 181, 224, 704,
476 213, 706, 698, 183, 704, 697, 702, 701, 700, 794,
477 718, 0, 0, 0, 717, 716, 663, 158, 669, 161,
478 207, 670, 651, 207, 649, 285, 794, 282, 794, 279,
479 794, 794, 275, 281, 794, 719, 288, 300, 306, 311,
480 318, 332, 320, 340, 675, 328, 794, 794, 684, 686,
481 695, 690, 691, 245, 692, 687, 679, 685, 684, 671,
482 682, 208, 683, 683, 684, 669, 0, 664, 676, 657,
483
484 661, 667, 660, 667, 664, 655, 672, 654, 259, 653,
485 665, 664, 0, 646, 662, 652, 661, 653, 794, 794,
486 794, 0, 673, 0, 0, 0, 0, 0, 0, 0,
487 0, 0, 672, 671, 670, 293, 678, 363, 367, 352,
488 374, 376, 381, 399, 409, 417, 314, 435, 429, 464,
489 0, 0, 648, 0, 649, 638, 646, 635, 0, 0,
490 637, 636, 643, 0, 636, 0, 625, 639, 627, 620,
491 611, 611, 0, 619, 603, 599, 586, 0, 583, 583,
492 581, 576, 585, 584, 585, 0, 563, 575, 565, 0,
493 568, 794, 794, 794, 794, 794, 387, 588, 463, 424,
494
495 432, 443, 465, 587, 476, 471, 489, 494, 502, 541,
496 585, 481, 505, 518, 547, 512, 163, 0, 0, 0,
497 552, 553, 545, 558, 0, 554, 551, 548, 541, 527,
498 528, 527, 533, 532, 0, 521, 512, 508, 512, 507,
499 495, 501, 504, 0, 493, 0, 0, 323, 516, 544,
500 336, 514, 554, 577, 349, 368, 507, 578, 400, 458,
501 591, 448, 448, 455, 0, 439, 437, 0, 419, 0,
502 425, 424, 404, 0, 411, 0, 397, 0, 0, 0,
503 0, 0, 390, 794, 794, 426, 794, 309, 0, 374,
504 0, 372, 375, 0, 366, 348, 332, 323, 0, 313,
505
506 0, 264, 0, 265, 252, 250, 0, 211, 185, 0,
507 147, 0, 0, 0, 100, 0, 98, 0, 794, 640,
508 648, 652, 655, 656, 660, 665, 668, 671, 677, 680,
509 686
510 } ;
511
512 static const flex_int16_t yy_def[432] =
513 { 0,
514 419, 1, 419, 419, 419, 419, 419, 419, 419, 420,
515 419, 419, 419, 419, 421, 419, 419, 419, 419, 419,
516 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
517 419, 422, 419, 419, 419, 422, 422, 422, 422, 422,
518 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
519 422, 422, 419, 419, 419, 419, 422, 422, 422, 419,
520 419, 419, 419, 420, 419, 420, 419, 419, 419, 421,
521 419, 421, 419, 419, 419, 419, 419, 419, 419, 419,
522 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
523 419, 419, 423, 419, 419, 419, 419, 419, 419, 419,
524
525 419, 422, 419, 422, 422, 422, 422, 422, 422, 422,
526 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
527 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
528 422, 422, 422, 422, 422, 422, 422, 422, 422, 419,
529 419, 422, 422, 422, 422, 422, 422, 422, 422, 422,
530 422, 422, 422, 422, 422, 419, 419, 420, 419, 421,
531 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
532 419, 419, 419, 419, 424, 423, 419, 419, 422, 422,
533 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
534 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
535
536 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
537 422, 422, 422, 422, 422, 422, 422, 422, 419, 419,
538 419, 422, 422, 422, 422, 422, 422, 422, 422, 422,
539 422, 422, 422, 422, 422, 419, 419, 419, 419, 419,
540 419, 419, 419, 419, 419, 419, 424, 419, 425, 426,
541 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
542 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
543 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
544 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
545 422, 419, 419, 419, 419, 419, 419, 419, 419, 419,
546
547 419, 419, 419, 419, 419, 419, 419, 419, 427, 428,
548 419, 425, 429, 419, 419, 426, 316, 422, 422, 422,
549 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
550 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
551 422, 422, 422, 422, 422, 422, 422, 419, 419, 419,
552 419, 419, 419, 427, 354, 419, 419, 429, 358, 430,
553 419, 422, 422, 422, 422, 422, 422, 422, 422, 422,
554 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
555 422, 422, 422, 419, 419, 431, 419, 422, 422, 422,
556 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
557
558 422, 422, 422, 422, 422, 422, 422, 422, 422, 422,
559 422, 422, 422, 422, 422, 422, 422, 422, 0, 419,
560 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
561 419
562 } ;
563
564 static const flex_int16_t yy_nxt[888] =
565 { 0,
566 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
567 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
568 24, 25, 25, 25, 26, 27, 28, 29, 30, 31,
569 32, 32, 32, 33, 4, 34, 35, 32, 36, 37,
570 38, 39, 40, 41, 42, 43, 44, 32, 32, 32,
571 45, 32, 46, 47, 48, 49, 50, 51, 52, 32,
572 32, 53, 54, 55, 56, 32, 32, 32, 32, 32,
573 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
574 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
575 57, 58, 59, 60, 65, 68, 61, 71, 73, 62,
576
577 105, 76, 106, 81, 78, 82, 82, 82, 82, 98,
578 99, 74, 69, 77, 79, 80, 84, 75, 100, 101,
579 72, 85, 66, 87, 140, 88, 88, 88, 89, 86,
580 87, 145, 89, 89, 89, 89, 90, 95, 96, 97,
581 107, 109, 88, 90, 91, 146, 83, 90, 418, 89,
582 110, 417, 114, 108, 90, 111, 92, 112, 128, 141,
583 115, 120, 129, 130, 93, 116, 113, 121, 122, 125,
584 117, 126, 123, 133, 127, 65, 131, 158, 315, 132,
585 315, 134, 142, 143, 144, 71, 135, 160, 136, 147,
586 148, 149, 150, 151, 188, 156, 156, 152, 156, 156,
587
588 416, 157, 157, 66, 153, 66, 154, 155, 72, 189,
589 72, 163, 163, 163, 163, 164, 164, 164, 164, 182,
590 183, 166, 90, 167, 167, 167, 167, 203, 163, 223,
591 224, 415, 164, 90, 90, 171, 204, 172, 172, 212,
592 167, 226, 227, 213, 87, 90, 88, 88, 88, 89,
593 265, 208, 83, 414, 172, 266, 87, 90, 89, 89,
594 89, 89, 205, 88, 168, 169, 209, 169, 90, 90,
595 170, 170, 170, 170, 173, 89, 174, 174, 174, 206,
596 90, 228, 233, 234, 229, 230, 156, 170, 65, 156,
597 71, 413, 157, 174, 412, 163, 163, 163, 163, 256,
598
599 257, 164, 164, 164, 164, 282, 90, 411, 167, 167,
600 167, 167, 163, 72, 410, 283, 66, 90, 164, 90,
601 238, 238, 238, 238, 90, 167, 170, 170, 170, 170,
602 90, 170, 170, 170, 170, 90, 83, 238, 239, 239,
603 243, 243, 243, 170, 236, 309, 249, 400, 170, 168,
604 241, 401, 172, 172, 242, 239, 309, 243, 245, 250,
605 174, 174, 174, 242, 315, 242, 315, 246, 409, 172,
606 250, 246, 297, 297, 242, 248, 408, 174, 246, 240,
607 407, 244, 246, 238, 238, 238, 238, 239, 239, 297,
608 406, 301, 298, 301, 299, 299, 302, 302, 242, 386,
609
610 238, 243, 243, 243, 239, 242, 405, 297, 297, 242,
611 386, 299, 246, 302, 404, 315, 242, 315, 243, 303,
612 303, 303, 403, 246, 297, 402, 236, 304, 240, 305,
613 305, 305, 307, 399, 307, 300, 303, 308, 308, 308,
614 246, 315, 244, 315, 350, 350, 305, 311, 398, 397,
615 348, 246, 302, 302, 308, 310, 310, 310, 310, 396,
616 313, 350, 395, 302, 302, 310, 310, 394, 393, 302,
617 306, 313, 310, 310, 310, 310, 310, 310, 310, 315,
618 302, 315, 249, 299, 299, 303, 303, 303, 392, 391,
619 314, 353, 353, 353, 242, 317, 305, 305, 305, 419,
620
621 299, 390, 303, 389, 388, 242, 317, 246, 353, 308,
622 308, 308, 313, 305, 308, 308, 308, 315, 246, 315,
623 315, 356, 315, 313, 300, 387, 308, 419, 351, 419,
624 249, 308, 385, 355, 384, 383, 359, 306, 360, 360,
625 360, 360, 314, 317, 355, 382, 381, 359, 360, 360,
626 380, 379, 378, 377, 317, 360, 360, 360, 360, 360,
627 360, 360, 376, 248, 350, 350, 314, 361, 361, 361,
628 361, 375, 374, 373, 353, 353, 353, 361, 361, 372,
629 371, 350, 370, 369, 361, 361, 361, 361, 361, 361,
630 361, 353, 419, 419, 419, 419, 368, 367, 366, 365,
631
632 364, 363, 362, 357, 356, 352, 349, 348, 355, 359,
633 347, 361, 361, 361, 361, 346, 345, 351, 344, 355,
634 359, 361, 361, 343, 342, 341, 340, 339, 361, 361,
635 361, 361, 361, 361, 361, 338, 337, 336, 248, 314,
636 64, 335, 64, 64, 64, 64, 64, 64, 70, 334,
637 70, 70, 70, 70, 70, 70, 102, 102, 176, 176,
638 247, 333, 247, 312, 312, 332, 312, 316, 316, 316,
639 354, 331, 354, 330, 354, 310, 329, 328, 310, 358,
640 327, 358, 326, 358, 360, 325, 324, 360, 361, 323,
641 361, 322, 321, 320, 319, 318, 296, 295, 294, 293,
642
643 292, 291, 290, 289, 288, 287, 286, 285, 284, 281,
644 280, 279, 278, 277, 276, 275, 274, 273, 272, 271,
645 270, 269, 268, 267, 264, 263, 262, 261, 260, 259,
646 258, 255, 254, 253, 252, 251, 248, 237, 235, 232,
647 231, 225, 222, 221, 220, 219, 218, 217, 216, 215,
648 214, 211, 210, 207, 202, 201, 200, 199, 198, 197,
649 196, 195, 194, 193, 192, 191, 190, 187, 186, 185,
650 184, 181, 180, 179, 178, 177, 175, 165, 162, 161,
651 159, 139, 138, 137, 124, 119, 118, 104, 103, 94,
652 67, 63, 419, 3, 419, 419, 419, 419, 419, 419,
653
654 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
655 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
656 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
657 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
658 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
659 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
660 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
661 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
662 419, 419, 419, 419, 419, 419, 419
663 } ;
664
665 static const flex_int16_t yy_chk[888] =
666 { 0,
667 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
668 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
669 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
670 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
671 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
672 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
673 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
674 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
675 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
676 1, 1, 1, 2, 10, 14, 2, 15, 18, 2,
677
678 37, 19, 37, 22, 21, 22, 22, 22, 22, 29,
679 29, 18, 14, 19, 21, 21, 23, 18, 30, 30,
680 15, 23, 10, 24, 54, 24, 24, 24, 24, 23,
681 25, 58, 25, 25, 25, 25, 24, 28, 28, 28,
682 38, 39, 24, 25, 24, 58, 22, 24, 417, 25,
683 39, 415, 41, 38, 25, 40, 24, 40, 47, 54,
684 41, 44, 47, 48, 24, 41, 40, 44, 44, 46,
685 41, 46, 44, 49, 46, 64, 48, 66, 317, 48,
686 317, 49, 57, 57, 57, 70, 49, 72, 49, 59,
687 59, 59, 59, 59, 113, 60, 61, 59, 60, 61,
688
689 411, 60, 61, 64, 59, 66, 59, 59, 70, 113,
690 72, 82, 82, 82, 82, 83, 83, 83, 83, 107,
691 107, 87, 82, 87, 87, 87, 87, 128, 82, 148,
692 148, 409, 83, 82, 87, 91, 128, 91, 91, 134,
693 87, 150, 150, 134, 88, 87, 88, 88, 88, 88,
694 192, 131, 82, 408, 91, 192, 89, 88, 89, 89,
695 89, 89, 129, 88, 87, 90, 131, 90, 88, 89,
696 90, 90, 90, 90, 92, 89, 92, 92, 92, 129,
697 89, 151, 154, 154, 151, 151, 156, 90, 158, 156,
698 160, 406, 156, 92, 405, 163, 163, 163, 163, 184,
699
700 184, 164, 164, 164, 164, 209, 163, 404, 167, 167,
701 167, 167, 163, 160, 402, 209, 158, 163, 164, 167,
702 168, 168, 168, 168, 236, 167, 169, 169, 169, 169,
703 167, 170, 170, 170, 170, 236, 163, 168, 171, 171,
704 173, 173, 173, 169, 164, 247, 176, 388, 170, 167,
705 172, 388, 172, 172, 348, 171, 247, 173, 174, 176,
706 174, 174, 174, 172, 355, 348, 355, 351, 400, 172,
707 176, 174, 240, 240, 172, 247, 398, 174, 351, 171,
708 397, 173, 174, 238, 238, 238, 238, 239, 239, 240,
709 396, 242, 241, 242, 241, 241, 242, 242, 239, 356,
710
711 238, 243, 243, 243, 239, 241, 395, 297, 297, 239,
712 356, 241, 243, 242, 393, 359, 241, 359, 243, 244,
713 244, 244, 392, 243, 297, 390, 238, 245, 239, 245,
714 245, 245, 246, 383, 246, 241, 244, 246, 246, 246,
715 245, 386, 243, 386, 300, 300, 245, 249, 377, 375,
716 297, 245, 301, 301, 246, 248, 248, 248, 248, 373,
717 249, 300, 372, 302, 302, 248, 248, 371, 369, 301,
718 245, 249, 248, 248, 248, 248, 248, 248, 248, 250,
719 302, 250, 250, 299, 299, 303, 303, 303, 367, 366,
720 249, 306, 306, 306, 299, 250, 305, 305, 305, 312,
721
722 299, 364, 303, 363, 362, 299, 250, 305, 306, 307,
723 307, 307, 312, 305, 308, 308, 308, 309, 305, 309,
724 313, 360, 313, 312, 299, 357, 307, 316, 303, 316,
725 316, 308, 352, 309, 349, 345, 313, 305, 314, 314,
726 314, 314, 312, 316, 309, 343, 342, 313, 314, 314,
727 341, 340, 339, 338, 316, 314, 314, 314, 314, 314,
728 314, 314, 337, 309, 350, 350, 313, 315, 315, 315,
729 315, 336, 334, 333, 353, 353, 353, 315, 315, 332,
730 331, 350, 330, 329, 315, 315, 315, 315, 315, 315,
731 315, 353, 354, 358, 354, 358, 328, 327, 326, 324,
732
733 323, 322, 321, 311, 310, 304, 298, 350, 354, 358,
734 291, 361, 361, 361, 361, 289, 288, 353, 287, 354,
735 358, 361, 361, 285, 284, 283, 282, 281, 361, 361,
736 361, 361, 361, 361, 361, 280, 279, 277, 354, 358,
737 420, 276, 420, 420, 420, 420, 420, 420, 421, 275,
738 421, 421, 421, 421, 421, 421, 422, 422, 423, 423,
739 424, 274, 424, 425, 425, 272, 425, 426, 426, 426,
740 427, 271, 427, 270, 427, 428, 269, 268, 428, 429,
741 267, 429, 265, 429, 430, 263, 262, 430, 431, 261,
742 431, 258, 257, 256, 255, 253, 237, 235, 234, 233,
743
744 223, 218, 217, 216, 215, 214, 212, 211, 210, 208,
745 207, 206, 205, 204, 203, 202, 201, 200, 199, 198,
746 196, 195, 194, 193, 191, 190, 189, 188, 187, 186,
747 185, 183, 182, 181, 180, 179, 175, 166, 155, 153,
748 152, 149, 147, 146, 145, 141, 139, 138, 137, 136,
749 135, 133, 132, 130, 127, 126, 125, 124, 123, 122,
750 121, 119, 118, 117, 116, 115, 114, 112, 111, 109,
751 108, 106, 105, 104, 101, 95, 93, 85, 81, 73,
752 68, 52, 51, 50, 45, 43, 42, 36, 35, 26,
753 13, 9, 3, 419, 419, 419, 419, 419, 419, 419,
754
755 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
756 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
757 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
758 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
759 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
760 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
761 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
762 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
763 419, 419, 419, 419, 419, 419, 419
764 } ;
765
766 static yy_state_type yy_last_accepting_state;
767 static char *yy_last_accepting_cpos;
768
769 extern int yy_flex_debug;
770 int yy_flex_debug = 0;
771
772 /* The intent behind this definition is that it'll catch
773 * any uses of REJECT which flex missed.
774 */
775 #define REJECT reject_used_but_not_detected
776 #define yymore() yymore_used_but_not_detected
777 #define YY_MORE_ADJ 0
778 #define YY_RESTORE_YY_MORE_OFFSET
779 char *yytext;
780 #line 1 "lex.l"
781 #line 2 "lex.l"
782
783 /*
784 * Copyright © 1988-2004 Keith Packard and Bart Massey.
785 * All Rights Reserved. See the file COPYING in this directory
786 * for licensing information.
787 */
788
789 #include "nickle.h"
790 #include "gram.h"
791 #include "ref.h"
792 #include <strings.h>
793 #include <errno.h>
794 #ifdef HAVE_LIBREADLINE
795 #include <readline/readline.h>
796 #include <readline/history.h>
797 #endif
798
799 /*
800 * Silence gcc by providing prototypes for these functions
801 */
802 int yyget_lineno (void);
803 FILE *yyget_in (void);
804 FILE *yyget_out (void);
805 int yyget_leng (void);
806 char *yyget_text (void);
807 void yyset_lineno (int);
808 void yyset_in (FILE *);
809 void yyset_out (FILE *);
810 int yyget_debug (void);
811 void yyset_debug (int);
812 int yylex_destroy (void);
813
814 typedef struct _lexInput {
815 DataType data;
816 struct _lexInput *next;
817 Value file;
818 Atom name;
819 int lineno;
820 Bool at_bol;
821 Bool at_eof;
822 Bool interactive;
823 } LexInput;
824
825 LexInput *lexInput;
826 extern int ignorenl;
827 extern int notCommand;
828 extern int seeComment;
829 #define FILE_END_CHAR -2
830
lexInputMark(void * object)831 static void lexInputMark (void *object)
832 {
833 LexInput *lex = object;
834
835 MemReference (lex->next);
836 MemReference (lex->file);
837 }
838
839 static DataType lexInputType = {
840 lexInputMark, 0, "lexInputType"
841 };
842
843 void
NewLexInput(Value file,Atom name,Bool after,Bool interactive)844 NewLexInput (Value file, Atom name, Bool after, Bool interactive)
845 {
846 ENTER ();
847 LexInput *lex;
848
849 lex = MemAllocate (&lexInputType, sizeof (*lex));
850 lex->file = file;
851 lex->name = name;
852 lex->lineno = 0;
853 lex->at_bol = True;
854 lex->at_eof = False;
855 lex->interactive = interactive;
856 if (after)
857 {
858 LexInput **prev;
859
860 for (prev = &lexInput; *prev; prev = &(*prev)->next)
861 ;
862 lex->next = 0;
863 *prev = lex;
864 } else {
865 lex->next = lexInput;
866 lexInput = lex;
867 }
868 EXIT ();
869 }
870
871 #ifdef HAVE_LIBREADLINE
872
873 volatile int stdin_in_readline;
874
875 static void
my_prep_terminal(int meta_flag)876 my_prep_terminal(int meta_flag)
877 {
878 stdin_in_readline = 1;
879 rl_prep_terminal(meta_flag);
880 }
881
882 static void
my_deprep_terminal(void)883 my_deprep_terminal(void)
884 {
885 rl_deprep_terminal();
886 stdin_in_readline = 0;
887 }
888
889 static int
890 LexGetChar (void);
891
892 static int
ReadlineGetChar(FILE * f)893 ReadlineGetChar (FILE *f)
894 {
895 return LexGetChar ();
896 }
897 #endif
898
899 ReferencePtr LexInputReference;
900
901 void
LexInit(void)902 LexInit (void)
903 {
904 ENTER ();
905
906 #if HAVE_LIBREADLINE
907 rl_getc_function = ReadlineGetChar;
908 rl_prep_term_function = my_prep_terminal;
909 rl_deprep_term_function = my_deprep_terminal;
910 rl_catch_signals = 0;
911 #endif
912 LexInputReference = NewReference ((void **) &lexInput);
913 MemAddRoot (LexInputReference);
914 EXIT ();
915 }
916
917 Atom
LexFileName(void)918 LexFileName (void)
919 {
920 if (lexInput)
921 return lexInput->name;
922 return AtomId ("<initialization>");
923 }
924
925 int
LexFileLine(void)926 LexFileLine (void)
927 {
928 if (lexInput)
929 return lexInput->lineno;
930 return 0;
931 }
932
933 Bool
LexInteractive(void)934 LexInteractive (void)
935 {
936 if (lexInput)
937 return lexInput->interactive;
938 return False;
939 }
940
941 Bool
LexResetInteractive(void)942 LexResetInteractive (void)
943 {
944 while (lexInput->next && !lexInput->interactive)
945 {
946 FileClose (lexInput->file);
947 lexInput = lexInput->next;
948 }
949 if (lexInput->interactive)
950 return True;
951 return False;
952 }
953
954 Bool
LexFile(char * s,Bool complain,Bool after)955 LexFile (char *s, Bool complain, Bool after)
956 {
957 Value f;
958 int err;
959
960 f = FileFopen (s, "r", &err);
961 if (f == 0) {
962 if (complain)
963 (void) FilePrintf (FileStderr, "%s: %s\n",
964 s, StringChars (&FileGetErrorMessage (err)->string));
965 return False;
966 }
967 (void) NewLexInput(f, AtomId (s), after, False);
968 return True;
969 }
970
971 static int
LexGetChar(void)972 LexGetChar (void)
973 {
974 int c;
975
976 for (;;)
977 {
978 c = FileInput (lexInput->file);
979 if (c >= 0)
980 return c;
981 if (c == FileBlocked)
982 ThreadsRun (0, lexInput->file);
983 else
984 {
985 if (!lexInput->next)
986 return FileEOF;
987 lexInput->at_eof = True;
988 return '\n';
989 }
990 }
991 }
992
993 static Value
prompt(void)994 prompt (void)
995 {
996 Value v;
997
998 if (ignorenl)
999 v = lookupVar (0, "prompt2");
1000 else if (CurrentFrame)
1001 v = lookupVar (0, "prompt3");
1002 else
1003 v = lookupVar (0, "prompt");
1004 return v;
1005 }
1006
1007 static int
LexGetInteractiveChar(void)1008 LexGetInteractiveChar (void)
1009 {
1010 #ifdef HAVE_LIBREADLINE
1011 static char *line, *line_base;
1012 int c;
1013
1014 if (!line)
1015 {
1016 char *p;
1017
1018 p = StrzPart (prompt (), "invalid prompt");
1019 if (!p)
1020 p = "??? ";
1021 for (;;)
1022 {
1023 FileFlush (FileStdout, False);
1024 FileFlush (FileStderr, False);
1025 if (FileStdout->file.flags & FileOutputBlocked)
1026 ThreadsRun (0, FileStdout);
1027 else if (FileStderr->file.flags & FileOutputBlocked)
1028 ThreadsRun (0, FileStderr);
1029 else
1030 break;
1031 }
1032 rl_inhibit_completion = 1;
1033 line_base = readline (p);
1034 line = line_base;
1035 if (!line)
1036 return FileEOF;
1037 add_history (line_base);
1038 }
1039 c = (*line++) & 0xff;
1040 if (!c)
1041 {
1042 c = '\n';
1043 free (line_base);
1044 line = 0;
1045 }
1046 return c;
1047 #else
1048 if (lexInput->at_bol)
1049 {
1050 Value v = prompt ();
1051 Print (FileStdout, v, 's', 0, 0, 0, ' ');
1052 FileFlush (FileStdout, True);
1053 }
1054 return LexGetChar ();
1055 #endif
1056 }
1057
1058 #undef YY_INPUT
1059 #define YY_NO_UNPUT
1060
yy_input(char * buf,int max_size)1061 static int yy_input (char *buf, int max_size)
1062 {
1063 int c;
1064 int result = 0;
1065
1066 while (result < max_size) {
1067 if (lexInput->at_eof)
1068 {
1069 FileClose (lexInput->file);
1070 lexInput = lexInput->next;
1071 }
1072 if (lexInput->interactive)
1073 c = LexGetInteractiveChar ();
1074 else
1075 c = LexGetChar ();
1076 if (lexInput->at_bol) { lexInput->lineno++; }
1077 lexInput->at_bol = False;
1078 if (c < 0)
1079 break;
1080 buf[result++] = c;
1081 if (c == '\n')
1082 {
1083 lexInput->at_bol = True;
1084 break;
1085 }
1086 }
1087 return result;
1088 }
1089
1090 #define YY_INPUT(buf,result,max_size) ((result) = yy_input (buf, max_size))
1091
1092 #ifndef FLEX_SCANNER
1093 #undef input
1094 #undef unput
input(void)1095 int input (void)
1096 {
1097 char buf[1];
1098 int r;
1099
1100 YY_INPUT(buf, r, 1);
1101 if (r == 0)
1102 return 0;
1103 return buf[0];
1104 }
1105
unput(char c)1106 void unput (char c)
1107 {
1108 if (c == '\n')
1109 lexInput->lineno--;
1110 FileUnput (lexInput->file, c);
1111 }
1112 #endif
1113
1114 #line 1115 "lex.c"
1115 #line 1116 "lex.c"
1116
1117 #define INITIAL 0
1118
1119 #ifndef YY_NO_UNISTD_H
1120 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1121 * down here because we want the user's section 1 to have been scanned first.
1122 * The user has a chance to override it with an option.
1123 */
1124 #include <unistd.h>
1125 #endif
1126
1127 #ifndef YY_EXTRA_TYPE
1128 #define YY_EXTRA_TYPE void *
1129 #endif
1130
1131 static int yy_init_globals ( void );
1132
1133 /* Accessor methods to globals.
1134 These are made visible to non-reentrant scanners for convenience. */
1135
1136 int yylex_destroy ( void );
1137
1138 int yyget_debug ( void );
1139
1140 void yyset_debug ( int debug_flag );
1141
1142 YY_EXTRA_TYPE yyget_extra ( void );
1143
1144 void yyset_extra ( YY_EXTRA_TYPE user_defined );
1145
1146 FILE *yyget_in ( void );
1147
1148 void yyset_in ( FILE * _in_str );
1149
1150 FILE *yyget_out ( void );
1151
1152 void yyset_out ( FILE * _out_str );
1153
1154 int yyget_leng ( void );
1155
1156 char *yyget_text ( void );
1157
1158 int yyget_lineno ( void );
1159
1160 void yyset_lineno ( int _line_number );
1161
1162 /* Macros after this point can all be overridden by user definitions in
1163 * section 1.
1164 */
1165
1166 #ifndef YY_SKIP_YYWRAP
1167 #ifdef __cplusplus
1168 extern "C" int yywrap ( void );
1169 #else
1170 extern int yywrap ( void );
1171 #endif
1172 #endif
1173
1174 #ifndef YY_NO_UNPUT
1175
1176 static void yyunput ( int c, char *buf_ptr );
1177
1178 #endif
1179
1180 #ifndef yytext_ptr
1181 static void yy_flex_strncpy ( char *, const char *, int );
1182 #endif
1183
1184 #ifdef YY_NEED_STRLEN
1185 static int yy_flex_strlen ( const char * );
1186 #endif
1187
1188 #ifndef YY_NO_INPUT
1189 #ifdef __cplusplus
1190 static int yyinput ( void );
1191 #else
1192 static int input ( void );
1193 #endif
1194
1195 #endif
1196
1197 /* Amount of stuff to slurp up with each read. */
1198 #ifndef YY_READ_BUF_SIZE
1199 #ifdef __ia64__
1200 /* On IA-64, the buffer size is 16k, not 8k */
1201 #define YY_READ_BUF_SIZE 16384
1202 #else
1203 #define YY_READ_BUF_SIZE 8192
1204 #endif /* __ia64__ */
1205 #endif
1206
1207 /* Copy whatever the last rule matched to the standard output. */
1208 #ifndef ECHO
1209 /* This used to be an fputs(), but since the string might contain NUL's,
1210 * we now use fwrite().
1211 */
1212 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
1213 #endif
1214
1215 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1216 * is returned in "result".
1217 */
1218 #ifndef YY_INPUT
1219 #define YY_INPUT(buf,result,max_size) \
1220 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1221 { \
1222 int c = '*'; \
1223 int n; \
1224 for ( n = 0; n < max_size && \
1225 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1226 buf[n] = (char) c; \
1227 if ( c == '\n' ) \
1228 buf[n++] = (char) c; \
1229 if ( c == EOF && ferror( yyin ) ) \
1230 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1231 result = n; \
1232 } \
1233 else \
1234 { \
1235 errno=0; \
1236 while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
1237 { \
1238 if( errno != EINTR) \
1239 { \
1240 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1241 break; \
1242 } \
1243 errno=0; \
1244 clearerr(yyin); \
1245 } \
1246 }\
1247 \
1248
1249 #endif
1250
1251 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1252 * we don't want an extra ';' after the "return" because that will cause
1253 * some compilers to complain about unreachable statements.
1254 */
1255 #ifndef yyterminate
1256 #define yyterminate() return YY_NULL
1257 #endif
1258
1259 /* Number of entries by which start-condition stack grows. */
1260 #ifndef YY_START_STACK_INCR
1261 #define YY_START_STACK_INCR 25
1262 #endif
1263
1264 /* Report a fatal error. */
1265 #ifndef YY_FATAL_ERROR
1266 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1267 #endif
1268
1269 /* end tables serialization structures and prototypes */
1270
1271 /* Default declaration of generated scanner - a define so the user can
1272 * easily add parameters.
1273 */
1274 #ifndef YY_DECL
1275 #define YY_DECL_IS_OURS 1
1276
1277 extern int yylex (void);
1278
1279 #define YY_DECL int yylex (void)
1280 #endif /* !YY_DECL */
1281
1282 /* Code executed at the beginning of each rule, after yytext and yyleng
1283 * have been set up.
1284 */
1285 #ifndef YY_USER_ACTION
1286 #define YY_USER_ACTION
1287 #endif
1288
1289 /* Code executed at the end of each rule. */
1290 #ifndef YY_BREAK
1291 #define YY_BREAK /*LINTED*/break;
1292 #endif
1293
1294 #define YY_RULE_SETUP \
1295 if ( yyleng > 0 ) \
1296 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1297 (yytext[yyleng - 1] == '\n'); \
1298 YY_USER_ACTION
1299
1300 /** The main scanner function which does all the work.
1301 */
1302 YY_DECL
1303 {
1304 yy_state_type yy_current_state;
1305 char *yy_cp, *yy_bp;
1306 int yy_act;
1307
1308 if ( !(yy_init) )
1309 {
1310 (yy_init) = 1;
1311
1312 #ifdef YY_USER_INIT
1313 YY_USER_INIT;
1314 #endif
1315
1316 if ( ! (yy_start) )
1317 (yy_start) = 1; /* first start state */
1318
1319 if ( ! yyin )
1320 yyin = stdin;
1321
1322 if ( ! yyout )
1323 yyout = stdout;
1324
1325 if ( ! YY_CURRENT_BUFFER ) {
1326 yyensure_buffer_stack ();
1327 YY_CURRENT_BUFFER_LVALUE =
1328 yy_create_buffer( yyin, YY_BUF_SIZE );
1329 }
1330
1331 yy_load_buffer_state( );
1332 }
1333
1334 {
1335 #line 335 "lex.l"
1336
1337 #line 1338 "lex.c"
1338
1339 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1340 {
1341 yy_cp = (yy_c_buf_p);
1342
1343 /* Support of yytext. */
1344 *yy_cp = (yy_hold_char);
1345
1346 /* yy_bp points to the position in yy_ch_buf of the start of
1347 * the current run.
1348 */
1349 yy_bp = yy_cp;
1350
1351 yy_current_state = (yy_start);
1352 yy_current_state += YY_AT_BOL();
1353 yy_match:
1354 do
1355 {
1356 YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1357 if ( yy_accept[yy_current_state] )
1358 {
1359 (yy_last_accepting_state) = yy_current_state;
1360 (yy_last_accepting_cpos) = yy_cp;
1361 }
1362 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1363 {
1364 yy_current_state = (int) yy_def[yy_current_state];
1365 if ( yy_current_state >= 420 )
1366 yy_c = yy_meta[yy_c];
1367 }
1368 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1369 ++yy_cp;
1370 }
1371 while ( yy_base[yy_current_state] != 794 );
1372
1373 yy_find_action:
1374 yy_act = yy_accept[yy_current_state];
1375 if ( yy_act == 0 )
1376 { /* have to back up */
1377 yy_cp = (yy_last_accepting_cpos);
1378 yy_current_state = (yy_last_accepting_state);
1379 yy_act = yy_accept[yy_current_state];
1380 }
1381
1382 YY_DO_BEFORE_ACTION;
1383
1384 do_action: /* This label is used only to access EOF actions. */
1385
1386 switch ( yy_act )
1387 { /* beginning of action switch */
1388 case 0: /* must back up */
1389 /* undo the effects of YY_DO_BEFORE_ACTION */
1390 *yy_cp = (yy_hold_char);
1391 yy_cp = (yy_last_accepting_cpos);
1392 yy_current_state = (yy_last_accepting_state);
1393 goto yy_find_action;
1394
1395 case 1:
1396 YY_RULE_SETUP
1397 #line 336 "lex.l"
1398 {
1399 if (seeComment)
1400 {
1401 yylval.value = lexdoc ();
1402 return COMMENT_CONST;
1403 }
1404 else
1405 skipcomment ();
1406 }
1407 YY_BREAK
1408 case 2:
1409 YY_RULE_SETUP
1410 #line 345 "lex.l"
1411 skipline();
1412 YY_BREAK
1413 case 3:
1414 YY_RULE_SETUP
1415 #line 346 "lex.l"
1416 { yylval.class = class_auto; return AUTO; }
1417 YY_BREAK
1418 case 4:
1419 YY_RULE_SETUP
1420 #line 347 "lex.l"
1421 { yylval.class = class_const; return CONST; }
1422 YY_BREAK
1423 case 5:
1424 YY_RULE_SETUP
1425 #line 348 "lex.l"
1426 { yylval.class = class_global; return GLOBAL; }
1427 YY_BREAK
1428 case 6:
1429 YY_RULE_SETUP
1430 #line 349 "lex.l"
1431 { yylval.class = class_static; return STATIC; }
1432 YY_BREAK
1433 case 7:
1434 YY_RULE_SETUP
1435 #line 350 "lex.l"
1436 { yylval.type = typePrim[rep_void]; return FUNCTION; }
1437 YY_BREAK
1438 case 8:
1439 YY_RULE_SETUP
1440 #line 351 "lex.l"
1441 { yylval.ints = WHILE; return WHILE; }
1442 YY_BREAK
1443 case 9:
1444 YY_RULE_SETUP
1445 #line 352 "lex.l"
1446 { yylval.ints = FOR; return FOR; }
1447 YY_BREAK
1448 case 10:
1449 YY_RULE_SETUP
1450 #line 353 "lex.l"
1451 { yylval.ints = DO; return DO; }
1452 YY_BREAK
1453 case 11:
1454 YY_RULE_SETUP
1455 #line 354 "lex.l"
1456 { yylval.ints = IF; return IF; }
1457 YY_BREAK
1458 case 12:
1459 YY_RULE_SETUP
1460 #line 355 "lex.l"
1461 { yylval.ints = ELSE; return ELSE; }
1462 YY_BREAK
1463 case 13:
1464 YY_RULE_SETUP
1465 #line 356 "lex.l"
1466 { yylval.ints = SWITCH; return SWITCH; }
1467 YY_BREAK
1468 case 14:
1469 YY_RULE_SETUP
1470 #line 357 "lex.l"
1471 { yylval.ints = BREAK; return BREAK; }
1472 YY_BREAK
1473 case 15:
1474 YY_RULE_SETUP
1475 #line 358 "lex.l"
1476 { yylval.ints = CONTINUE; return CONTINUE; }
1477 YY_BREAK
1478 case 16:
1479 YY_RULE_SETUP
1480 #line 359 "lex.l"
1481 { yylval.ints = CASE; return CASE; }
1482 YY_BREAK
1483 case 17:
1484 YY_RULE_SETUP
1485 #line 360 "lex.l"
1486 { yylval.ints = DEFAULT; return DEFAULT; }
1487 YY_BREAK
1488 case 18:
1489 YY_RULE_SETUP
1490 #line 361 "lex.l"
1491 { yylval.ints = RETURNTOK; return RETURNTOK; }
1492 YY_BREAK
1493 case 19:
1494 YY_RULE_SETUP
1495 #line 362 "lex.l"
1496 { yylval.ints = TRY; return TRY; }
1497 YY_BREAK
1498 case 20:
1499 YY_RULE_SETUP
1500 #line 363 "lex.l"
1501 { yylval.ints = CATCH; return CATCH; }
1502 YY_BREAK
1503 case 21:
1504 YY_RULE_SETUP
1505 #line 364 "lex.l"
1506 { yylval.ints = TWIXT; return TWIXT; }
1507 YY_BREAK
1508 case 22:
1509 YY_RULE_SETUP
1510 #line 366 "lex.l"
1511 { yylval.type = typePoly; return POLY; }
1512 YY_BREAK
1513 case 23:
1514 YY_RULE_SETUP
1515 #line 367 "lex.l"
1516 { yylval.type = typePrim[rep_bool]; return BOOL; }
1517 YY_BREAK
1518 case 24:
1519 YY_RULE_SETUP
1520 #line 368 "lex.l"
1521 { yylval.type = typePrim[rep_integer]; return INTEGER; }
1522 YY_BREAK
1523 case 25:
1524 YY_RULE_SETUP
1525 #line 369 "lex.l"
1526 { yylval.type = typePrim[rep_rational]; return RATIONAL; }
1527 YY_BREAK
1528 case 26:
1529 YY_RULE_SETUP
1530 #line 370 "lex.l"
1531 { yylval.type = typePrim[rep_float]; return REAL; }
1532 YY_BREAK
1533 case 27:
1534 YY_RULE_SETUP
1535 #line 371 "lex.l"
1536 { yylval.type = typePrim[rep_string]; return STRING; }
1537 YY_BREAK
1538 case 28:
1539 YY_RULE_SETUP
1540 #line 372 "lex.l"
1541 { yylval.type = typePrim[rep_file]; return FILET; }
1542 YY_BREAK
1543 case 29:
1544 YY_RULE_SETUP
1545 #line 373 "lex.l"
1546 { yylval.type = typePrim[rep_semaphore]; return SEMAPHORE; }
1547 YY_BREAK
1548 case 30:
1549 YY_RULE_SETUP
1550 #line 374 "lex.l"
1551 { yylval.type = typePrim[rep_continuation]; return CONTINUATION; }
1552 YY_BREAK
1553 case 31:
1554 YY_RULE_SETUP
1555 #line 375 "lex.l"
1556 { yylval.type = typePrim[rep_thread]; return THREAD; }
1557 YY_BREAK
1558 case 32:
1559 YY_RULE_SETUP
1560 #line 376 "lex.l"
1561 { yylval.ints = STRUCT; return STRUCT; }
1562 YY_BREAK
1563 case 33:
1564 YY_RULE_SETUP
1565 #line 377 "lex.l"
1566 { yylval.ints = UNION; return UNION; }
1567 YY_BREAK
1568 case 34:
1569 YY_RULE_SETUP
1570 #line 378 "lex.l"
1571 { yylval.ints = ENUM; return ENUM; }
1572 YY_BREAK
1573 case 35:
1574 YY_RULE_SETUP
1575 #line 379 "lex.l"
1576 { yylval.type = typePrim[rep_void]; return VOID; }
1577 YY_BREAK
1578 case 36:
1579 YY_RULE_SETUP
1580 #line 380 "lex.l"
1581 { yylval.type = typePrim[rep_foreign]; return FOREIGN; }
1582 YY_BREAK
1583 case 37:
1584 YY_RULE_SETUP
1585 #line 381 "lex.l"
1586 { yylval.value = TrueVal; return BOOLVAL; }
1587 YY_BREAK
1588 case 38:
1589 YY_RULE_SETUP
1590 #line 382 "lex.l"
1591 { yylval.value = FalseVal; return BOOLVAL; }
1592 YY_BREAK
1593 case 39:
1594 YY_RULE_SETUP
1595 #line 384 "lex.l"
1596 { yylval.ints = TYPEDEF; return TYPEDEF; }
1597 YY_BREAK
1598 case 40:
1599 YY_RULE_SETUP
1600 #line 385 "lex.l"
1601 { yylval.ints = FUNC; return FUNC; }
1602 YY_BREAK
1603 case 41:
1604 YY_RULE_SETUP
1605 #line 386 "lex.l"
1606 { yylval.ints = FORK; return FORK; }
1607 YY_BREAK
1608 case 42:
1609 YY_RULE_SETUP
1610 #line 387 "lex.l"
1611 { yylval.ints = NAMESPACE; return NAMESPACE; }
1612 YY_BREAK
1613 case 43:
1614 YY_RULE_SETUP
1615 #line 388 "lex.l"
1616 { yylval.ints = IMPORT; return IMPORT; }
1617 YY_BREAK
1618 case 44:
1619 YY_RULE_SETUP
1620 #line 389 "lex.l"
1621 { yylval.ints = EXCEPTION; return EXCEPTION; }
1622 YY_BREAK
1623 case 45:
1624 YY_RULE_SETUP
1625 #line 390 "lex.l"
1626 { yylval.ints = RAISE; return RAISE; }
1627 YY_BREAK
1628 case 46:
1629 YY_RULE_SETUP
1630 #line 391 "lex.l"
1631 { yylval.publish = publish_protected; return PROTECTED; }
1632 YY_BREAK
1633 case 47:
1634 YY_RULE_SETUP
1635 #line 392 "lex.l"
1636 { yylval.publish = publish_public; return PUBLIC; }
1637 YY_BREAK
1638 case 48:
1639 YY_RULE_SETUP
1640 #line 393 "lex.l"
1641 { yylval.publish = publish_extend; return EXTEND; }
1642 YY_BREAK
1643 case 49:
1644 YY_RULE_SETUP
1645 #line 394 "lex.l"
1646 { yylval.ints = ISTYPE; return ISTYPE; }
1647 YY_BREAK
1648 case 50:
1649 YY_RULE_SETUP
1650 #line 395 "lex.l"
1651 { yylval.ints = HASMEMBER; return HASMEMBER; }
1652 YY_BREAK
1653 case 51:
1654 YY_RULE_SETUP
1655 #line 396 "lex.l"
1656 { yylval.ints = SEMI; return SEMI; }
1657 YY_BREAK
1658 case 52:
1659 YY_RULE_SETUP
1660 #line 397 "lex.l"
1661 { yylval.ints = COMMA; return COMMA; }
1662 YY_BREAK
1663 case 53:
1664 YY_RULE_SETUP
1665 #line 398 "lex.l"
1666 { yylval.ints = DOLLAR; return DOLLAR; }
1667 YY_BREAK
1668 case 54:
1669 YY_RULE_SETUP
1670 #line 399 "lex.l"
1671 { yylval.ints = DOTDOTDOT; return DOTDOTDOT; }
1672 YY_BREAK
1673 case 55:
1674 YY_RULE_SETUP
1675 #line 400 "lex.l"
1676 { yylval.ints = DOTDOTDOT; return DOTDOTDOT; }
1677 YY_BREAK
1678 case 56:
1679 YY_RULE_SETUP
1680 #line 401 "lex.l"
1681 { yylval.ints = DOT; return DOT; }
1682 YY_BREAK
1683 case 57:
1684 YY_RULE_SETUP
1685 #line 402 "lex.l"
1686 { yylval.ints = ARROW; return ARROW; }
1687 YY_BREAK
1688 case 58:
1689 YY_RULE_SETUP
1690 #line 403 "lex.l"
1691 { yylval.ints = ARROW; return ARROW; }
1692 YY_BREAK
1693 case 59:
1694 YY_RULE_SETUP
1695 #line 404 "lex.l"
1696 { yylval.ints = DARROW; return DARROW; }
1697 YY_BREAK
1698 case 60:
1699 YY_RULE_SETUP
1700 #line 405 "lex.l"
1701 { yylval.ints = DARROW; return DARROW; }
1702 YY_BREAK
1703 case 61:
1704 YY_RULE_SETUP
1705 #line 406 "lex.l"
1706 { yylval.value = Void; return VOIDVAL; }
1707 YY_BREAK
1708 case 62:
1709 YY_RULE_SETUP
1710 #line 407 "lex.l"
1711 { yylval.value = Void; return VOIDVAL; }
1712 YY_BREAK
1713 case 63:
1714 /* rule 63 can match eol */
1715 YY_RULE_SETUP
1716 #line 408 "lex.l"
1717 {
1718 if (lexInput->at_eof) { strcpy (yytext, "EOF"); yylval.ints = ENDFILE; return ENDFILE; }
1719 if (!ignorenl) { yylval.ints = NL; return NL; }
1720 }
1721 YY_BREAK
1722 case 64:
1723 YY_RULE_SETUP
1724 #line 412 "lex.l"
1725 { yylval.ints = OP; ++ignorenl; return OP; }
1726 YY_BREAK
1727 case 65:
1728 YY_RULE_SETUP
1729 #line 413 "lex.l"
1730 { yylval.ints = CP; if (ignorenl > 0) --ignorenl; return CP; }
1731 YY_BREAK
1732 case 66:
1733 YY_RULE_SETUP
1734 #line 414 "lex.l"
1735 { yylval.ints = STAROS; ++ignorenl; return STAROS; }
1736 YY_BREAK
1737 case 67:
1738 YY_RULE_SETUP
1739 #line 415 "lex.l"
1740 { yylval.ints = OS; ++ignorenl; return OS; }
1741 YY_BREAK
1742 case 68:
1743 YY_RULE_SETUP
1744 #line 416 "lex.l"
1745 { yylval.ints = CS; if (ignorenl > 0) --ignorenl; return CS; }
1746 YY_BREAK
1747 case 69:
1748 YY_RULE_SETUP
1749 #line 417 "lex.l"
1750 { yylval.ints = OC; ++ignorenl; return OC; }
1751 YY_BREAK
1752 case 70:
1753 YY_RULE_SETUP
1754 #line 418 "lex.l"
1755 { yylval.ints = CC; if (ignorenl > 0) --ignorenl; return CC; }
1756 YY_BREAK
1757 case 71:
1758 YY_RULE_SETUP
1759 #line 419 "lex.l"
1760 { yylval.ints = ASSIGNPLUS; return ASSIGNPLUS; }
1761 YY_BREAK
1762 case 72:
1763 YY_RULE_SETUP
1764 #line 420 "lex.l"
1765 { yylval.ints = ASSIGNMINUS; return ASSIGNMINUS; }
1766 YY_BREAK
1767 case 73:
1768 YY_RULE_SETUP
1769 #line 421 "lex.l"
1770 { yylval.ints = ASSIGNTIMES; return ASSIGNTIMES; }
1771 YY_BREAK
1772 case 74:
1773 YY_RULE_SETUP
1774 #line 422 "lex.l"
1775 { yylval.ints = ASSIGNTIMES; return ASSIGNTIMES; }
1776 YY_BREAK
1777 case 75:
1778 YY_RULE_SETUP
1779 #line 423 "lex.l"
1780 { yylval.ints = ASSIGNDIVIDE; return ASSIGNDIVIDE; }
1781 YY_BREAK
1782 case 76:
1783 YY_RULE_SETUP
1784 #line 424 "lex.l"
1785 { yylval.ints = ASSIGNDIVIDE; return ASSIGNDIVIDE; }
1786 YY_BREAK
1787 case 77:
1788 YY_RULE_SETUP
1789 #line 425 "lex.l"
1790 { yylval.ints = ASSIGNDIV; return ASSIGNDIV; }
1791 YY_BREAK
1792 case 78:
1793 YY_RULE_SETUP
1794 #line 426 "lex.l"
1795 { yylval.ints = ASSIGNDIV; return ASSIGNDIV; }
1796 YY_BREAK
1797 case 79:
1798 YY_RULE_SETUP
1799 #line 427 "lex.l"
1800 { yylval.ints = ASSIGNMOD; return ASSIGNMOD; }
1801 YY_BREAK
1802 case 80:
1803 YY_RULE_SETUP
1804 #line 428 "lex.l"
1805 { yylval.ints = ASSIGNPOW; return ASSIGNPOW; }
1806 YY_BREAK
1807 case 81:
1808 YY_RULE_SETUP
1809 #line 429 "lex.l"
1810 { yylval.ints = ASSIGNPOW; return ASSIGNPOW; }
1811 YY_BREAK
1812 case 82:
1813 YY_RULE_SETUP
1814 #line 430 "lex.l"
1815 { yylval.ints = ASSIGNSHIFTL; return ASSIGNSHIFTL; }
1816 YY_BREAK
1817 case 83:
1818 YY_RULE_SETUP
1819 #line 431 "lex.l"
1820 { yylval.ints = ASSIGNSHIFTL; return ASSIGNSHIFTL; }
1821 YY_BREAK
1822 case 84:
1823 YY_RULE_SETUP
1824 #line 432 "lex.l"
1825 { yylval.ints = ASSIGNSHIFTR; return ASSIGNSHIFTR; }
1826 YY_BREAK
1827 case 85:
1828 YY_RULE_SETUP
1829 #line 433 "lex.l"
1830 { yylval.ints = ASSIGNSHIFTR; return ASSIGNSHIFTR; }
1831 YY_BREAK
1832 case 86:
1833 YY_RULE_SETUP
1834 #line 434 "lex.l"
1835 { yylval.ints = ASSIGNLXOR; return ASSIGNLXOR; }
1836 YY_BREAK
1837 case 87:
1838 YY_RULE_SETUP
1839 #line 435 "lex.l"
1840 { yylval.ints = ASSIGNAND; return ASSIGNAND; }
1841 YY_BREAK
1842 case 88:
1843 YY_RULE_SETUP
1844 #line 436 "lex.l"
1845 { yylval.ints = ASSIGNOR; return ASSIGNOR; }
1846 YY_BREAK
1847 case 89:
1848 YY_RULE_SETUP
1849 #line 437 "lex.l"
1850 { yylval.ints = ASSIGNLAND; return ASSIGNLAND; }
1851 YY_BREAK
1852 case 90:
1853 YY_RULE_SETUP
1854 #line 438 "lex.l"
1855 { yylval.ints = ASSIGNLOR; return ASSIGNLOR; }
1856 YY_BREAK
1857 case 91:
1858 YY_RULE_SETUP
1859 #line 439 "lex.l"
1860 { yylval.ints = ASSIGN; return ASSIGN; }
1861 YY_BREAK
1862 case 92:
1863 YY_RULE_SETUP
1864 #line 441 "lex.l"
1865 { yylval.ints = PLUS; return PLUS; }
1866 YY_BREAK
1867 case 93:
1868 YY_RULE_SETUP
1869 #line 442 "lex.l"
1870 { yylval.ints = MINUS; return MINUS; }
1871 YY_BREAK
1872 case 94:
1873 YY_RULE_SETUP
1874 #line 443 "lex.l"
1875 { yylval.ints = TIMES; return TIMES; }
1876 YY_BREAK
1877 case 95:
1878 YY_RULE_SETUP
1879 #line 444 "lex.l"
1880 { yylval.ints = TIMES; return TIMES; }
1881 YY_BREAK
1882 case 96:
1883 YY_RULE_SETUP
1884 #line 445 "lex.l"
1885 { yylval.ints = DIVIDE; return DIVIDE; }
1886 YY_BREAK
1887 case 97:
1888 YY_RULE_SETUP
1889 #line 446 "lex.l"
1890 { yylval.ints = DIVIDE; return DIVIDE; }
1891 YY_BREAK
1892 case 98:
1893 YY_RULE_SETUP
1894 #line 447 "lex.l"
1895 { yylval.ints = DIV; return DIV; }
1896 YY_BREAK
1897 case 99:
1898 YY_RULE_SETUP
1899 #line 448 "lex.l"
1900 { yylval.ints = DIV; return DIV; }
1901 YY_BREAK
1902 case 100:
1903 YY_RULE_SETUP
1904 #line 449 "lex.l"
1905 { yylval.ints = STARSTAR; return STARSTAR; }
1906 YY_BREAK
1907 case 101:
1908 YY_RULE_SETUP
1909 #line 450 "lex.l"
1910 { yylval.ints = STARSTAR; return STARSTAR; }
1911 YY_BREAK
1912 case 102:
1913 YY_RULE_SETUP
1914 #line 451 "lex.l"
1915 { yylval.ints = MOD; return MOD; }
1916 YY_BREAK
1917 case 103:
1918 YY_RULE_SETUP
1919 #line 452 "lex.l"
1920 { yylval.ints = BANG; return BANG; }
1921 YY_BREAK
1922 case 104:
1923 YY_RULE_SETUP
1924 #line 453 "lex.l"
1925 { yylval.ints = POUND; return POUND; }
1926 YY_BREAK
1927 case 105:
1928 YY_RULE_SETUP
1929 #line 454 "lex.l"
1930 { yylval.ints = LAND; return LAND; }
1931 YY_BREAK
1932 case 106:
1933 YY_RULE_SETUP
1934 #line 455 "lex.l"
1935 { yylval.ints = LOR; return LOR; }
1936 YY_BREAK
1937 case 107:
1938 YY_RULE_SETUP
1939 #line 456 "lex.l"
1940 { yylval.ints = LXOR; return LXOR; }
1941 YY_BREAK
1942 case 108:
1943 YY_RULE_SETUP
1944 #line 457 "lex.l"
1945 { yylval.ints = LNOT; return LNOT; }
1946 YY_BREAK
1947 case 109:
1948 YY_RULE_SETUP
1949 #line 458 "lex.l"
1950 { yylval.ints = LNOT; return LNOT; }
1951 YY_BREAK
1952 case 110:
1953 YY_RULE_SETUP
1954 #line 459 "lex.l"
1955 { yylval.ints = INC; return INC; }
1956 YY_BREAK
1957 case 111:
1958 YY_RULE_SETUP
1959 #line 460 "lex.l"
1960 { yylval.ints = INC; return INC; }
1961 YY_BREAK
1962 case 112:
1963 YY_RULE_SETUP
1964 #line 461 "lex.l"
1965 { yylval.ints = DEC; return DEC; }
1966 YY_BREAK
1967 case 113:
1968 YY_RULE_SETUP
1969 #line 462 "lex.l"
1970 { yylval.ints = EQ; return EQ; }
1971 YY_BREAK
1972 case 114:
1973 YY_RULE_SETUP
1974 #line 463 "lex.l"
1975 { yylval.ints = NE; return NE; }
1976 YY_BREAK
1977 case 115:
1978 YY_RULE_SETUP
1979 #line 464 "lex.l"
1980 { yylval.ints = NE; return NE; }
1981 YY_BREAK
1982 case 116:
1983 YY_RULE_SETUP
1984 #line 465 "lex.l"
1985 { yylval.ints = LT; return LT; }
1986 YY_BREAK
1987 case 117:
1988 YY_RULE_SETUP
1989 #line 466 "lex.l"
1990 { yylval.ints = GT; return GT; }
1991 YY_BREAK
1992 case 118:
1993 YY_RULE_SETUP
1994 #line 467 "lex.l"
1995 { yylval.ints = LE; return LE; }
1996 YY_BREAK
1997 case 119:
1998 YY_RULE_SETUP
1999 #line 468 "lex.l"
2000 { yylval.ints = LE; return LE; }
2001 YY_BREAK
2002 case 120:
2003 YY_RULE_SETUP
2004 #line 469 "lex.l"
2005 { yylval.ints = GE; return GE; }
2006 YY_BREAK
2007 case 121:
2008 YY_RULE_SETUP
2009 #line 470 "lex.l"
2010 { yylval.ints = GE; return GE; }
2011 YY_BREAK
2012 case 122:
2013 YY_RULE_SETUP
2014 #line 471 "lex.l"
2015 { yylval.ints = AND; return AND; }
2016 YY_BREAK
2017 case 123:
2018 YY_RULE_SETUP
2019 #line 472 "lex.l"
2020 { yylval.ints = AND; return AND; }
2021 YY_BREAK
2022 case 124:
2023 YY_RULE_SETUP
2024 #line 473 "lex.l"
2025 { yylval.ints = OR; return OR; }
2026 YY_BREAK
2027 case 125:
2028 YY_RULE_SETUP
2029 #line 474 "lex.l"
2030 { yylval.ints = OR; return OR; }
2031 YY_BREAK
2032 case 126:
2033 YY_RULE_SETUP
2034 #line 475 "lex.l"
2035 { yylval.ints = SHIFTL; return SHIFTL; }
2036 YY_BREAK
2037 case 127:
2038 YY_RULE_SETUP
2039 #line 476 "lex.l"
2040 { yylval.ints = SHIFTL; return SHIFTL; }
2041 YY_BREAK
2042 case 128:
2043 YY_RULE_SETUP
2044 #line 477 "lex.l"
2045 { yylval.ints = SHIFTR; return SHIFTR; }
2046 YY_BREAK
2047 case 129:
2048 YY_RULE_SETUP
2049 #line 478 "lex.l"
2050 { yylval.ints = SHIFTR; return SHIFTR; }
2051 YY_BREAK
2052 case 130:
2053 YY_RULE_SETUP
2054 #line 479 "lex.l"
2055 { yylval.ints = QUEST; return QUEST; }
2056 YY_BREAK
2057 case 131:
2058 YY_RULE_SETUP
2059 #line 480 "lex.l"
2060 { yylval.ints = COLONCOLON; return COLONCOLON; }
2061 YY_BREAK
2062 case 132:
2063 YY_RULE_SETUP
2064 #line 481 "lex.l"
2065 { yylval.ints = COLON; return COLON; }
2066 YY_BREAK
2067 case 133:
2068 YY_RULE_SETUP
2069 #line 482 "lex.l"
2070 { yylval.ints = POW2; return POW2; }
2071 YY_BREAK
2072 case 134:
2073 YY_RULE_SETUP
2074 #line 483 "lex.l"
2075 { yylval.ints = POW3; return POW3; }
2076 YY_BREAK
2077 case 135:
2078 YY_RULE_SETUP
2079 #line 484 "lex.l"
2080 ;
2081 YY_BREAK
2082 case 136:
2083 YY_RULE_SETUP
2084 #line 485 "lex.l"
2085 ;
2086 YY_BREAK
2087 case 137:
2088 YY_RULE_SETUP
2089 #line 486 "lex.l"
2090 ;
2091 YY_BREAK
2092 case 138:
2093 YY_RULE_SETUP
2094 #line 487 "lex.l"
2095 {
2096 ENTER ();
2097 char *s;
2098 long len = yyleng - 1;
2099 unsigned c;
2100
2101 s = yytext + 1;
2102 s = StringNextChar (s, &c, &len);
2103 if (c == '\\')
2104 {
2105 if (!(s = StringNextChar (s, &c, &len)))
2106 c = 0;
2107 else if ('0' <= c && c <= '7')
2108 {
2109 unsigned ch;
2110 char *ps = s;
2111
2112 c = c - '0';
2113 while ((s = StringNextChar (s, &ch, &len)) &&
2114 '0' <= ch && ch <= '7')
2115 {
2116 c = (c << 3) | (ch - '0');
2117 ps = s;
2118 }
2119 s = ps;
2120 }
2121 else
2122 c = lexEscape (c);
2123 }
2124 yylval.value = NewInt (c);
2125 EXIT ();
2126 REFERENCE (yylval.value);
2127 return CHAR_CONST;
2128 }
2129 YY_BREAK
2130 case 139:
2131 YY_RULE_SETUP
2132 #line 521 "lex.l"
2133 {
2134 ENTER ();
2135 char *d, *s;
2136 unsigned c;
2137 long len = yyleng - 2;
2138
2139 yylval.value = NewString (len);
2140 d = StringChars (&yylval.value->string);
2141 s = yytext + 1;
2142 while ((s = StringNextChar (s, &c, &len)))
2143 {
2144 if (c == '\\')
2145 {
2146 if (!(s = StringNextChar (s, &c, &len)))
2147 break;
2148 if ('0' <= c && c <= '7')
2149 {
2150 unsigned ch;
2151 char *ps = s;
2152 long plen = len;
2153
2154 c = c - '0';
2155 while ((s = StringNextChar (s, &ch, &len)) &&
2156 '0' <= ch && ch <= '7')
2157 {
2158 c = (c << 3) | (ch - '0');
2159 ps = s;
2160 plen = len;
2161 }
2162 s = ps;
2163 len = plen;
2164 }
2165 else
2166 c = lexEscape (c);
2167 }
2168 d += StringPutChar (c, d);
2169 }
2170 *d = '\0';
2171 yylval.value->string.length = d - StringChars(&yylval.value->string);
2172 EXIT ();
2173 REFERENCE (yylval.value);
2174 return STRING_CONST;
2175 }
2176 YY_BREAK
2177 case 140:
2178 YY_RULE_SETUP
2179 #line 564 "lex.l"
2180 {
2181 yylval.value = Zero;
2182 return TEN_NUM;
2183 }
2184 YY_BREAK
2185 case 141:
2186 YY_RULE_SETUP
2187 #line 568 "lex.l"
2188 {
2189 yylval.value = atov(yytext+1, 8);
2190 return OCTAL0_NUM;
2191 }
2192 YY_BREAK
2193 case 142:
2194 YY_RULE_SETUP
2195 #line 572 "lex.l"
2196 {
2197 yylval.value = atov(yytext+2, 8);
2198 return OCTAL_NUM;
2199 }
2200 YY_BREAK
2201 case 143:
2202 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2203 (yy_c_buf_p) = yy_cp -= 3;
2204 YY_DO_BEFORE_ACTION; /* set up yytext again */
2205 YY_RULE_SETUP
2206 #line 576 "lex.l"
2207 {
2208 yylval.value = aetov(yytext+2, 8);
2209 return OCTAL_FLOAT;
2210 }
2211 YY_BREAK
2212 case 144:
2213 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2214 (yy_c_buf_p) = yy_cp -= 2;
2215 YY_DO_BEFORE_ACTION; /* set up yytext again */
2216 YY_RULE_SETUP
2217 #line 580 "lex.l"
2218 {
2219 yylval.value = atov(yytext+2, 8);
2220 return OCTAL_NUM;
2221 }
2222 YY_BREAK
2223 case 145:
2224 YY_RULE_SETUP
2225 #line 584 "lex.l"
2226 {
2227 yylval.value = aetov (yytext+2, 8);
2228 return OCTAL_FLOAT;
2229 }
2230 YY_BREAK
2231 case 146:
2232 YY_RULE_SETUP
2233 #line 588 "lex.l"
2234 {
2235 yylval.value = atov(yytext+2, 2);
2236 return BINARY_NUM;
2237 }
2238 YY_BREAK
2239 case 147:
2240 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2241 (yy_c_buf_p) = yy_cp -= 3;
2242 YY_DO_BEFORE_ACTION; /* set up yytext again */
2243 YY_RULE_SETUP
2244 #line 592 "lex.l"
2245 {
2246 yylval.value = aetov(yytext+2, 2);
2247 return BINARY_FLOAT;
2248 }
2249 YY_BREAK
2250 case 148:
2251 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2252 (yy_c_buf_p) = yy_cp -= 2;
2253 YY_DO_BEFORE_ACTION; /* set up yytext again */
2254 YY_RULE_SETUP
2255 #line 596 "lex.l"
2256 {
2257 yylval.value = atov(yytext+2, 2);
2258 return BINARY_NUM;
2259 }
2260 YY_BREAK
2261 case 149:
2262 YY_RULE_SETUP
2263 #line 600 "lex.l"
2264 {
2265 yylval.value = aetov (yytext+2, 2);
2266 return BINARY_FLOAT;
2267 }
2268 YY_BREAK
2269 case 150:
2270 YY_RULE_SETUP
2271 #line 604 "lex.l"
2272 {
2273 yylval.value = atov(yytext+2, 16);
2274 return HEX_NUM;
2275 }
2276 YY_BREAK
2277 case 151:
2278 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2279 (yy_c_buf_p) = yy_cp -= 3;
2280 YY_DO_BEFORE_ACTION; /* set up yytext again */
2281 YY_RULE_SETUP
2282 #line 608 "lex.l"
2283 {
2284 yylval.value = aetov(yytext+2, 16);
2285 return HEX_FLOAT;
2286 }
2287 YY_BREAK
2288 case 152:
2289 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2290 (yy_c_buf_p) = yy_cp -= 2;
2291 YY_DO_BEFORE_ACTION; /* set up yytext again */
2292 YY_RULE_SETUP
2293 #line 612 "lex.l"
2294 {
2295 yylval.value = atov(yytext+2, 16);
2296 return HEX_NUM;
2297 }
2298 YY_BREAK
2299 case 153:
2300 YY_RULE_SETUP
2301 #line 616 "lex.l"
2302 {
2303 yylval.value = aetov (yytext+2, 16);
2304 return HEX_FLOAT;
2305 }
2306 YY_BREAK
2307 case 154:
2308 YY_RULE_SETUP
2309 #line 620 "lex.l"
2310 {
2311 yylval.value = atov(yytext, 10);
2312 return TEN_NUM;
2313 }
2314 YY_BREAK
2315 case 155:
2316 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2317 (yy_c_buf_p) = yy_cp -= 3;
2318 YY_DO_BEFORE_ACTION; /* set up yytext again */
2319 YY_RULE_SETUP
2320 #line 624 "lex.l"
2321 {
2322 yylval.value = aetov(yytext, 10);
2323 return TEN_FLOAT;
2324 }
2325 YY_BREAK
2326 case 156:
2327 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
2328 (yy_c_buf_p) = yy_cp -= 2;
2329 YY_DO_BEFORE_ACTION; /* set up yytext again */
2330 YY_RULE_SETUP
2331 #line 628 "lex.l"
2332 {
2333 yylval.value = atov(yytext, 10);
2334 return TEN_NUM;
2335 }
2336 YY_BREAK
2337 case 157:
2338 YY_RULE_SETUP
2339 #line 632 "lex.l"
2340 {
2341 yylval.value = aetov (yytext, 10);
2342 return TEN_FLOAT;
2343 }
2344 YY_BREAK
2345 case 158:
2346 YY_RULE_SETUP
2347 #line 636 "lex.l"
2348 {
2349 CommandPtr c;
2350 SymbolPtr symbol;
2351 yylval.atom = AtomId (yytext);
2352 if (!notCommand && (c = CommandFind (CurrentCommands, yylval.atom)))
2353 {
2354 if (c->names)
2355 return NAMECOMMAND;
2356 return COMMAND;
2357 }
2358 if (LexNamespace)
2359 symbol = NamespaceFindName (LexNamespace, yylval.atom, False);
2360 else
2361 symbol = NamespaceFindName (CurrentNamespace, yylval.atom, True);
2362 if (symbol)
2363 {
2364 switch (symbol->symbol.class) {
2365 case class_namespace:
2366 return NAMESPACENAME;
2367 case class_typedef:
2368 return TYPENAME;
2369 default:
2370 break;
2371 }
2372 }
2373 return NAME;
2374 }
2375 YY_BREAK
2376 case 159:
2377 YY_RULE_SETUP
2378 #line 663 "lex.l"
2379 FilePrintf (FileStderr, "character \\%o ignored\n", *yytext & 0xff);
2380 YY_BREAK
2381 case 160:
2382 YY_RULE_SETUP
2383 #line 664 "lex.l"
2384 ECHO;
2385 YY_BREAK
2386 #line 2387 "lex.c"
2387 case YY_STATE_EOF(INITIAL):
2388 yyterminate();
2389
2390 case YY_END_OF_BUFFER:
2391 {
2392 /* Amount of text matched not including the EOB char. */
2393 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
2394
2395 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2396 *yy_cp = (yy_hold_char);
2397 YY_RESTORE_YY_MORE_OFFSET
2398
2399 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2400 {
2401 /* We're scanning a new file or input source. It's
2402 * possible that this happened because the user
2403 * just pointed yyin at a new source and called
2404 * yylex(). If so, then we have to assure
2405 * consistency between YY_CURRENT_BUFFER and our
2406 * globals. Here is the right place to do so, because
2407 * this is the first action (other than possibly a
2408 * back-up) that will match for the new input source.
2409 */
2410 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2411 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
2412 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
2413 }
2414
2415 /* Note that here we test for yy_c_buf_p "<=" to the position
2416 * of the first EOB in the buffer, since yy_c_buf_p will
2417 * already have been incremented past the NUL character
2418 * (since all states make transitions on EOB to the
2419 * end-of-buffer state). Contrast this with the test
2420 * in input().
2421 */
2422 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2423 { /* This was really a NUL. */
2424 yy_state_type yy_next_state;
2425
2426 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2427
2428 yy_current_state = yy_get_previous_state( );
2429
2430 /* Okay, we're now positioned to make the NUL
2431 * transition. We couldn't have
2432 * yy_get_previous_state() go ahead and do it
2433 * for us because it doesn't know how to deal
2434 * with the possibility of jamming (and we don't
2435 * want to build jamming into it because then it
2436 * will run more slowly).
2437 */
2438
2439 yy_next_state = yy_try_NUL_trans( yy_current_state );
2440
2441 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2442
2443 if ( yy_next_state )
2444 {
2445 /* Consume the NUL. */
2446 yy_cp = ++(yy_c_buf_p);
2447 yy_current_state = yy_next_state;
2448 goto yy_match;
2449 }
2450
2451 else
2452 {
2453 yy_cp = (yy_c_buf_p);
2454 goto yy_find_action;
2455 }
2456 }
2457
2458 else switch ( yy_get_next_buffer( ) )
2459 {
2460 case EOB_ACT_END_OF_FILE:
2461 {
2462 (yy_did_buffer_switch_on_eof) = 0;
2463
2464 if ( yywrap( ) )
2465 {
2466 /* Note: because we've taken care in
2467 * yy_get_next_buffer() to have set up
2468 * yytext, we can now set up
2469 * yy_c_buf_p so that if some total
2470 * hoser (like flex itself) wants to
2471 * call the scanner after we return the
2472 * YY_NULL, it'll still work - another
2473 * YY_NULL will get returned.
2474 */
2475 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
2476
2477 yy_act = YY_STATE_EOF(YY_START);
2478 goto do_action;
2479 }
2480
2481 else
2482 {
2483 if ( ! (yy_did_buffer_switch_on_eof) )
2484 YY_NEW_FILE;
2485 }
2486 break;
2487 }
2488
2489 case EOB_ACT_CONTINUE_SCAN:
2490 (yy_c_buf_p) =
2491 (yytext_ptr) + yy_amount_of_matched_text;
2492
2493 yy_current_state = yy_get_previous_state( );
2494
2495 yy_cp = (yy_c_buf_p);
2496 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2497 goto yy_match;
2498
2499 case EOB_ACT_LAST_MATCH:
2500 (yy_c_buf_p) =
2501 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
2502
2503 yy_current_state = yy_get_previous_state( );
2504
2505 yy_cp = (yy_c_buf_p);
2506 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2507 goto yy_find_action;
2508 }
2509 break;
2510 }
2511
2512 default:
2513 YY_FATAL_ERROR(
2514 "fatal flex scanner internal error--no action found" );
2515 } /* end of action switch */
2516 } /* end of scanning one token */
2517 } /* end of user's declarations */
2518 } /* end of yylex */
2519
2520 /* yy_get_next_buffer - try to read in a new buffer
2521 *
2522 * Returns a code representing an action:
2523 * EOB_ACT_LAST_MATCH -
2524 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2525 * EOB_ACT_END_OF_FILE - end of file
2526 */
yy_get_next_buffer(void)2527 static int yy_get_next_buffer (void)
2528 {
2529 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2530 char *source = (yytext_ptr);
2531 int number_to_move, i;
2532 int ret_val;
2533
2534 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2535 YY_FATAL_ERROR(
2536 "fatal flex scanner internal error--end of buffer missed" );
2537
2538 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2539 { /* Don't try to fill the buffer, so this is an EOF. */
2540 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2541 {
2542 /* We matched a single character, the EOB, so
2543 * treat this as a final EOF.
2544 */
2545 return EOB_ACT_END_OF_FILE;
2546 }
2547
2548 else
2549 {
2550 /* We matched some text prior to the EOB, first
2551 * process it.
2552 */
2553 return EOB_ACT_LAST_MATCH;
2554 }
2555 }
2556
2557 /* Try to read more data. */
2558
2559 /* First move last chars to start of buffer. */
2560 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
2561
2562 for ( i = 0; i < number_to_move; ++i )
2563 *(dest++) = *(source++);
2564
2565 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2566 /* don't do the read, it's not guaranteed to return an EOF,
2567 * just force an EOF
2568 */
2569 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2570
2571 else
2572 {
2573 int num_to_read =
2574 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2575
2576 while ( num_to_read <= 0 )
2577 { /* Not enough room in the buffer - grow it. */
2578
2579 /* just a shorter name for the current buffer */
2580 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
2581
2582 int yy_c_buf_p_offset =
2583 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2584
2585 if ( b->yy_is_our_buffer )
2586 {
2587 int new_size = b->yy_buf_size * 2;
2588
2589 if ( new_size <= 0 )
2590 b->yy_buf_size += b->yy_buf_size / 8;
2591 else
2592 b->yy_buf_size *= 2;
2593
2594 b->yy_ch_buf = (char *)
2595 /* Include room in for 2 EOB chars. */
2596 yyrealloc( (void *) b->yy_ch_buf,
2597 (yy_size_t) (b->yy_buf_size + 2) );
2598 }
2599 else
2600 /* Can't grow it, we don't own it. */
2601 b->yy_ch_buf = NULL;
2602
2603 if ( ! b->yy_ch_buf )
2604 YY_FATAL_ERROR(
2605 "fatal error - scanner input buffer overflow" );
2606
2607 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2608
2609 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2610 number_to_move - 1;
2611
2612 }
2613
2614 if ( num_to_read > YY_READ_BUF_SIZE )
2615 num_to_read = YY_READ_BUF_SIZE;
2616
2617 /* Read in more data. */
2618 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2619 (yy_n_chars), num_to_read );
2620
2621 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2622 }
2623
2624 if ( (yy_n_chars) == 0 )
2625 {
2626 if ( number_to_move == YY_MORE_ADJ )
2627 {
2628 ret_val = EOB_ACT_END_OF_FILE;
2629 yyrestart( yyin );
2630 }
2631
2632 else
2633 {
2634 ret_val = EOB_ACT_LAST_MATCH;
2635 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2636 YY_BUFFER_EOF_PENDING;
2637 }
2638 }
2639
2640 else
2641 ret_val = EOB_ACT_CONTINUE_SCAN;
2642
2643 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
2644 /* Extend the array by 50%, plus the number we really need. */
2645 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
2646 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
2647 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
2648 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2649 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2650 /* "- 2" to take care of EOB's */
2651 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
2652 }
2653
2654 (yy_n_chars) += number_to_move;
2655 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
2656 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
2657
2658 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2659
2660 return ret_val;
2661 }
2662
2663 /* yy_get_previous_state - get the state just before the EOB char was reached */
2664
yy_get_previous_state(void)2665 static yy_state_type yy_get_previous_state (void)
2666 {
2667 yy_state_type yy_current_state;
2668 char *yy_cp;
2669
2670 yy_current_state = (yy_start);
2671 yy_current_state += YY_AT_BOL();
2672
2673 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2674 {
2675 YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2676 if ( yy_accept[yy_current_state] )
2677 {
2678 (yy_last_accepting_state) = yy_current_state;
2679 (yy_last_accepting_cpos) = yy_cp;
2680 }
2681 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2682 {
2683 yy_current_state = (int) yy_def[yy_current_state];
2684 if ( yy_current_state >= 420 )
2685 yy_c = yy_meta[yy_c];
2686 }
2687 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2688 }
2689
2690 return yy_current_state;
2691 }
2692
2693 /* yy_try_NUL_trans - try to make a transition on the NUL character
2694 *
2695 * synopsis
2696 * next_state = yy_try_NUL_trans( current_state );
2697 */
yy_try_NUL_trans(yy_state_type yy_current_state)2698 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
2699 {
2700 int yy_is_jam;
2701 char *yy_cp = (yy_c_buf_p);
2702
2703 YY_CHAR yy_c = 1;
2704 if ( yy_accept[yy_current_state] )
2705 {
2706 (yy_last_accepting_state) = yy_current_state;
2707 (yy_last_accepting_cpos) = yy_cp;
2708 }
2709 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2710 {
2711 yy_current_state = (int) yy_def[yy_current_state];
2712 if ( yy_current_state >= 420 )
2713 yy_c = yy_meta[yy_c];
2714 }
2715 yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
2716 yy_is_jam = (yy_current_state == 419);
2717
2718 return yy_is_jam ? 0 : yy_current_state;
2719 }
2720
2721 #ifndef YY_NO_UNPUT
2722
yyunput(int c,char * yy_bp)2723 static void yyunput (int c, char * yy_bp )
2724 {
2725 char *yy_cp;
2726
2727 yy_cp = (yy_c_buf_p);
2728
2729 /* undo effects of setting up yytext */
2730 *yy_cp = (yy_hold_char);
2731
2732 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2733 { /* need to shift things up to make room */
2734 /* +2 for EOB chars. */
2735 int number_to_move = (yy_n_chars) + 2;
2736 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
2737 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
2738 char *source =
2739 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
2740
2741 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2742 *--dest = *--source;
2743
2744 yy_cp += (int) (dest - source);
2745 yy_bp += (int) (dest - source);
2746 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
2747 (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
2748
2749 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
2750 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2751 }
2752
2753 *--yy_cp = (char) c;
2754
2755 (yytext_ptr) = yy_bp;
2756 (yy_hold_char) = *yy_cp;
2757 (yy_c_buf_p) = yy_cp;
2758 }
2759
2760 #endif
2761
2762 #ifndef YY_NO_INPUT
2763 #ifdef __cplusplus
yyinput(void)2764 static int yyinput (void)
2765 #else
2766 static int input (void)
2767 #endif
2768
2769 {
2770 int c;
2771
2772 *(yy_c_buf_p) = (yy_hold_char);
2773
2774 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2775 {
2776 /* yy_c_buf_p now points to the character we want to return.
2777 * If this occurs *before* the EOB characters, then it's a
2778 * valid NUL; if not, then we've hit the end of the buffer.
2779 */
2780 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
2781 /* This was really a NUL. */
2782 *(yy_c_buf_p) = '\0';
2783
2784 else
2785 { /* need more input */
2786 int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
2787 ++(yy_c_buf_p);
2788
2789 switch ( yy_get_next_buffer( ) )
2790 {
2791 case EOB_ACT_LAST_MATCH:
2792 /* This happens because yy_g_n_b()
2793 * sees that we've accumulated a
2794 * token and flags that we need to
2795 * try matching the token before
2796 * proceeding. But for input(),
2797 * there's no matching to consider.
2798 * So convert the EOB_ACT_LAST_MATCH
2799 * to EOB_ACT_END_OF_FILE.
2800 */
2801
2802 /* Reset buffer status. */
2803 yyrestart( yyin );
2804
2805 /*FALLTHROUGH*/
2806
2807 case EOB_ACT_END_OF_FILE:
2808 {
2809 if ( yywrap( ) )
2810 return 0;
2811
2812 if ( ! (yy_did_buffer_switch_on_eof) )
2813 YY_NEW_FILE;
2814 #ifdef __cplusplus
2815 return yyinput();
2816 #else
2817 return input();
2818 #endif
2819 }
2820
2821 case EOB_ACT_CONTINUE_SCAN:
2822 (yy_c_buf_p) = (yytext_ptr) + offset;
2823 break;
2824 }
2825 }
2826 }
2827
2828 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
2829 *(yy_c_buf_p) = '\0'; /* preserve yytext */
2830 (yy_hold_char) = *++(yy_c_buf_p);
2831
2832 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
2833
2834 return c;
2835 }
2836 #endif /* ifndef YY_NO_INPUT */
2837
2838 /** Immediately switch to a different input stream.
2839 * @param input_file A readable stream.
2840 *
2841 * @note This function does not reset the start condition to @c INITIAL .
2842 */
yyrestart(FILE * input_file)2843 void yyrestart (FILE * input_file )
2844 {
2845
2846 if ( ! YY_CURRENT_BUFFER ){
2847 yyensure_buffer_stack ();
2848 YY_CURRENT_BUFFER_LVALUE =
2849 yy_create_buffer( yyin, YY_BUF_SIZE );
2850 }
2851
2852 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
2853 yy_load_buffer_state( );
2854 }
2855
2856 /** Switch to a different input buffer.
2857 * @param new_buffer The new input buffer.
2858 *
2859 */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)2860 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
2861 {
2862
2863 /* TODO. We should be able to replace this entire function body
2864 * with
2865 * yypop_buffer_state();
2866 * yypush_buffer_state(new_buffer);
2867 */
2868 yyensure_buffer_stack ();
2869 if ( YY_CURRENT_BUFFER == new_buffer )
2870 return;
2871
2872 if ( YY_CURRENT_BUFFER )
2873 {
2874 /* Flush out information for old buffer. */
2875 *(yy_c_buf_p) = (yy_hold_char);
2876 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2877 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2878 }
2879
2880 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2881 yy_load_buffer_state( );
2882
2883 /* We don't actually know whether we did this switch during
2884 * EOF (yywrap()) processing, but the only time this flag
2885 * is looked at is after yywrap() is called, so it's safe
2886 * to go ahead and always set it.
2887 */
2888 (yy_did_buffer_switch_on_eof) = 1;
2889 }
2890
yy_load_buffer_state(void)2891 static void yy_load_buffer_state (void)
2892 {
2893 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2894 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2895 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2896 (yy_hold_char) = *(yy_c_buf_p);
2897 }
2898
2899 /** Allocate and initialize an input buffer state.
2900 * @param file A readable stream.
2901 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2902 *
2903 * @return the allocated buffer state.
2904 */
yy_create_buffer(FILE * file,int size)2905 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
2906 {
2907 YY_BUFFER_STATE b;
2908
2909 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
2910 if ( ! b )
2911 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2912
2913 b->yy_buf_size = size;
2914
2915 /* yy_ch_buf has to be 2 characters longer than the size given because
2916 * we need to put in 2 end-of-buffer characters.
2917 */
2918 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
2919 if ( ! b->yy_ch_buf )
2920 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2921
2922 b->yy_is_our_buffer = 1;
2923
2924 yy_init_buffer( b, file );
2925
2926 return b;
2927 }
2928
2929 /** Destroy the buffer.
2930 * @param b a buffer created with yy_create_buffer()
2931 *
2932 */
yy_delete_buffer(YY_BUFFER_STATE b)2933 void yy_delete_buffer (YY_BUFFER_STATE b )
2934 {
2935
2936 if ( ! b )
2937 return;
2938
2939 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2940 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2941
2942 if ( b->yy_is_our_buffer )
2943 yyfree( (void *) b->yy_ch_buf );
2944
2945 yyfree( (void *) b );
2946 }
2947
2948 /* Initializes or reinitializes a buffer.
2949 * This function is sometimes called more than once on the same buffer,
2950 * such as during a yyrestart() or at EOF.
2951 */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)2952 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
2953
2954 {
2955 int oerrno = errno;
2956
2957 yy_flush_buffer( b );
2958
2959 b->yy_input_file = file;
2960 b->yy_fill_buffer = 1;
2961
2962 /* If b is the current buffer, then yy_init_buffer was _probably_
2963 * called from yyrestart() or through yy_get_next_buffer.
2964 * In that case, we don't want to reset the lineno or column.
2965 */
2966 if (b != YY_CURRENT_BUFFER){
2967 b->yy_bs_lineno = 1;
2968 b->yy_bs_column = 0;
2969 }
2970
2971 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2972
2973 errno = oerrno;
2974 }
2975
2976 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2977 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2978 *
2979 */
yy_flush_buffer(YY_BUFFER_STATE b)2980 void yy_flush_buffer (YY_BUFFER_STATE b )
2981 {
2982 if ( ! b )
2983 return;
2984
2985 b->yy_n_chars = 0;
2986
2987 /* We always need two end-of-buffer characters. The first causes
2988 * a transition to the end-of-buffer state. The second causes
2989 * a jam in that state.
2990 */
2991 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2992 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2993
2994 b->yy_buf_pos = &b->yy_ch_buf[0];
2995
2996 b->yy_at_bol = 1;
2997 b->yy_buffer_status = YY_BUFFER_NEW;
2998
2999 if ( b == YY_CURRENT_BUFFER )
3000 yy_load_buffer_state( );
3001 }
3002
3003 /** Pushes the new state onto the stack. The new state becomes
3004 * the current state. This function will allocate the stack
3005 * if necessary.
3006 * @param new_buffer The new state.
3007 *
3008 */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)3009 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
3010 {
3011 if (new_buffer == NULL)
3012 return;
3013
3014 yyensure_buffer_stack();
3015
3016 /* This block is copied from yy_switch_to_buffer. */
3017 if ( YY_CURRENT_BUFFER )
3018 {
3019 /* Flush out information for old buffer. */
3020 *(yy_c_buf_p) = (yy_hold_char);
3021 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
3022 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
3023 }
3024
3025 /* Only push if top exists. Otherwise, replace top. */
3026 if (YY_CURRENT_BUFFER)
3027 (yy_buffer_stack_top)++;
3028 YY_CURRENT_BUFFER_LVALUE = new_buffer;
3029
3030 /* copied from yy_switch_to_buffer. */
3031 yy_load_buffer_state( );
3032 (yy_did_buffer_switch_on_eof) = 1;
3033 }
3034
3035 /** Removes and deletes the top of the stack, if present.
3036 * The next element becomes the new top.
3037 *
3038 */
yypop_buffer_state(void)3039 void yypop_buffer_state (void)
3040 {
3041 if (!YY_CURRENT_BUFFER)
3042 return;
3043
3044 yy_delete_buffer(YY_CURRENT_BUFFER );
3045 YY_CURRENT_BUFFER_LVALUE = NULL;
3046 if ((yy_buffer_stack_top) > 0)
3047 --(yy_buffer_stack_top);
3048
3049 if (YY_CURRENT_BUFFER) {
3050 yy_load_buffer_state( );
3051 (yy_did_buffer_switch_on_eof) = 1;
3052 }
3053 }
3054
3055 /* Allocates the stack if it does not exist.
3056 * Guarantees space for at least one push.
3057 */
yyensure_buffer_stack(void)3058 static void yyensure_buffer_stack (void)
3059 {
3060 yy_size_t num_to_alloc;
3061
3062 if (!(yy_buffer_stack)) {
3063
3064 /* First allocation is just for 2 elements, since we don't know if this
3065 * scanner will even need a stack. We use 2 instead of 1 to avoid an
3066 * immediate realloc on the next call.
3067 */
3068 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
3069 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
3070 (num_to_alloc * sizeof(struct yy_buffer_state*)
3071 );
3072 if ( ! (yy_buffer_stack) )
3073 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3074
3075 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
3076
3077 (yy_buffer_stack_max) = num_to_alloc;
3078 (yy_buffer_stack_top) = 0;
3079 return;
3080 }
3081
3082 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
3083
3084 /* Increase the buffer to prepare for a possible push. */
3085 yy_size_t grow_size = 8 /* arbitrary grow size */;
3086
3087 num_to_alloc = (yy_buffer_stack_max) + grow_size;
3088 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
3089 ((yy_buffer_stack),
3090 num_to_alloc * sizeof(struct yy_buffer_state*)
3091 );
3092 if ( ! (yy_buffer_stack) )
3093 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
3094
3095 /* zero only the new slots.*/
3096 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
3097 (yy_buffer_stack_max) = num_to_alloc;
3098 }
3099 }
3100
3101 /** Setup the input buffer state to scan directly from a user-specified character buffer.
3102 * @param base the character buffer
3103 * @param size the size in bytes of the character buffer
3104 *
3105 * @return the newly allocated buffer state object.
3106 */
yy_scan_buffer(char * base,yy_size_t size)3107 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
3108 {
3109 YY_BUFFER_STATE b;
3110
3111 if ( size < 2 ||
3112 base[size-2] != YY_END_OF_BUFFER_CHAR ||
3113 base[size-1] != YY_END_OF_BUFFER_CHAR )
3114 /* They forgot to leave room for the EOB's. */
3115 return NULL;
3116
3117 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
3118 if ( ! b )
3119 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
3120
3121 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
3122 b->yy_buf_pos = b->yy_ch_buf = base;
3123 b->yy_is_our_buffer = 0;
3124 b->yy_input_file = NULL;
3125 b->yy_n_chars = b->yy_buf_size;
3126 b->yy_is_interactive = 0;
3127 b->yy_at_bol = 1;
3128 b->yy_fill_buffer = 0;
3129 b->yy_buffer_status = YY_BUFFER_NEW;
3130
3131 yy_switch_to_buffer( b );
3132
3133 return b;
3134 }
3135
3136 /** Setup the input buffer state to scan a string. The next call to yylex() will
3137 * scan from a @e copy of @a str.
3138 * @param yystr a NUL-terminated string to scan
3139 *
3140 * @return the newly allocated buffer state object.
3141 * @note If you want to scan bytes that may contain NUL values, then use
3142 * yy_scan_bytes() instead.
3143 */
yy_scan_string(const char * yystr)3144 YY_BUFFER_STATE yy_scan_string (const char * yystr )
3145 {
3146
3147 return yy_scan_bytes( yystr, (int) strlen(yystr) );
3148 }
3149
3150 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
3151 * scan from a @e copy of @a bytes.
3152 * @param yybytes the byte buffer to scan
3153 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
3154 *
3155 * @return the newly allocated buffer state object.
3156 */
yy_scan_bytes(const char * yybytes,int _yybytes_len)3157 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
3158 {
3159 YY_BUFFER_STATE b;
3160 char *buf;
3161 yy_size_t n;
3162 int i;
3163
3164 /* Get memory for full buffer, including space for trailing EOB's. */
3165 n = (yy_size_t) (_yybytes_len + 2);
3166 buf = (char *) yyalloc( n );
3167 if ( ! buf )
3168 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
3169
3170 for ( i = 0; i < _yybytes_len; ++i )
3171 buf[i] = yybytes[i];
3172
3173 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3174
3175 b = yy_scan_buffer( buf, n );
3176 if ( ! b )
3177 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
3178
3179 /* It's okay to grow etc. this buffer, and we should throw it
3180 * away when we're done.
3181 */
3182 b->yy_is_our_buffer = 1;
3183
3184 return b;
3185 }
3186
3187 #ifndef YY_EXIT_FAILURE
3188 #define YY_EXIT_FAILURE 2
3189 #endif
3190
yy_fatal_error(const char * msg)3191 static void yynoreturn yy_fatal_error (const char* msg )
3192 {
3193 fprintf( stderr, "%s\n", msg );
3194 exit( YY_EXIT_FAILURE );
3195 }
3196
3197 /* Redefine yyless() so it works in section 3 code. */
3198
3199 #undef yyless
3200 #define yyless(n) \
3201 do \
3202 { \
3203 /* Undo effects of setting up yytext. */ \
3204 int yyless_macro_arg = (n); \
3205 YY_LESS_LINENO(yyless_macro_arg);\
3206 yytext[yyleng] = (yy_hold_char); \
3207 (yy_c_buf_p) = yytext + yyless_macro_arg; \
3208 (yy_hold_char) = *(yy_c_buf_p); \
3209 *(yy_c_buf_p) = '\0'; \
3210 yyleng = yyless_macro_arg; \
3211 } \
3212 while ( 0 )
3213
3214 /* Accessor methods (get/set functions) to struct members. */
3215
3216 /** Get the current line number.
3217 *
3218 */
yyget_lineno(void)3219 int yyget_lineno (void)
3220 {
3221
3222 return yylineno;
3223 }
3224
3225 /** Get the input stream.
3226 *
3227 */
yyget_in(void)3228 FILE *yyget_in (void)
3229 {
3230 return yyin;
3231 }
3232
3233 /** Get the output stream.
3234 *
3235 */
yyget_out(void)3236 FILE *yyget_out (void)
3237 {
3238 return yyout;
3239 }
3240
3241 /** Get the length of the current token.
3242 *
3243 */
yyget_leng(void)3244 int yyget_leng (void)
3245 {
3246 return yyleng;
3247 }
3248
3249 /** Get the current token.
3250 *
3251 */
3252
yyget_text(void)3253 char *yyget_text (void)
3254 {
3255 return yytext;
3256 }
3257
3258 /** Set the current line number.
3259 * @param _line_number line number
3260 *
3261 */
yyset_lineno(int _line_number)3262 void yyset_lineno (int _line_number )
3263 {
3264
3265 yylineno = _line_number;
3266 }
3267
3268 /** Set the input stream. This does not discard the current
3269 * input buffer.
3270 * @param _in_str A readable stream.
3271 *
3272 * @see yy_switch_to_buffer
3273 */
yyset_in(FILE * _in_str)3274 void yyset_in (FILE * _in_str )
3275 {
3276 yyin = _in_str ;
3277 }
3278
yyset_out(FILE * _out_str)3279 void yyset_out (FILE * _out_str )
3280 {
3281 yyout = _out_str ;
3282 }
3283
yyget_debug(void)3284 int yyget_debug (void)
3285 {
3286 return yy_flex_debug;
3287 }
3288
yyset_debug(int _bdebug)3289 void yyset_debug (int _bdebug )
3290 {
3291 yy_flex_debug = _bdebug ;
3292 }
3293
yy_init_globals(void)3294 static int yy_init_globals (void)
3295 {
3296 /* Initialization is the same as for the non-reentrant scanner.
3297 * This function is called from yylex_destroy(), so don't allocate here.
3298 */
3299
3300 (yy_buffer_stack) = NULL;
3301 (yy_buffer_stack_top) = 0;
3302 (yy_buffer_stack_max) = 0;
3303 (yy_c_buf_p) = NULL;
3304 (yy_init) = 0;
3305 (yy_start) = 0;
3306
3307 /* Defined in main.c */
3308 #ifdef YY_STDINIT
3309 yyin = stdin;
3310 yyout = stdout;
3311 #else
3312 yyin = NULL;
3313 yyout = NULL;
3314 #endif
3315
3316 /* For future reference: Set errno on error, since we are called by
3317 * yylex_init()
3318 */
3319 return 0;
3320 }
3321
3322 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(void)3323 int yylex_destroy (void)
3324 {
3325
3326 /* Pop the buffer stack, destroying each element. */
3327 while(YY_CURRENT_BUFFER){
3328 yy_delete_buffer( YY_CURRENT_BUFFER );
3329 YY_CURRENT_BUFFER_LVALUE = NULL;
3330 yypop_buffer_state();
3331 }
3332
3333 /* Destroy the stack itself. */
3334 yyfree((yy_buffer_stack) );
3335 (yy_buffer_stack) = NULL;
3336
3337 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3338 * yylex() is called, initialization will occur. */
3339 yy_init_globals( );
3340
3341 return 0;
3342 }
3343
3344 /*
3345 * Internal utility routines.
3346 */
3347
3348 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,const char * s2,int n)3349 static void yy_flex_strncpy (char* s1, const char * s2, int n )
3350 {
3351
3352 int i;
3353 for ( i = 0; i < n; ++i )
3354 s1[i] = s2[i];
3355 }
3356 #endif
3357
3358 #ifdef YY_NEED_STRLEN
yy_flex_strlen(const char * s)3359 static int yy_flex_strlen (const char * s )
3360 {
3361 int n;
3362 for ( n = 0; s[n]; ++n )
3363 ;
3364
3365 return n;
3366 }
3367 #endif
3368
yyalloc(yy_size_t size)3369 void *yyalloc (yy_size_t size )
3370 {
3371 return malloc(size);
3372 }
3373
yyrealloc(void * ptr,yy_size_t size)3374 void *yyrealloc (void * ptr, yy_size_t size )
3375 {
3376
3377 /* The cast to (char *) in the following accommodates both
3378 * implementations that use char* generic pointers, and those
3379 * that use void* generic pointers. It works with the latter
3380 * because both ANSI C and C++ allow castless assignment from
3381 * any pointer type to void*, and deal with argument conversions
3382 * as though doing an assignment.
3383 */
3384 return realloc(ptr, size);
3385 }
3386
yyfree(void * ptr)3387 void yyfree (void * ptr )
3388 {
3389 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3390 }
3391
3392 #define YYTABLES_NAME "yytables"
3393
3394 #line 664 "lex.l"
3395
3396
3397 int
lexEscape(int c)3398 lexEscape (int c)
3399 {
3400 switch (c) {
3401 case '0':
3402 return '\0';
3403 break;
3404 case 'b':
3405 return '\b';
3406 break;
3407 case 'n':
3408 return '\n';
3409 break;
3410 case 'r':
3411 return '\r';
3412 break;
3413 case 't':
3414 return '\t';
3415 break;
3416 case 'f':
3417 return '\f';
3418 break;
3419 case 'v':
3420 return '\v';
3421 break;
3422 default:
3423 return c;
3424 }
3425 }
3426
3427
3428 Value
lexdoc(void)3429 lexdoc (void)
3430 {
3431 int c;
3432 Value s = NewStrString ("");
3433
3434 c = input();
3435 if (lexInput->at_eof)
3436 {
3437 bail:
3438 yyerror ("Missing */ at end of file");
3439 return Void;
3440 }
3441 for (;;) {
3442 Bool skip = False;
3443 while (c != EOF && c != '*')
3444 {
3445 if (skip && c != ' ' && c != '\t')
3446 skip = False;
3447 if (!skip)
3448 s = Plus (s, NewCharString (c));
3449 if (c == '\n')
3450 skip = True;
3451 c = input();
3452 if (c == EOF || lexInput->at_eof)
3453 goto bail;
3454 }
3455 c = input();
3456 if (c == EOF || lexInput->at_eof)
3457 goto bail;
3458 if (c == '/')
3459 break;
3460 if (!skip)
3461 s = Plus (s, NewCharString ('*'));
3462 }
3463 return s;
3464 }
3465
3466 void
skipcomment(void)3467 skipcomment (void)
3468 {
3469 int c;
3470
3471 c = input();
3472 if (lexInput->at_eof)
3473 {
3474 bail:
3475 yyerror ("Missing */ at end of file");
3476 return;
3477 }
3478 for (;;) {
3479 while (c != EOF && c != '*')
3480 {
3481 c = input();
3482 if (c == EOF || lexInput->at_eof)
3483 goto bail;
3484 }
3485 c = input();
3486 if (c == EOF || lexInput->at_eof)
3487 goto bail;
3488 if (c == '/')
3489 return;
3490 }
3491 }
3492
3493 void
skipline(void)3494 skipline (void)
3495 {
3496 int c;
3497
3498 do {
3499 c = input();
3500 } while (c != EOF && c != '\n');
3501 }
3502
3503 Value
atov(char * s,int base)3504 atov (char *s, int base)
3505 {
3506 ENTER ();
3507 Value result;
3508 Value b;
3509 char c;
3510 int i;
3511
3512 b = NewInt (base);
3513 result = NewInt (0);
3514 for (;;) {
3515 c = *s++;
3516 if ('0' <= c && c <= '9')
3517 i = c - '0';
3518 else if ('a' <= c && c <= 'z')
3519 i = c - 'a' + 10;
3520 else if ('A' <= c && c <= 'Z')
3521 i = c - 'A' + 10;
3522 else if (c == '_')
3523 continue;
3524 else
3525 break;
3526 if (i >= base)
3527 break;
3528 result = Plus (NewInt (i), Times (result, b));
3529 }
3530 RETURN (result);
3531 }
3532
3533 static char *
scan_number(char * s,char needle,int * lenp)3534 scan_number(char *s, char needle, int *lenp)
3535 {
3536 int len = 0;
3537 for (;;) {
3538 char c = *s;
3539 if (tolower(c) == needle)
3540 break;
3541 switch (c) {
3542 case '\0':
3543 return NULL;
3544 case '_':
3545 break;
3546 default:
3547 len++;
3548 break;
3549 }
3550 s++;
3551 }
3552 if (lenp)
3553 *lenp = len;
3554 return s;
3555 }
3556
3557 static int
number_len(char * s)3558 number_len(char *s)
3559 {
3560 int len = 0;
3561 char c;
3562 while ((c = *s++))
3563 if (c != '_')
3564 len++;
3565 return len;
3566 }
3567
3568 Value
aetov(char * s,int base)3569 aetov (char *s, int base)
3570 {
3571 ENTER ();
3572 char *int_part, *frac_part, *rep_part, *exp_part, *next;
3573 int sign, int_len = -1, frac_len = -1, rep_len = -1, exp_frac_len = -1, esign;
3574 Value v, sv;
3575
3576 int_part = s;
3577 sign = 1;
3578 if (*int_part == '+')
3579 int_part++;
3580 else if (*int_part == '-') {
3581 int_part++;
3582 sign = -1;
3583 }
3584 next = int_part;
3585 frac_part = scan_number(next, '.', &int_len);
3586 frac_len = -1;
3587 rep_part = 0;
3588 rep_len = 0;
3589 esign = 1;
3590 if (frac_part) {
3591 frac_part++;
3592 next = frac_part;
3593 rep_part = scan_number(next, '{', &frac_len);
3594 if (rep_part)
3595 {
3596 rep_part++;
3597 next = rep_part;
3598 next = scan_number(next, '}', &rep_len);
3599 if (!next)
3600 RETURN(Void); /* can't happen */
3601 }
3602 }
3603 exp_part = scan_number(next, 'e', &exp_frac_len);
3604 if (exp_part) {
3605 if (frac_len < 0)
3606 frac_len = exp_frac_len;
3607 exp_part++;
3608 if (*exp_part == '+')
3609 exp_part++;
3610 else if (*exp_part == '-') {
3611 esign = -1;
3612 exp_part++;
3613 }
3614 } else if (frac_len < 0 && frac_part)
3615 frac_len = number_len(frac_part);
3616 v = atov (int_part, base);
3617 if (frac_part)
3618 {
3619 v = Plus (v, Divide (atov (frac_part, base),
3620 Pow (NewInt (base),
3621 NewInt (frac_len))));
3622 }
3623 if (rep_part)
3624 {
3625 Value rep;
3626
3627 rep = Divide (atov (rep_part, base), Minus (Pow (NewInt (base),
3628 NewInt (rep_len)),
3629 One));
3630 if (frac_len)
3631 rep = Divide (rep, Pow (NewInt (base),
3632 NewInt (frac_len)));
3633 v = Plus (v, rep);
3634 }
3635 if (exp_part)
3636 {
3637 sv = Pow (NewInt (base), atov (exp_part, base));
3638 if (esign > 0)
3639 v = Times (v, sv);
3640 else
3641 v = Divide (v, sv);
3642 }
3643 if (sign == -1)
3644 v = Negate (v);
3645 RETURN (v);
3646 }
3647
3648