5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
12 /* %if-not-reentrant */
18 #define YY_FLEX_MAJOR_VERSION 2
19 #define YY_FLEX_MINOR_VERSION 5
20 #define YY_FLEX_SUBMINOR_VERSION 35
21 #if YY_FLEX_SUBMINOR_VERSION > 0
36 /* First, we deal with platform-specific or compiler-specific issues. */
38 /* begin standard C headers. */
46 /* %if-tables-serialization */
48 /* end standard C headers. */
51 /* flex integer type definitions */
56 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
58 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
60 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
61 * if you want the limit (max/min) macros for int types.
63 #ifndef __STDC_LIMIT_MACROS
64 #define __STDC_LIMIT_MACROS 1
68 typedef int8_t flex_int8_t
;
69 typedef uint8_t flex_uint8_t
;
70 typedef int16_t flex_int16_t
;
71 typedef uint16_t flex_uint16_t
;
72 typedef int32_t flex_int32_t
;
73 typedef uint32_t flex_uint32_t
;
75 typedef signed char flex_int8_t
;
76 typedef short int flex_int16_t
;
77 typedef int flex_int32_t
;
78 typedef unsigned char flex_uint8_t
;
79 typedef unsigned short int flex_uint16_t
;
80 typedef unsigned int flex_uint32_t
;
83 /* Limits of integral types. */
85 #define INT8_MIN (-128)
88 #define INT16_MIN (-32767-1)
91 #define INT32_MIN (-2147483647-1)
94 #define INT8_MAX (127)
97 #define INT16_MAX (32767)
100 #define INT32_MAX (2147483647)
103 #define UINT8_MAX (255U)
106 #define UINT16_MAX (65535U)
109 #define UINT32_MAX (4294967295U)
112 #endif /* ! FLEXINT_H */
121 /* The "const" storage-class-modifier is valid. */
124 #else /* ! __cplusplus */
126 /* C99 requires __STDC__ to be defined as 1. */
127 #if defined (__STDC__)
131 #endif /* defined (__STDC__) */
132 #endif /* ! __cplusplus */
135 #define yyconst const
140 /* %not-for-header */
142 /* Returned upon end-of-file. */
146 /* %not-for-header */
148 /* Promotes a possibly negative, possibly signed char to an unsigned
149 * integer for use as an array index. If the signed char is negative,
150 * we want to instead treat it as an 8-bit unsigned char, hence the
153 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
158 /* An opaque pointer. */
159 #ifndef YY_TYPEDEF_YY_SCANNER_T
160 #define YY_TYPEDEF_YY_SCANNER_T
161 typedef void* yyscan_t
;
164 /* For convenience, these vars (plus the bison vars far below)
165 are macros in the reentrant scanner. */
166 #define yyin yyg->yyin_r
167 #define yyout yyg->yyout_r
168 #define yyextra yyg->yyextra_r
169 #define yyleng yyg->yyleng_r
170 #define yytext yyg->yytext_r
171 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
172 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
173 #define yy_flex_debug yyg->yy_flex_debug_r
177 /* %if-not-reentrant */
180 /* Enter a start condition. This macro really ought to take a parameter,
181 * but we do it the disgusting crufty way forced on us by the ()-less
182 * definition of BEGIN.
184 #define BEGIN yyg->yy_start = 1 + 2 *
186 /* Translate the current start state into a value that can be later handed
187 * to BEGIN to return to the state. The YYSTATE alias is for lex
190 #define YY_START ((yyg->yy_start - 1) / 2)
191 #define YYSTATE YY_START
193 /* Action number for EOF rule of a given start state. */
194 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
196 /* Special action meaning "start processing a new file". */
197 #define YY_NEW_FILE macrorestart(yyin ,yyscanner )
199 #define YY_END_OF_BUFFER_CHAR 0
201 /* Size of default input buffer. */
203 #define YY_BUF_SIZE 16384
206 /* The state buf must be large enough to hold one state per character in the main buffer.
208 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
210 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
211 #define YY_TYPEDEF_YY_BUFFER_STATE
212 typedef struct yy_buffer_state
*YY_BUFFER_STATE
;
215 /* %if-not-reentrant */
219 /* %if-not-reentrant */
223 #define EOB_ACT_CONTINUE_SCAN 0
224 #define EOB_ACT_END_OF_FILE 1
225 #define EOB_ACT_LAST_MATCH 2
227 #define YY_LESS_LINENO(n)
229 /* Return all but the first "n" matched characters back to the input stream. */
233 /* Undo effects of setting up yytext. */ \
234 int yyless_macro_arg = (n); \
235 YY_LESS_LINENO(yyless_macro_arg);\
236 *yy_cp = yyg->yy_hold_char; \
237 YY_RESTORE_YY_MORE_OFFSET \
238 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
239 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
243 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
245 #ifndef YY_TYPEDEF_YY_SIZE_T
246 #define YY_TYPEDEF_YY_SIZE_T
247 typedef size_t yy_size_t
;
250 #ifndef YY_STRUCT_YY_BUFFER_STATE
251 #define YY_STRUCT_YY_BUFFER_STATE
252 struct yy_buffer_state
261 char *yy_ch_buf
; /* input buffer */
262 char *yy_buf_pos
; /* current position in input buffer */
264 /* Size of input buffer in bytes, not including room for EOB
267 yy_size_t yy_buf_size
;
269 /* Number of characters read into yy_ch_buf, not including EOB
274 /* Whether we "own" the buffer - i.e., we know we created it,
275 * and can realloc() it to grow it, and should free() it to
278 int yy_is_our_buffer
;
280 /* Whether this is an "interactive" input source; if so, and
281 * if we're using stdio for input, then we want to use getc()
282 * instead of fread(), to make sure we stop fetching input after
285 int yy_is_interactive
;
287 /* Whether we're considered to be at the beginning of a line.
288 * If so, '^' rules will be active on the next match, otherwise
293 int yy_bs_lineno
; /**< The line count. */
294 int yy_bs_column
; /**< The column count. */
296 /* Whether to try to fill the input buffer when we reach the
301 int yy_buffer_status
;
303 #define YY_BUFFER_NEW 0
304 #define YY_BUFFER_NORMAL 1
305 /* When an EOF's been seen but there's still some text to process
306 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
307 * shouldn't try reading from the input source any more. We might
308 * still have a bunch of tokens to match, though, because of
309 * possible backing-up.
311 * When we actually see the EOF, we change the status to "new"
312 * (via macrorestart()), so that the user can continue scanning by
313 * just pointing yyin at a new input file.
315 #define YY_BUFFER_EOF_PENDING 2
318 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
320 /* %if-c-only Standard (non-C++) definition */
321 /* %not-for-header */
323 /* %if-not-reentrant */
329 /* We provide macros for accessing buffer states in case in the
330 * future we want to put the buffer states in a more general
333 * Returns the top of the stack, or NULL.
335 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
336 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
339 /* Same as previous macro, but useful when we know that the buffer stack is not
340 * NULL or when we need an lvalue. For internal use only.
342 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
344 /* %if-c-only Standard (non-C++) definition */
346 /* %if-not-reentrant */
347 /* %not-for-header */
353 void macrorestart (FILE *input_file
,yyscan_t yyscanner
);
354 void macro_switch_to_buffer (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
355 YY_BUFFER_STATE
macro_create_buffer (FILE *file
,int size
,yyscan_t yyscanner
);
356 void macro_delete_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
357 void macro_flush_buffer (YY_BUFFER_STATE b
,yyscan_t yyscanner
);
358 void macropush_buffer_state (YY_BUFFER_STATE new_buffer
,yyscan_t yyscanner
);
359 void macropop_buffer_state (yyscan_t yyscanner
);
361 static void macroensure_buffer_stack (yyscan_t yyscanner
);
362 static void macro_load_buffer_state (yyscan_t yyscanner
);
363 static void macro_init_buffer (YY_BUFFER_STATE b
,FILE *file
,yyscan_t yyscanner
);
365 #define YY_FLUSH_BUFFER macro_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
367 YY_BUFFER_STATE
macro_scan_buffer (char *base
,yy_size_t size
,yyscan_t yyscanner
);
368 YY_BUFFER_STATE
macro_scan_string (yyconst
char *yy_str
,yyscan_t yyscanner
);
369 YY_BUFFER_STATE
macro_scan_bytes (yyconst
char *bytes
,int len
,yyscan_t yyscanner
);
373 void *macroalloc (yy_size_t
,yyscan_t yyscanner
);
374 void *macrorealloc (void *,yy_size_t
,yyscan_t yyscanner
);
375 void macrofree (void * ,yyscan_t yyscanner
);
377 #define yy_new_buffer macro_create_buffer
379 #define yy_set_interactive(is_interactive) \
381 if ( ! YY_CURRENT_BUFFER ){ \
382 macroensure_buffer_stack (yyscanner); \
383 YY_CURRENT_BUFFER_LVALUE = \
384 macro_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
386 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
389 #define yy_set_bol(at_bol) \
391 if ( ! YY_CURRENT_BUFFER ){\
392 macroensure_buffer_stack (yyscanner); \
393 YY_CURRENT_BUFFER_LVALUE = \
394 macro_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
396 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
399 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
401 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
402 /* Begin user sect3 */
404 #define macrowrap(n) 1
405 #define YY_SKIP_YYWRAP
409 typedef unsigned char YY_CHAR
;
411 typedef int yy_state_type
;
413 #define yytext_ptr yytext_r
415 /* %if-c-only Standard (non-C++) definition */
417 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
);
418 static yy_state_type
yy_try_NUL_trans (yy_state_type current_state
,yyscan_t yyscanner
);
419 static int yy_get_next_buffer (yyscan_t yyscanner
);
420 static void yy_fatal_error (yyconst
char msg
[] ,yyscan_t yyscanner
);
424 /* Done after the current pattern has been matched and before the
425 * corresponding action - sets up yytext.
427 #define YY_DO_BEFORE_ACTION \
428 yyg->yytext_ptr = yy_bp; \
429 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
430 yyleng = (size_t) (yy_cp - yy_bp); \
431 yyg->yy_hold_char = *yy_cp; \
433 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
434 yyg->yy_c_buf_p = yy_cp;
436 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
437 #define YY_NUM_RULES 77
438 #define YY_END_OF_BUFFER 78
439 /* This struct is not used in this scanner,
440 but its presence is necessary. */
443 flex_int32_t yy_verify
;
446 static yyconst flex_int16_t yy_accept
[376] =
448 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
449 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
450 0, 0, 78, 76, 74, 75, 74, 76, 76, 76,
451 76, 76, 76, 28, 76, 76, 49, 76, 76, 76,
452 68, 68, 76, 76, 76, 76, 64, 64, 76, 76,
453 76, 76, 76, 4, 74, 76, 76, 76, 76, 76,
454 76, 52, 52, 38, 38, 76, 76, 2, 74, 23,
455 25, 24, 3, 74, 76, 76, 64, 64, 27, 27,
456 1, 27, 27, 27, 27, 26, 27, 27, 27, 27,
457 27, 27, 27, 27, 27, 27, 27, 5, 74, 76,
459 76, 46, 47, 76, 21, 21, 21, 21, 21, 33,
460 33, 6, 33, 32, 33, 33, 33, 33, 33, 33,
461 33, 33, 33, 33, 33, 33, 33, 34, 33, 76,
462 76, 76, 30, 76, 29, 76, 76, 57, 57, 35,
463 35, 31, 75, 75, 75, 71, 0, 63, 0, 44,
464 44, 73, 0, 0, 72, 0, 68, 0, 0, 0,
465 67, 39, 39, 39, 39, 39, 73, 67, 0, 0,
466 0, 0, 65, 71, 71, 64, 70, 42, 62, 4,
467 4, 4, 0, 51, 0, 0, 0, 0, 52, 54,
468 54, 0, 0, 0, 0, 38, 38, 0, 55, 0,
470 0, 2, 2, 2, 3, 3, 3, 0, 0, 0,
471 66, 66, 66, 64, 13, 62, 1, 1, 1, 5,
472 5, 5, 0, 48, 0, 0, 47, 20, 21, 21,
473 21, 21, 21, 6, 6, 6, 0, 56, 0, 44,
474 0, 0, 57, 61, 36, 36, 36, 36, 36, 61,
475 0, 0, 0, 0, 35, 35, 35, 44, 40, 44,
476 0, 45, 0, 43, 43, 0, 0, 39, 39, 39,
477 39, 39, 67, 69, 0, 67, 69, 69, 65, 71,
478 41, 50, 0, 54, 53, 0, 54, 53, 53, 0,
479 12, 62, 14, 66, 66, 66, 20, 16, 17, 18,
481 21, 37, 0, 36, 36, 36, 36, 36, 61, 59,
482 0, 61, 60, 58, 41, 43, 43, 0, 67, 39,
483 39, 39, 0, 54, 14, 66, 66, 21, 0, 61,
484 36, 36, 36, 39, 7, 39, 22, 66, 21, 36,
485 7, 36, 39, 10, 66, 19, 36, 10, 39, 39,
486 66, 36, 36, 8, 39, 66, 8, 36, 39, 66,
487 66, 36, 39, 66, 66, 36, 39, 66, 66, 36,
491 static yyconst flex_int32_t yy_ec
[256] =
493 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
494 1, 2, 4, 1, 1, 1, 1, 1, 1, 1,
495 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
496 1, 5, 6, 7, 1, 8, 9, 10, 11, 12,
497 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
498 22, 22, 22, 22, 22, 23, 23, 24, 1, 25,
499 26, 27, 1, 28, 29, 30, 29, 29, 31, 29,
500 32, 32, 33, 32, 32, 32, 32, 33, 34, 33,
501 32, 32, 33, 32, 32, 32, 32, 35, 32, 32,
502 1, 36, 1, 1, 37, 1, 38, 39, 40, 41,
504 42, 29, 43, 32, 44, 32, 32, 45, 46, 47,
505 48, 49, 32, 50, 51, 52, 53, 32, 32, 35,
506 32, 32, 54, 55, 56, 57, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
509 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
510 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
511 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
512 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
513 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
515 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
516 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
517 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
518 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
519 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
523 static yyconst flex_int32_t yy_meta
[58] =
525 1, 1, 2, 1, 1, 1, 3, 4, 1, 1,
526 3, 1, 1, 1, 1, 1, 1, 1, 1, 5,
527 5, 5, 5, 6, 1, 4, 1, 7, 8, 8,
528 8, 7, 7, 7, 7, 1, 7, 8, 8, 8,
529 8, 8, 7, 7, 7, 7, 7, 7, 7, 7,
533 static yyconst flex_int16_t yy_base
[417] =
535 0, 0, 56, 112, 169, 0, 56, 57, 224, 0,
536 257, 0, 313, 369, 424, 445, 461, 0, 513, 569,
537 626, 0, 1281, 1356, 1356, 74, 1268, 1237, 62, 1226,
538 1223, 70, 1230, 1356, 71, 66, 1356, 81, 677, 74,
539 706, 122, 0, 65, 68, 79, 84, 126, 97, 84,
540 1207, 1196, 1188, 130, 1207, 129, 1169, 1183, 137, 230,
541 321, 737, 334, 0, 313, 313, 1173, 356, 1171, 1356,
542 1356, 1356, 387, 1161, 1080, 390, 1088, 379, 1356, 1356,
543 402, 1099, 1075, 1074, 99, 1356, 142, 1057, 1356, 1056,
544 1054, 327, 94, 135, 203, 295, 336, 415, 1069, 330,
546 1050, 1356, 437, 0, 0, 1013, 1006, 1000, 993, 1356,
547 1356, 468, 1038, 1356, 1005, 1004, 223, 229, 1003, 1356,
548 986, 985, 389, 338, 395, 403, 322, 1356, 397, 344,
549 976, 986, 1356, 456, 1356, 523, 779, 808, 534, 967,
550 514, 1356, 481, 556, 587, 1356, 402, 1356, 0, 970,
551 577, 1356, 973, 956, 1356, 582, 671, 407, 947, 968,
552 711, 0, 586, 931, 928, 933, 944, 742, 413, 595,
553 442, 0, 0, 942, 415, 210, 1356, 427, 0, 617,
554 702, 712, 490, 1356, 0, 729, 956, 760, 773, 813,
555 831, 460, 796, 542, 0, 0, 786, 514, 1356, 0,
557 935, 855, 861, 865, 872, 876, 880, 848, 866, 0,
558 0, 824, 823, 825, 1356, 871, 894, 898, 902, 906,
559 910, 914, 517, 1356, 0, 837, 900, 0, 0, 794,
560 799, 801, 790, 922, 926, 930, 541, 1356, 0, 916,
561 826, 921, 927, 931, 0, 943, 785, 783, 776, 954,
562 467, 966, 560, 0, 782, 523, 970, 779, 1356, 979,
563 683, 1356, 0, 0, 984, 787, 993, 0, 997, 757,
564 745, 749, 1001, 546, 1005, 1013, 800, 0, 0, 762,
565 1356, 1017, 1027, 1031, 593, 1035, 1043, 935, 0, 754,
566 1356, 1047, 0, 0, 736, 735, 0, 0, 0, 0,
568 730, 1054, 1064, 0, 1068, 730, 722, 726, 1072, 666,
569 1076, 1084, 939, 0, 1356, 0, 1088, 1095, 1099, 716,
570 714, 697, 1103, 1107, 0, 700, 694, 696, 1111, 1115,
571 694, 696, 685, 677, 0, 677, 0, 672, 675, 659,
572 0, 661, 667, 659, 658, 0, 582, 574, 551, 493,
573 480, 478, 435, 0, 405, 663, 0, 402, 392, 398,
574 385, 350, 318, 325, 307, 273, 202, 121, 106, 72,
575 0, 0, 0, 0, 1356, 1138, 1146, 1154, 1162, 1164,
576 1172, 1178, 1180, 1184, 1192, 1200, 1204, 1212, 1220, 1222,
577 1227, 1231, 1239, 1247, 1249, 1253, 1261, 1269, 1275, 1279,
579 1283, 1291, 1293, 1301, 1305, 1309, 1313, 1317, 1321, 1323,
580 1327, 1331, 1335, 1339, 1343, 1347
583 static yyconst flex_int16_t yy_def
[417] =
585 375, 1, 376, 376, 375, 5, 4, 4, 5, 9,
586 375, 11, 377, 377, 4, 4, 4, 17, 378, 378,
587 375, 21, 375, 375, 375, 375, 375, 375, 379, 380,
588 375, 375, 381, 375, 375, 375, 375, 375, 382, 375,
589 375, 375, 383, 375, 375, 375, 384, 384, 375, 375,
590 375, 375, 375, 375, 375, 385, 375, 386, 375, 375,
591 375, 375, 375, 387, 387, 388, 389, 375, 375, 375,
592 375, 375, 375, 375, 390, 391, 392, 392, 375, 375,
593 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
594 375, 375, 375, 375, 375, 375, 375, 375, 375, 393,
596 394, 375, 375, 395, 396, 396, 396, 396, 396, 375,
597 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
598 375, 375, 375, 375, 375, 375, 375, 375, 375, 397,
599 380, 398, 375, 375, 375, 375, 399, 375, 375, 400,
600 400, 375, 375, 375, 375, 375, 379, 375, 379, 401,
601 401, 375, 381, 375, 375, 375, 375, 402, 403, 404,
602 375, 405, 405, 405, 405, 405, 375, 375, 375, 375,
603 375, 406, 407, 375, 375, 384, 375, 384, 48, 375,
604 375, 375, 385, 375, 385, 375, 386, 375, 375, 375,
605 375, 375, 375, 375, 408, 387, 387, 388, 375, 388,
607 389, 375, 375, 375, 375, 375, 375, 409, 409, 410,
608 411, 411, 411, 392, 375, 392, 375, 375, 375, 375,
609 375, 375, 393, 375, 393, 394, 375, 412, 396, 396,
610 396, 396, 396, 375, 375, 375, 397, 375, 397, 401,
611 398, 375, 375, 375, 413, 413, 413, 413, 413, 375,
612 375, 375, 375, 414, 400, 400, 400, 401, 375, 401,
613 402, 375, 402, 415, 415, 404, 375, 405, 405, 405,
614 405, 405, 375, 375, 375, 375, 375, 406, 407, 375,
615 375, 375, 375, 375, 375, 375, 375, 375, 408, 409,
616 375, 409, 416, 411, 411, 411, 412, 396, 396, 396,
618 396, 401, 375, 413, 413, 413, 413, 413, 375, 375,
619 375, 375, 375, 414, 375, 415, 415, 375, 375, 405,
620 405, 405, 375, 375, 416, 411, 411, 396, 375, 375,
621 413, 413, 413, 405, 405, 405, 411, 411, 396, 413,
622 413, 413, 405, 405, 411, 396, 413, 413, 405, 405,
623 411, 413, 413, 405, 405, 411, 413, 413, 405, 411,
624 411, 413, 405, 411, 411, 413, 405, 411, 411, 413,
625 405, 411, 411, 413, 0, 375, 375, 375, 375, 375,
626 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
627 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
629 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
630 375, 375, 375, 375, 375, 375
633 static yyconst flex_int16_t yy_nxt
[1414] =
635 24, 25, 26, 27, 25, 28, 29, 30, 31, 32,
636 33, 34, 24, 35, 36, 37, 38, 39, 40, 41,
637 42, 42, 42, 43, 44, 45, 46, 47, 47, 47,
638 47, 47, 48, 47, 47, 24, 47, 47, 47, 47,
639 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
640 47, 47, 47, 24, 49, 24, 50, 25, 26, 27,
641 25, 28, 66, 66, 31, 32, 67, 67, 148, 35,
642 51, 37, 52, 53, 40, 143, 143, 144, 143, 152,
643 44, 45, 46, 156, 154, 157, 157, 157, 157, 174,
644 146, 155, 167, 146, 146, 152, 155, 149, 156, 155,
646 157, 157, 157, 157, 146, 175, 155, 177, 152, 152,
647 49, 178, 50, 25, 26, 27, 25, 28, 174, 146,
648 31, 32, 152, 374, 152, 35, 51, 37, 52, 53,
649 40, 180, 180, 181, 180, 184, 44, 45, 46, 168,
650 152, 157, 157, 157, 157, 179, 179, 179, 179, 177,
651 373, 152, 170, 178, 188, 154, 189, 189, 189, 189,
652 146, 146, 155, 170, 185, 372, 49, 155, 50, 24,
653 25, 54, 55, 25, 28, 56, 57, 31, 32, 58,
654 24, 24, 35, 59, 37, 60, 61, 40, 62, 63,
655 63, 63, 24, 44, 45, 46, 64, 64, 64, 64,
657 64, 65, 64, 64, 24, 64, 64, 64, 64, 64,
658 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
659 64, 64, 24, 49, 24, 50, 68, 69, 146, 175,
660 24, 24, 152, 177, 24, 70, 71, 178, 51, 72,
661 52, 53, 154, 24, 24, 24, 24, 188, 152, 189,
662 189, 189, 189, 371, 155, 155, 64, 24, 25, 73,
663 74, 25, 28, 29, 75, 31, 32, 33, 24, 24,
664 35, 36, 37, 38, 76, 40, 41, 42, 42, 42,
665 43, 44, 45, 46, 77, 77, 77, 77, 77, 78,
666 77, 77, 24, 77, 77, 77, 77, 77, 77, 77,
668 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
669 24, 49, 24, 50, 80, 81, 82, 80, 83, 199,
670 152, 84, 85, 370, 86, 24, 87, 88, 89, 90,
671 91, 92, 197, 197, 197, 197, 224, 93, 94, 95,
672 190, 190, 190, 190, 369, 167, 155, 152, 200, 152,
673 238, 191, 155, 189, 189, 189, 189, 202, 202, 203,
674 202, 152, 174, 146, 193, 225, 368, 96, 367, 97,
675 80, 81, 82, 80, 83, 193, 152, 84, 85, 239,
676 86, 24, 87, 88, 89, 90, 91, 92, 205, 205,
677 206, 205, 152, 93, 94, 95, 366, 210, 216, 216,
679 216, 216, 215, 217, 217, 218, 217, 167, 148, 161,
680 161, 161, 161, 262, 155, 155, 220, 220, 221, 220,
681 146, 146, 152, 96, 365, 97, 98, 99, 146, 175,
682 100, 212, 274, 274, 101, 213, 364, 149, 363, 102,
683 155, 280, 263, 103, 103, 103, 103, 98, 99, 362,
684 281, 100, 359, 152, 178, 101, 227, 227, 227, 227,
685 102, 277, 277, 277, 103, 103, 103, 103, 104, 234,
686 234, 235, 234, 242, 358, 243, 243, 243, 243, 285,
687 285, 155, 143, 143, 144, 143, 310, 310, 105, 105,
688 105, 105, 105, 105, 105, 105, 184, 105, 105, 105,
690 105, 105, 105, 105, 106, 105, 105, 107, 105, 108,
691 105, 109, 105, 105, 111, 112, 113, 114, 115, 357,
692 199, 116, 117, 224, 356, 185, 118, 119, 120, 121,
693 122, 123, 355, 257, 257, 257, 257, 124, 125, 126,
694 242, 256, 243, 243, 243, 243, 315, 238, 155, 200,
695 256, 250, 225, 243, 243, 243, 243, 143, 143, 144,
696 143, 288, 288, 288, 252, 274, 274, 127, 128, 129,
697 111, 112, 113, 114, 115, 252, 239, 116, 117, 313,
698 313, 313, 118, 119, 120, 121, 122, 123, 143, 143,
699 144, 143, 354, 124, 125, 126, 260, 260, 260, 260,
701 259, 161, 161, 161, 161, 269, 269, 269, 269, 275,
702 353, 275, 285, 285, 276, 276, 276, 276, 180, 180,
703 181, 180, 352, 127, 128, 129, 24, 25, 26, 27,
704 25, 28, 130, 131, 31, 32, 132, 24, 133, 35,
705 134, 135, 136, 137, 40, 138, 139, 139, 139, 24,
706 44, 45, 46, 140, 140, 140, 140, 140, 141, 140,
707 140, 24, 140, 140, 140, 140, 140, 140, 140, 140,
708 140, 140, 140, 140, 140, 140, 140, 140, 140, 142,
709 49, 24, 50, 158, 159, 310, 310, 160, 168, 262,
710 157, 157, 157, 157, 351, 350, 161, 161, 161, 161,
712 360, 170, 155, 180, 180, 181, 180, 349, 348, 163,
713 361, 347, 170, 180, 180, 181, 180, 346, 263, 345,
714 164, 165, 166, 168, 344, 157, 157, 157, 157, 343,
715 161, 161, 161, 161, 342, 169, 170, 341, 340, 171,
716 172, 267, 339, 338, 169, 337, 336, 170, 282, 282,
717 282, 282, 267, 171, 191, 335, 189, 189, 189, 189,
718 334, 273, 273, 273, 273, 333, 192, 193, 332, 331,
719 194, 195, 267, 328, 327, 192, 326, 291, 193, 190,
720 190, 190, 190, 267, 194, 158, 159, 155, 322, 160,
721 191, 321, 189, 189, 189, 189, 320, 262, 244, 244,
723 244, 244, 259, 193, 155, 197, 197, 197, 197, 256,
724 286, 246, 286, 308, 193, 287, 287, 287, 287, 277,
725 277, 277, 247, 248, 249, 250, 307, 243, 243, 243,
726 243, 306, 190, 190, 190, 190, 238, 251, 252, 301,
727 300, 253, 254, 283, 299, 298, 251, 224, 215, 252,
728 284, 284, 284, 284, 283, 253, 202, 202, 203, 202,
729 296, 283, 202, 202, 203, 202, 202, 202, 203, 202,
730 295, 291, 283, 205, 205, 206, 205, 205, 205, 206,
731 205, 205, 205, 206, 205, 292, 292, 292, 292, 291,
732 216, 216, 216, 216, 215, 217, 217, 218, 217, 217,
734 217, 218, 217, 217, 217, 218, 217, 220, 220, 221,
735 220, 220, 220, 221, 220, 220, 220, 221, 220, 227,
736 227, 227, 227, 234, 234, 235, 234, 234, 234, 235,
737 234, 234, 234, 235, 234, 302, 302, 302, 302, 259,
738 244, 244, 244, 244, 250, 199, 243, 243, 243, 243,
739 244, 244, 244, 244, 288, 288, 288, 252, 313, 313,
740 313, 303, 305, 305, 305, 305, 184, 155, 252, 155,
741 272, 271, 303, 309, 309, 309, 309, 270, 262, 265,
742 311, 152, 311, 148, 303, 312, 312, 312, 312, 257,
743 257, 257, 257, 259, 256, 303, 238, 256, 260, 260,
745 260, 260, 259, 317, 317, 317, 317, 318, 240, 318,
746 155, 155, 319, 319, 319, 319, 269, 269, 269, 269,
747 273, 273, 273, 273, 276, 276, 276, 276, 155, 152,
748 146, 267, 276, 276, 276, 276, 282, 282, 282, 282,
749 236, 323, 267, 323, 233, 232, 324, 324, 324, 324,
750 284, 284, 284, 284, 287, 287, 287, 287, 231, 230,
751 224, 283, 287, 287, 287, 287, 292, 292, 292, 292,
752 291, 222, 283, 302, 302, 302, 302, 259, 329, 155,
753 329, 155, 155, 330, 330, 330, 330, 305, 305, 305,
754 305, 309, 309, 309, 309, 312, 312, 312, 312, 152,
756 146, 219, 303, 312, 312, 312, 312, 317, 317, 317,
757 317, 215, 209, 303, 319, 319, 319, 319, 319, 319,
758 319, 319, 324, 324, 324, 324, 324, 324, 324, 324,
759 330, 330, 330, 330, 330, 330, 330, 330, 24, 24,
760 24, 24, 24, 24, 24, 24, 79, 79, 79, 79,
761 79, 79, 79, 79, 110, 110, 110, 110, 110, 110,
762 110, 110, 147, 207, 147, 147, 147, 147, 147, 147,
763 150, 150, 153, 204, 153, 153, 153, 153, 153, 153,
764 162, 162, 162, 199, 162, 162, 173, 173, 176, 176,
765 176, 176, 183, 184, 183, 183, 183, 183, 183, 183,
767 187, 186, 187, 187, 187, 187, 187, 187, 196, 182,
768 196, 196, 198, 155, 198, 198, 198, 198, 198, 198,
769 201, 155, 201, 201, 201, 201, 201, 201, 208, 208,
770 211, 211, 155, 211, 211, 214, 214, 214, 214, 223,
771 148, 223, 223, 223, 223, 223, 223, 226, 152, 226,
772 226, 226, 226, 226, 226, 228, 228, 229, 151, 229,
773 229, 237, 146, 237, 237, 237, 237, 237, 237, 241,
774 145, 241, 241, 241, 241, 241, 241, 245, 245, 245,
775 375, 245, 245, 255, 375, 255, 255, 258, 258, 258,
776 258, 261, 375, 261, 261, 261, 261, 261, 261, 264,
778 264, 266, 375, 266, 266, 266, 266, 266, 266, 268,
779 375, 268, 268, 278, 375, 375, 278, 279, 375, 279,
780 279, 289, 375, 375, 289, 290, 290, 290, 290, 293,
781 293, 294, 375, 294, 294, 297, 375, 297, 297, 304,
782 375, 304, 304, 314, 375, 375, 314, 316, 375, 316,
783 316, 325, 375, 325, 325, 23, 375, 375, 375, 375,
784 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
785 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
786 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
787 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
789 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
793 static yyconst flex_int16_t yy_chk
[1414] =
795 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
796 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
797 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
798 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
799 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
800 1, 1, 1, 1, 1, 1, 1, 3, 3, 3,
801 3, 3, 7, 8, 3, 3, 7, 8, 29, 3,
802 3, 3, 3, 3, 3, 26, 26, 26, 26, 32,
803 3, 3, 3, 36, 35, 36, 36, 36, 36, 44,
804 44, 36, 40, 45, 45, 32, 35, 29, 38, 40,
806 38, 38, 38, 38, 46, 46, 38, 47, 85, 50,
807 3, 47, 3, 4, 4, 4, 4, 4, 93, 93,
808 4, 4, 49, 370, 85, 4, 4, 4, 4, 4,
809 4, 54, 54, 54, 54, 56, 4, 4, 4, 42,
810 50, 42, 42, 42, 42, 48, 48, 48, 48, 48,
811 369, 49, 42, 48, 59, 87, 59, 59, 59, 59,
812 94, 94, 59, 42, 56, 368, 4, 87, 4, 5,
813 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
814 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
815 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
817 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
818 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
819 5, 5, 5, 5, 5, 5, 9, 9, 95, 95,
820 9, 9, 117, 176, 9, 9, 9, 176, 9, 9,
821 9, 9, 118, 9, 9, 9, 9, 60, 117, 60,
822 60, 60, 60, 367, 118, 60, 9, 11, 11, 11,
823 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
824 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
825 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
826 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
828 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
829 11, 11, 11, 11, 13, 13, 13, 13, 13, 66,
830 96, 13, 13, 366, 13, 13, 13, 13, 13, 13,
831 13, 13, 65, 65, 65, 65, 100, 13, 13, 13,
832 61, 61, 61, 61, 365, 92, 61, 127, 66, 96,
833 130, 63, 92, 63, 63, 63, 63, 68, 68, 68,
834 68, 97, 124, 124, 63, 100, 364, 13, 363, 13,
835 14, 14, 14, 14, 14, 63, 127, 14, 14, 130,
836 14, 14, 14, 14, 14, 14, 14, 14, 73, 73,
837 73, 73, 97, 14, 14, 14, 362, 76, 78, 78,
839 78, 78, 78, 81, 81, 81, 81, 123, 147, 76,
840 76, 76, 76, 158, 123, 76, 98, 98, 98, 98,
841 125, 125, 129, 14, 361, 14, 15, 15, 126, 126,
842 15, 76, 169, 169, 15, 76, 360, 147, 359, 15,
843 175, 175, 158, 15, 15, 15, 15, 16, 16, 358,
844 178, 16, 355, 129, 178, 16, 103, 103, 103, 103,
845 16, 171, 171, 171, 16, 16, 16, 16, 17, 112,
846 112, 112, 112, 134, 353, 134, 134, 134, 134, 192,
847 192, 134, 143, 143, 143, 143, 251, 251, 17, 17,
848 17, 17, 17, 17, 17, 17, 183, 17, 17, 17,
850 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
851 17, 17, 17, 17, 19, 19, 19, 19, 19, 352,
852 198, 19, 19, 223, 351, 183, 19, 19, 19, 19,
853 19, 19, 350, 141, 141, 141, 141, 19, 19, 19,
854 136, 141, 136, 136, 136, 136, 256, 237, 136, 198,
855 256, 139, 223, 139, 139, 139, 139, 144, 144, 144,
856 144, 194, 194, 194, 139, 274, 274, 19, 19, 19,
857 20, 20, 20, 20, 20, 139, 237, 20, 20, 253,
858 253, 253, 20, 20, 20, 20, 20, 20, 145, 145,
859 145, 145, 349, 20, 20, 20, 151, 151, 151, 151,
861 151, 156, 156, 156, 156, 163, 163, 163, 163, 170,
862 348, 170, 285, 285, 170, 170, 170, 170, 180, 180,
863 180, 180, 347, 20, 20, 20, 21, 21, 21, 21,
864 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
865 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
866 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
867 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
868 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
869 21, 21, 21, 39, 39, 310, 310, 39, 157, 261,
870 157, 157, 157, 157, 345, 344, 39, 39, 39, 39,
872 356, 157, 39, 181, 181, 181, 181, 343, 342, 39,
873 356, 340, 157, 182, 182, 182, 182, 339, 261, 338,
874 39, 39, 39, 41, 336, 41, 41, 41, 41, 334,
875 161, 161, 161, 161, 333, 41, 41, 332, 331, 41,
876 41, 161, 328, 327, 41, 326, 322, 41, 186, 186,
877 186, 186, 161, 41, 62, 321, 62, 62, 62, 62,
878 320, 168, 168, 168, 168, 308, 62, 62, 307, 306,
879 62, 62, 168, 301, 296, 62, 295, 290, 62, 188,
880 188, 188, 188, 168, 62, 137, 137, 280, 272, 137,
881 189, 271, 189, 189, 189, 189, 270, 266, 137, 137,
883 137, 137, 258, 189, 137, 197, 197, 197, 197, 255,
884 193, 137, 193, 249, 189, 193, 193, 193, 193, 277,
885 277, 277, 137, 137, 137, 138, 248, 138, 138, 138,
886 138, 247, 190, 190, 190, 190, 241, 138, 138, 233,
887 232, 138, 138, 190, 231, 230, 138, 226, 214, 138,
888 191, 191, 191, 191, 190, 138, 202, 202, 202, 202,
889 213, 191, 203, 203, 203, 203, 204, 204, 204, 204,
890 212, 208, 191, 205, 205, 205, 205, 206, 206, 206,
891 206, 207, 207, 207, 207, 209, 209, 209, 209, 209,
892 216, 216, 216, 216, 216, 217, 217, 217, 217, 218,
894 218, 218, 218, 219, 219, 219, 219, 220, 220, 220,
895 220, 221, 221, 221, 221, 222, 222, 222, 222, 227,
896 227, 227, 227, 234, 234, 234, 234, 235, 235, 235,
897 235, 236, 236, 236, 236, 240, 240, 240, 240, 240,
898 242, 242, 242, 242, 243, 201, 243, 243, 243, 243,
899 244, 244, 244, 244, 288, 288, 288, 243, 313, 313,
900 313, 244, 246, 246, 246, 246, 187, 174, 243, 167,
901 166, 165, 244, 250, 250, 250, 250, 164, 160, 159,
902 252, 154, 252, 153, 250, 252, 252, 252, 252, 257,
903 257, 257, 257, 150, 140, 250, 132, 257, 260, 260,
905 260, 260, 260, 265, 265, 265, 265, 267, 131, 267,
906 122, 121, 267, 267, 267, 267, 269, 269, 269, 269,
907 273, 273, 273, 273, 275, 275, 275, 275, 119, 116,
908 115, 273, 276, 276, 276, 276, 282, 282, 282, 282,
909 113, 283, 273, 283, 109, 108, 283, 283, 283, 283,
910 284, 284, 284, 284, 286, 286, 286, 286, 107, 106,
911 101, 284, 287, 287, 287, 287, 292, 292, 292, 292,
912 292, 99, 284, 302, 302, 302, 302, 302, 303, 91,
913 303, 90, 88, 303, 303, 303, 303, 305, 305, 305,
914 305, 309, 309, 309, 309, 311, 311, 311, 311, 84,
916 83, 82, 309, 312, 312, 312, 312, 317, 317, 317,
917 317, 77, 75, 309, 318, 318, 318, 318, 319, 319,
918 319, 319, 323, 323, 323, 323, 324, 324, 324, 324,
919 329, 329, 329, 329, 330, 330, 330, 330, 376, 376,
920 376, 376, 376, 376, 376, 376, 377, 377, 377, 377,
921 377, 377, 377, 377, 378, 378, 378, 378, 378, 378,
922 378, 378, 379, 74, 379, 379, 379, 379, 379, 379,
923 380, 380, 381, 69, 381, 381, 381, 381, 381, 381,
924 382, 382, 382, 67, 382, 382, 383, 383, 384, 384,
925 384, 384, 385, 58, 385, 385, 385, 385, 385, 385,
927 386, 57, 386, 386, 386, 386, 386, 386, 387, 55,
928 387, 387, 388, 53, 388, 388, 388, 388, 388, 388,
929 389, 52, 389, 389, 389, 389, 389, 389, 390, 390,
930 391, 391, 51, 391, 391, 392, 392, 392, 392, 393,
931 33, 393, 393, 393, 393, 393, 393, 394, 31, 394,
932 394, 394, 394, 394, 394, 395, 395, 396, 30, 396,
933 396, 397, 28, 397, 397, 397, 397, 397, 397, 398,
934 27, 398, 398, 398, 398, 398, 398, 399, 399, 399,
935 23, 399, 399, 400, 0, 400, 400, 401, 401, 401,
936 401, 402, 0, 402, 402, 402, 402, 402, 402, 403,
938 403, 404, 0, 404, 404, 404, 404, 404, 404, 405,
939 0, 405, 405, 406, 0, 0, 406, 407, 0, 407,
940 407, 408, 0, 0, 408, 409, 409, 409, 409, 410,
941 410, 411, 0, 411, 411, 412, 0, 412, 412, 413,
942 0, 413, 413, 414, 0, 0, 414, 415, 0, 415,
943 415, 416, 0, 416, 416, 375, 375, 375, 375, 375,
944 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
945 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
946 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
947 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
949 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
953 static yyconst flex_int16_t yy_rule_linenum
[77] =
955 165, 171, 177, 182, 187, 192, 195, 200, 205, 210,
956 215, 219, 224, 234, 239, 244, 248, 252, 255, 259,
957 265, 274, 282, 286, 290, 295, 301, 311, 316, 320,
958 325, 330, 332, 337, 342, 347, 363, 368, 373, 397,
959 412, 420, 427, 441, 456, 464, 468, 475, 480, 486,
960 490, 494, 498, 502, 506, 514, 519, 522, 525, 528,
961 531, 535, 540, 545, 552, 557, 562, 566, 570, 577,
962 582, 586, 590, 599, 601, 606
965 /* The intent behind this definition is that it'll catch
966 * any uses of REJECT which flex missed.
968 #define REJECT reject_used_but_not_detected
969 #define yymore() yymore_used_but_not_detected
970 #define YY_MORE_ADJ 0
971 #define YY_RESTORE_YY_MORE_OFFSET
977 * Copyright (C) 2007, The Perl Foundation.
981 * This pre-processor handles the macro layer of the
982 * PIR language. The following constructs are filtered
1001 #define YY_NO_UNISTD_H
1002 #include "macroparser.h"
1004 #define YY_EXTRA_TYPE struct lexer_state *
1007 extern macro_def
*find_macro(constant_table
*table
, char *name
);
1008 extern char *concat(char *str1
, char *str2
);
1014 The C89 standard does not define a strdup() in the C library,
1015 so define our own strdup. Function names beginning with "str"
1016 are reserved (I think), so make it dupstr, as that is what it
1017 does: duplicate a string.
1021 dupstr(char const * const source
) {
1022 char *newstring
= (char *)calloc(strlen(source
) + 1, sizeof (char));
1024 strcpy(newstring
, source
);
1030 See dupstr, except that this version takes the number of characters to be
1031 copied. Easy for copying a string except the quotes.
1035 dupstrn(char const * const source
, size_t num_chars
) {
1036 char *newstring
= (char *)calloc(num_chars
+ 1, sizeof (char));
1038 /* only copy num_chars characters */
1039 strncpy(newstring
, source
, num_chars
);
1045 Update location information. Handling of heredocs is buggy w.r.t. line no.
1050 update_location(char *scanned_string
, lexer_state
*lexer
) {
1051 char *iter
= scanned_string
;
1052 while (*iter
!= '\0') {
1061 Use these on a big file with macros, and check out whether there are unused rules.
1063 int ctr
[YY_NUM_RULES
];
1064 int num_rules
= YY_NUM_RULES
;
1067 /* after a rule is matched, execute this block of code to keep track of the line no. */
1068 #define YY_USER_ACTION { ++ctr[yy_act]; \
1069 update_location(yytext, macroget_extra(yyscanner)); \
1074 static int is_pir_directive(char *name
);
1086 #line 1087 "macrolexer.c"
1096 #define MACROLOCAL 8
1097 #define BRACEDARGS 9
1100 #ifndef YY_NO_UNISTD_H
1101 /* Special case for "unistd.h", since it is non-ANSI. We include it way
1102 * down here because we want the user's section 1 to have been scanned first.
1103 * The user has a chance to override it with an option.
1112 #ifndef YY_EXTRA_TYPE
1113 #define YY_EXTRA_TYPE void *
1116 /* %if-c-only Reentrant structure and macros (non-C++). */
1119 /* Holds the entire state of the reentrant scanner. */
1123 /* User-defined. Not touched by flex. */
1124 YY_EXTRA_TYPE yyextra_r
;
1126 /* The rest are the same as the globals declared in the non-reentrant scanner. */
1127 FILE *yyin_r
, *yyout_r
;
1128 size_t yy_buffer_stack_top
; /**< index of top of stack. */
1129 size_t yy_buffer_stack_max
; /**< capacity of stack. */
1130 YY_BUFFER_STATE
* yy_buffer_stack
; /**< Stack as an array. */
1137 int yy_did_buffer_switch_on_eof
;
1138 int yy_start_stack_ptr
;
1139 int yy_start_stack_depth
;
1140 int *yy_start_stack
;
1141 yy_state_type yy_last_accepting_state
;
1142 char* yy_last_accepting_cpos
;
1145 int yy_flex_debug_r
;
1153 }; /* end struct yyguts_t */
1157 static int yy_init_globals (yyscan_t yyscanner
);
1163 /* This must go here because YYSTYPE and YYLTYPE are included
1164 * from bison output in section 1.*/
1165 # define yylval yyg->yylval_r
1167 int macrolex_init (yyscan_t
* scanner
);
1169 int macrolex_init_extra (YY_EXTRA_TYPE user_defined
,yyscan_t
* scanner
);
1173 /* %endif End reentrant structures and macros. */
1175 /* Accessor methods to globals.
1176 These are made visible to non-reentrant scanners for convenience. */
1178 int macrolex_destroy (yyscan_t yyscanner
);
1180 int macroget_debug (yyscan_t yyscanner
);
1182 void macroset_debug (int debug_flag
,yyscan_t yyscanner
);
1184 YY_EXTRA_TYPE
macroget_extra (yyscan_t yyscanner
);
1186 void macroset_extra (YY_EXTRA_TYPE user_defined
,yyscan_t yyscanner
);
1188 FILE *macroget_in (yyscan_t yyscanner
);
1190 void macroset_in (FILE * in_str
,yyscan_t yyscanner
);
1192 FILE *macroget_out (yyscan_t yyscanner
);
1194 void macroset_out (FILE * out_str
,yyscan_t yyscanner
);
1196 int macroget_leng (yyscan_t yyscanner
);
1198 char *macroget_text (yyscan_t yyscanner
);
1200 int macroget_lineno (yyscan_t yyscanner
);
1202 void macroset_lineno (int line_number
,yyscan_t yyscanner
);
1204 /* %if-bison-bridge */
1206 YYSTYPE
* macroget_lval (yyscan_t yyscanner
);
1208 void macroset_lval (YYSTYPE
* yylval_param
,yyscan_t yyscanner
);
1212 /* Macros after this point can all be overridden by user definitions in
1216 #ifndef YY_SKIP_YYWRAP
1218 extern "C" int macrowrap (yyscan_t yyscanner
);
1220 extern int macrowrap (yyscan_t yyscanner
);
1224 /* %not-for-header */
1226 /* %ok-for-header */
1231 static void yy_flex_strncpy (char *,yyconst
char *,int ,yyscan_t yyscanner
);
1234 #ifdef YY_NEED_STRLEN
1235 static int yy_flex_strlen (yyconst
char * ,yyscan_t yyscanner
);
1239 /* %if-c-only Standard (non-C++) definition */
1240 /* %not-for-header */
1243 static int yyinput (yyscan_t yyscanner
);
1245 static int input (yyscan_t yyscanner
);
1247 /* %ok-for-header */
1254 static void yy_push_state (int new_state
,yyscan_t yyscanner
);
1256 static void yy_pop_state (yyscan_t yyscanner
);
1260 /* Amount of stuff to slurp up with each read. */
1261 #ifndef YY_READ_BUF_SIZE
1262 #define YY_READ_BUF_SIZE 8192
1265 /* Copy whatever the last rule matched to the standard output. */
1267 /* %if-c-only Standard (non-C++) definition */
1268 /* This used to be an fputs(), but since the string might contain NUL's,
1269 * we now use fwrite().
1271 #define ECHO fwrite( yytext, yyleng, 1, yyout )
1273 /* %if-c++-only C++ definition */
1277 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1278 * is returned in "result".
1281 #define YY_INPUT(buf,result,max_size) \
1282 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
1283 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1287 for ( n = 0; n < max_size && \
1288 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1289 buf[n] = (char) c; \
1291 buf[n++] = (char) c; \
1292 if ( c == EOF && ferror( yyin ) ) \
1293 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1299 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
1301 if( errno != EINTR) \
1303 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1311 /* %if-c++-only C++ definition \ */\
1316 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1317 * we don't want an extra ';' after the "return" because that will cause
1318 * some compilers to complain about unreachable statements.
1321 #define yyterminate() return YY_NULL
1324 /* Number of entries by which start-condition stack grows. */
1325 #ifndef YY_START_STACK_INCR
1326 #define YY_START_STACK_INCR 25
1329 /* Report a fatal error. */
1330 #ifndef YY_FATAL_ERROR
1332 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1338 /* %if-tables-serialization structures and prototypes */
1339 /* %not-for-header */
1341 /* %ok-for-header */
1343 /* %not-for-header */
1345 /* %tables-yydmap generated elements */
1347 /* end tables serialization structures and prototypes */
1349 /* %ok-for-header */
1351 /* Default declaration of generated scanner - a define so the user can
1352 * easily add parameters.
1355 #define YY_DECL_IS_OURS 1
1356 /* %if-c-only Standard (non-C++) definition */
1358 extern int macrolex \
1359 (YYSTYPE
* yylval_param
,yyscan_t yyscanner
);
1361 #define YY_DECL int macrolex \
1362 (YYSTYPE * yylval_param , yyscan_t yyscanner)
1364 /* %if-c++-only C++ definition */
1366 #endif /* !YY_DECL */
1368 /* Code executed at the beginning of each rule, after yytext and yyleng
1371 #ifndef YY_USER_ACTION
1372 #define YY_USER_ACTION
1375 /* Code executed at the end of each rule. */
1377 #define YY_BREAK break;
1380 /* %% [6.0] YY_RULE_SETUP definition goes here */
1381 #define YY_RULE_SETUP \
1384 /* %not-for-header */
1386 /** The main scanner function which does all the work.
1390 register yy_state_type yy_current_state
;
1391 register char *yy_cp
, *yy_bp
;
1392 register int yy_act
;
1393 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
1395 /* %% [7.0] user's declarations go here */
1401 #line 1402 "macrolexer.c"
1403 yylval
= yylval_param
;
1405 if ( !yyg
->yy_init
)
1413 if ( ! yyg
->yy_start
)
1414 yyg
->yy_start
= 1; /* first start state */
1430 if ( ! YY_CURRENT_BUFFER
) {
1431 macroensure_buffer_stack (yyscanner
);
1432 YY_CURRENT_BUFFER_LVALUE
=
1433 macro_create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
1436 macro_load_buffer_state(yyscanner
);
1439 while ( 1 ) /* loops until end-of-file is reached */
1441 /* %% [8.0] yymore()-related code goes here */
1442 yy_cp
= yyg
->yy_c_buf_p
;
1444 /* Support of yytext. */
1445 *yy_cp
= yyg
->yy_hold_char
;
1447 /* yy_bp points to the position in yy_ch_buf of the start of
1452 /* %% [9.0] code to set up and find next match goes here */
1453 yy_current_state
= yyg
->yy_start
;
1457 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
1458 if ( yy_accept
[yy_current_state
] )
1460 yyg
->yy_last_accepting_state
= yy_current_state
;
1461 yyg
->yy_last_accepting_cpos
= yy_cp
;
1463 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1465 yy_current_state
= (int) yy_def
[yy_current_state
];
1466 if ( yy_current_state
>= 376 )
1467 yy_c
= yy_meta
[(unsigned int) yy_c
];
1469 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1472 while ( yy_current_state
!= 375 );
1473 yy_cp
= yyg
->yy_last_accepting_cpos
;
1474 yy_current_state
= yyg
->yy_last_accepting_state
;
1477 /* %% [10.0] code to find the action number goes here */
1478 yy_act
= yy_accept
[yy_current_state
];
1480 YY_DO_BEFORE_ACTION
;
1482 /* %% [11.0] code for yylineno update goes here */
1484 do_action
: /* This label is used only to access EOF actions. */
1486 /* %% [12.0] debug code goes here */
1487 if ( yy_flex_debug
)
1490 fprintf( stderr
, "--scanner backing up\n" );
1491 else if ( yy_act
< 77 )
1492 fprintf( stderr
, "--accepting rule at line %ld (\"%s\")\n",
1493 (long)yy_rule_linenum
[yy_act
], yytext
);
1494 else if ( yy_act
== 77 )
1495 fprintf( stderr
, "--accepting default rule (\"%s\")\n",
1497 else if ( yy_act
== 78 )
1498 fprintf( stderr
, "--(end of buffer or a NUL)\n" );
1500 fprintf( stderr
, "--EOF (start condition %d)\n", YY_START
);
1504 { /* beginning of action switch */
1505 /* %% [13.0] actions go here */
1506 case 0: /* must back up */
1507 /* undo the effects of YY_DO_BEFORE_ACTION */
1508 *yy_cp
= yyg
->yy_hold_char
;
1509 yy_cp
= yyg
->yy_last_accepting_cpos
;
1510 yy_current_state
= yyg
->yy_last_accepting_state
;
1511 goto yy_find_action
;
1514 /* rule 1 can match eol */
1518 yy_pop_state(yyscanner
);
1519 yylval
->sval
= dupstr("\n");
1524 /* rule 2 can match eol */
1527 { /* after macro header start the macro body */
1528 yy_push_state(MACROBODY
, yyscanner
);
1529 yylval
->sval
= dupstr("\n");
1534 /* rule 3 can match eol */
1537 { /* return newlines in macro body as any tokens */
1538 yylval
->sval
= dupstr("\n");
1543 /* rule 4 can match eol */
1546 { yy_pop_state(yyscanner
);
1547 yylval
->sval
= "\n";
1552 /* rule 5 can match eol */
1555 { yy_pop_state(yyscanner
);
1556 yylval
->sval
= "\n";
1561 /* rule 6 can match eol */
1564 { yylval
->sval
= "\n"; return TK_ANY
; }
1570 yy_push_state(LINE
, yyscanner
);
1578 yy_push_state(INCLUDE
, yyscanner
);
1586 yy_push_state(CONSTDEF
, yyscanner
);
1587 return TK_MACRO_CONST
;
1594 yy_push_state(MACROPAR
, yyscanner
);
1602 return TK_MACRO_LABEL
;
1608 { /* unique label declaration using macro parameter */
1609 yylval
->sval
= dupstr(yytext
);
1616 { /* unique label declaration, add special marker. */
1617 yylval
->sval
= (char *)calloc(yyleng
+ 1 + 1, sizeof (char));
1618 /* stick a special marker "@" so we can recognize this as a label that
1621 strncpy(yylval
->sval
, yytext
, yyleng
- 1);
1622 strcpy(yylval
->sval
+ yyleng
- 1, "@:");
1629 { /* referring to a declared label or local id. */
1630 yylval
->sval
= dupstr(yytext
);
1637 { /* unique local declaration */
1638 yy_push_state(MACROLOCAL
, yyscanner
);
1639 return TK_MACRO_LOCAL
;
1645 { yylval
->sval
= dupstr("int");
1652 { yylval
->sval
= dupstr("num");
1659 { yylval
->sval
= dupstr("pmc");
1666 { yylval
->sval
= dupstr("string");
1673 { /* unique local id declaration */
1674 yylval
->sval
= dupstr(yytext
);
1675 yy_pop_state(yyscanner
);
1682 { /* unique local id declaration -- non-parameter */
1683 yylval
->sval
= (char *)calloc(yyleng
+ 1 + 1, sizeof (char));
1684 strcpy(yylval
->sval
, yytext
);
1685 /* add special marker that this token needs munging later */
1686 yylval
->sval
[yyleng
] = '@';
1687 yy_pop_state(yyscanner
);
1694 { /* when reading ".endm" while scanning macro body, go back to previous state */
1696 yy_pop_state(yyscanner
);
1697 yy_pop_state(yyscanner
);
1705 { /* recognize "(" when scanning macro parameter list */
1712 { /* recognize "," when scanning macro parameter list */
1719 { /* recognize ")" when scanning a macro parameter list */
1726 { /* recognize "(" when expanding a macro */
1727 yy_push_state(EXPARGS
, yyscanner
);
1732 /* rule 27 can match eol */
1735 { /* anything except a ")" in this state means a constant expansion, which
1736 * has no arguments. This works, because if we did see a '(', the
1737 * state EXPARGS is activated.
1739 yylval
->sval
= dupstr(yytext
);
1740 yy_pop_state(yyscanner
);
1748 yylval
->sval
= dupstr(yytext
);
1763 yy_pop_state(yyscanner
);
1770 { /* braced argument */
1771 yy_push_state(BRACEDARGS
, yyscanner
);
1778 { yylval
->sval
= dupstr(" "); return TK_ANY
; }
1781 /* rule 33 can match eol */
1785 yylval
->sval
= dupstr(yytext
);
1793 yy_pop_state(yyscanner
);
1800 { /* variable argument of macro expansion */
1801 yylval
->sval
= dupstr(yytext
);
1809 lexer_state
*lexer
= macroget_extra(yyscanner
);
1810 macro_def
*macro
= find_macro(lexer
->globaldefinitions
, dupstr(yytext
+ 1));
1812 if (macro
!= NULL
) {
1813 yylval
->sval
= macro
->body
;
1817 fprintf(stderr
, "Error: cannot find expansion for %s\n", yytext
+ 1);
1825 { /* register can be an argument for macro expansion. */
1826 yylval
->sval
= dupstr(yytext
);
1833 { /* constant or macro parameter ID */
1834 yylval
->sval
= dupstr(yytext
);
1841 { /* directive, constant, macro or method-call */
1842 if (is_pir_directive(yytext
)) {
1843 yylval
->sval
= dupstr(yytext
);
1846 else { /* not a directive */
1847 lexer_state
*lexer
= macroget_extra(yyscanner
);
1848 macro_def
*macro
= find_macro(lexer
->globaldefinitions
, yytext
+ 1);
1849 if (macro
!= NULL
) { /* it's a macro! */
1850 /* only go into EXPAND state if it's a macro/constant */
1851 yy_push_state(EXPAND
, yyscanner
);
1852 yylval
->mval
= macro
; /* pass the pointer to the macro_def */
1853 return TK_DOT_IDENT
;
1855 else { /* it's not a macro, just a method-call, but if it was supposed
1856 to be a macro expansion, we will only see the error in the pir
1859 yylval
->sval
= dupstr(yytext
);
1869 lexer_state
*lexer
= macroget_extra(yyscanner
);
1870 macro_def
*macro
= find_macro(lexer
->globaldefinitions
, /* skip "$" and ":" */
1871 dupstrn(yytext
+ 1, yyleng
- 2));
1873 if (macro
!= NULL
) { /* found the parameter */
1874 yylval
->sval
= macro
->body
; /* expand the macro-parameter */
1875 return TK_LABEL_EXPANSION
;
1878 fprintf(stderr
, "Error: cannot find expansion for '%s'\n", yytext
);
1886 { /* this label was declared unique by ".macro_label foo:" but was munged so we
1887 can recognize it now, and return a signal to the parser it needs to
1888 munge it into a unique ID.
1890 yylval
->sval
= dupstrn(yytext
, yyleng
- 2);
1891 return TK_UNIQUE_LABEL
;
1897 { /* this local was declared unique by ".macro_local", but was munged so we can
1900 yylval
->sval
= dupstrn(yytext
, yyleng
- 1);
1901 return TK_UNIQUE_LOCAL
;
1907 { /* expanding a declared variable (local or label) */
1908 lexer_state
*lexer
= macroget_extra(yyscanner
);
1909 macro_def
*macro
= find_macro(lexer
->globaldefinitions
, yytext
+ 2);
1911 if (macro
!= NULL
) { /**/
1912 yylval
->sval
= macro
->body
;
1913 return TK_VAR_EXPANSION
;
1916 fprintf(stderr
, "Error: cannot find expansion for symbol '%s'\n", yytext
);
1925 lexer_state
*lexer
= macroget_extra(yyscanner
);
1926 macro_def
*macro
= find_macro(lexer
->globaldefinitions
, yytext
+ 1);
1927 if (macro
!= NULL
) { /* */
1928 yylval
->sval
= macro
->body
;
1929 return TK_VAR_EXPANSION
;
1932 fprintf(stderr
, "Error: cannot find expansion for parameter '%s'\n", yytext
+ 1);
1942 {/* treat ".'foo'" or ".$P0" as 1 token to prevent the tokens are separated
1943 * by a space; they clearly belong to each other if they were written
1944 * together (without a space). This is a method-call, life foo .'bar'().
1946 yylval
->sval
= dupstr(yytext
);
1959 yylval
->sval
= dupstr(yytext
);
1967 yylval
->sval
= dupstr(yytext
);
1974 { /* in all other cases (than the above), treat a comma just as any token. */
1975 yylval
->sval
= dupstr(yytext
);
1983 yylval
->sval
= dupstr(yytext
);
1990 { yylval
->sval
= dupstr(yytext
);
1997 { yylval
->sval
= dupstr(yytext
);
2004 { yylval
->sval
= dupstr(yytext
);
2011 { yylval
->sval
= dupstr(yytext
);
2018 { /* a quoted string is needed for an .include or the value of a
2019 * macro constant. After this token, leave the current state.
2021 yylval
->sval
= dupstr(yytext
);
2022 yy_pop_state(yyscanner
);
2029 { /* quoted strings argument for macro expansion */
2030 yylval
->sval
= dupstr(yytext
);
2037 { yylval
->sval
= dupstr(yytext
);
2044 { yylval
->sval
= dupstr(yytext
);
2051 { yylval
->sval
= dupstr(yytext
);
2058 { yylval
->sval
= dupstr(yytext
);
2065 { yylval
->sval
= dupstr(yytext
);
2073 yylval
->sval
= dupstr(yytext
);
2080 { /* quoted string */
2081 yylval
->sval
= dupstr(yytext
);
2089 yylval
->sval
= dupstr(yytext
);
2097 yylval
->sval
= dupstr(yytext
);
2104 { /* expansions in a macro body; ignore for now. */
2105 yylval
->sval
= dupstr(yytext
);
2112 { yylval
->sval
= dupstr(yytext
);
2119 { yylval
->sval
= dupstr(yytext
);
2126 { yylval
->sval
= dupstr(yytext
);
2133 { /* normal label */
2134 yylval
->sval
= dupstr(yytext
);
2141 { yylval
->sval
= dupstr(yytext
);
2148 { yylval
->sval
= dupstr(yytext
);
2155 { yylval
->sval
= dupstr(yytext
);
2159 case YY_STATE_EOF(INITIAL
):
2160 case YY_STATE_EOF(MACRODEF
):
2161 case YY_STATE_EOF(CONSTDEF
):
2162 case YY_STATE_EOF(INCLUDE
):
2163 case YY_STATE_EOF(MACROPAR
):
2164 case YY_STATE_EOF(MACROBODY
):
2165 case YY_STATE_EOF(EXPAND
):
2166 case YY_STATE_EOF(LINE
):
2167 case YY_STATE_EOF(MACROLOCAL
):
2168 case YY_STATE_EOF(BRACEDARGS
):
2169 case YY_STATE_EOF(EXPARGS
):
2171 { /* when end of file or end of string buffer, stop scanning. */
2178 { /* skip whitespace */ }
2181 /* rule 75 can match eol */
2184 { /* in all other states, return newline as the newline token */
2185 yylval
->sval
= dupstr("\n");
2192 { /* just return any single character token we didn't match before. */
2193 yylval
->sval
= dupstr(yytext
);
2202 #line 2203 "macrolexer.c"
2204 case YY_END_OF_BUFFER
:
2206 /* Amount of text matched not including the EOB char. */
2207 int yy_amount_of_matched_text
= (int) (yy_cp
- yyg
->yytext_ptr
) - 1;
2209 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2210 *yy_cp
= yyg
->yy_hold_char
;
2211 YY_RESTORE_YY_MORE_OFFSET
2213 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
2215 /* We're scanning a new file or input source. It's
2216 * possible that this happened because the user
2217 * just pointed yyin at a new source and called
2218 * macrolex(). If so, then we have to assure
2219 * consistency between YY_CURRENT_BUFFER and our
2220 * globals. Here is the right place to do so, because
2221 * this is the first action (other than possibly a
2222 * back-up) that will match for the new input source.
2224 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
2225 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
2226 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
2229 /* Note that here we test for yy_c_buf_p "<=" to the position
2230 * of the first EOB in the buffer, since yy_c_buf_p will
2231 * already have been incremented past the NUL character
2232 * (since all states make transitions on EOB to the
2233 * end-of-buffer state). Contrast this with the test
2236 if ( yyg
->yy_c_buf_p
<= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
2237 { /* This was really a NUL. */
2238 yy_state_type yy_next_state
;
2240 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
2242 yy_current_state
= yy_get_previous_state( yyscanner
);
2244 /* Okay, we're now positioned to make the NUL
2245 * transition. We couldn't have
2246 * yy_get_previous_state() go ahead and do it
2247 * for us because it doesn't know how to deal
2248 * with the possibility of jamming (and we don't
2249 * want to build jamming into it because then it
2250 * will run more slowly).
2253 yy_next_state
= yy_try_NUL_trans( yy_current_state
, yyscanner
);
2255 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2257 if ( yy_next_state
)
2259 /* Consume the NUL. */
2260 yy_cp
= ++yyg
->yy_c_buf_p
;
2261 yy_current_state
= yy_next_state
;
2267 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
2268 yy_cp
= yyg
->yy_last_accepting_cpos
;
2269 yy_current_state
= yyg
->yy_last_accepting_state
;
2270 goto yy_find_action
;
2274 else switch ( yy_get_next_buffer( yyscanner
) )
2276 case EOB_ACT_END_OF_FILE
:
2278 yyg
->yy_did_buffer_switch_on_eof
= 0;
2280 if ( macrowrap(yyscanner
) )
2282 /* Note: because we've taken care in
2283 * yy_get_next_buffer() to have set up
2284 * yytext, we can now set up
2285 * yy_c_buf_p so that if some total
2286 * hoser (like flex itself) wants to
2287 * call the scanner after we return the
2288 * YY_NULL, it'll still work - another
2289 * YY_NULL will get returned.
2291 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2293 yy_act
= YY_STATE_EOF(YY_START
);
2299 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
2305 case EOB_ACT_CONTINUE_SCAN
:
2307 yyg
->yytext_ptr
+ yy_amount_of_matched_text
;
2309 yy_current_state
= yy_get_previous_state( yyscanner
);
2311 yy_cp
= yyg
->yy_c_buf_p
;
2312 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2315 case EOB_ACT_LAST_MATCH
:
2317 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
];
2319 yy_current_state
= yy_get_previous_state( yyscanner
);
2321 yy_cp
= yyg
->yy_c_buf_p
;
2322 yy_bp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
;
2323 goto yy_find_action
;
2330 "fatal flex scanner internal error--no action found" );
2331 } /* end of action switch */
2332 } /* end of scanning one token */
2333 } /* end of macrolex */
2334 /* %ok-for-header */
2337 /* %not-for-header */
2339 /* %ok-for-header */
2343 /* yy_get_next_buffer - try to read in a new buffer
2345 * Returns a code representing an action:
2346 * EOB_ACT_LAST_MATCH -
2347 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2348 * EOB_ACT_END_OF_FILE - end of file
2351 static int yy_get_next_buffer (yyscan_t yyscanner
)
2356 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2357 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
2358 register char *source
= yyg
->yytext_ptr
;
2359 register int number_to_move
, i
;
2362 if ( yyg
->yy_c_buf_p
> &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] )
2364 "fatal flex scanner internal error--end of buffer missed" );
2366 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
2367 { /* Don't try to fill the buffer, so this is an EOF. */
2368 if ( yyg
->yy_c_buf_p
- yyg
->yytext_ptr
- YY_MORE_ADJ
== 1 )
2370 /* We matched a single character, the EOB, so
2371 * treat this as a final EOF.
2373 return EOB_ACT_END_OF_FILE
;
2378 /* We matched some text prior to the EOB, first
2381 return EOB_ACT_LAST_MATCH
;
2385 /* Try to read more data. */
2387 /* First move last chars to start of buffer. */
2388 number_to_move
= (int) (yyg
->yy_c_buf_p
- yyg
->yytext_ptr
) - 1;
2390 for ( i
= 0; i
< number_to_move
; ++i
)
2391 *(dest
++) = *(source
++);
2393 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
2394 /* don't do the read, it's not guaranteed to return an EOF,
2397 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
= 0;
2402 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
2404 while ( num_to_read
<= 0 )
2405 { /* Not enough room in the buffer - grow it. */
2407 /* just a shorter name for the current buffer */
2408 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
2410 int yy_c_buf_p_offset
=
2411 (int) (yyg
->yy_c_buf_p
- b
->yy_ch_buf
);
2413 if ( b
->yy_is_our_buffer
)
2415 int new_size
= b
->yy_buf_size
* 2;
2417 if ( new_size
<= 0 )
2418 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
2420 b
->yy_buf_size
*= 2;
2422 b
->yy_ch_buf
= (char *)
2423 /* Include room in for 2 EOB chars. */
2424 macrorealloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 ,yyscanner
);
2427 /* Can't grow it, we don't own it. */
2430 if ( ! b
->yy_ch_buf
)
2432 "fatal error - scanner input buffer overflow" );
2434 yyg
->yy_c_buf_p
= &b
->yy_ch_buf
[yy_c_buf_p_offset
];
2436 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
2441 if ( num_to_read
> YY_READ_BUF_SIZE
)
2442 num_to_read
= YY_READ_BUF_SIZE
;
2444 /* Read in more data. */
2445 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
2446 yyg
->yy_n_chars
, (size_t) num_to_read
);
2448 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2451 if ( yyg
->yy_n_chars
== 0 )
2453 if ( number_to_move
== YY_MORE_ADJ
)
2455 ret_val
= EOB_ACT_END_OF_FILE
;
2456 macrorestart(yyin
,yyscanner
);
2461 ret_val
= EOB_ACT_LAST_MATCH
;
2462 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
2463 YY_BUFFER_EOF_PENDING
;
2468 ret_val
= EOB_ACT_CONTINUE_SCAN
;
2470 if ((yy_size_t
) (yyg
->yy_n_chars
+ number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
2471 /* Extend the array by 50%, plus the number we really need. */
2472 yy_size_t new_size
= yyg
->yy_n_chars
+ number_to_move
+ (yyg
->yy_n_chars
>> 1);
2473 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) macrorealloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
,yyscanner
);
2474 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
2475 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
2478 yyg
->yy_n_chars
+= number_to_move
;
2479 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] = YY_END_OF_BUFFER_CHAR
;
2480 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
+ 1] = YY_END_OF_BUFFER_CHAR
;
2482 yyg
->yytext_ptr
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
2487 /* yy_get_previous_state - get the state just before the EOB char was reached */
2490 /* %not-for-header */
2492 static yy_state_type
yy_get_previous_state (yyscan_t yyscanner
)
2497 register yy_state_type yy_current_state
;
2498 register char *yy_cp
;
2499 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2501 /* %% [15.0] code to get the start state into yy_current_state goes here */
2502 yy_current_state
= yyg
->yy_start
;
2504 for ( yy_cp
= yyg
->yytext_ptr
+ YY_MORE_ADJ
; yy_cp
< yyg
->yy_c_buf_p
; ++yy_cp
)
2506 /* %% [16.0] code to find the next state goes here */
2507 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
2508 if ( yy_accept
[yy_current_state
] )
2510 yyg
->yy_last_accepting_state
= yy_current_state
;
2511 yyg
->yy_last_accepting_cpos
= yy_cp
;
2513 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
2515 yy_current_state
= (int) yy_def
[yy_current_state
];
2516 if ( yy_current_state
>= 376 )
2517 yy_c
= yy_meta
[(unsigned int) yy_c
];
2519 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
2522 return yy_current_state
;
2525 /* yy_try_NUL_trans - try to make a transition on the NUL character
2528 * next_state = yy_try_NUL_trans( current_state );
2531 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
, yyscan_t yyscanner
)
2536 register int yy_is_jam
;
2537 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
; /* This var may be unused depending upon options. */
2538 /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
2539 register char *yy_cp
= yyg
->yy_c_buf_p
;
2541 register YY_CHAR yy_c
= 1;
2542 if ( yy_accept
[yy_current_state
] )
2544 yyg
->yy_last_accepting_state
= yy_current_state
;
2545 yyg
->yy_last_accepting_cpos
= yy_cp
;
2547 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
2549 yy_current_state
= (int) yy_def
[yy_current_state
];
2550 if ( yy_current_state
>= 376 )
2551 yy_c
= yy_meta
[(unsigned int) yy_c
];
2553 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
2554 yy_is_jam
= (yy_current_state
== 375);
2556 return yy_is_jam
? 0 : yy_current_state
;
2566 static int yyinput (yyscan_t yyscanner
)
2568 static int input (yyscan_t yyscanner
)
2576 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2578 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2580 if ( *yyg
->yy_c_buf_p
== YY_END_OF_BUFFER_CHAR
)
2582 /* yy_c_buf_p now points to the character we want to return.
2583 * If this occurs *before* the EOB characters, then it's a
2584 * valid NUL; if not, then we've hit the end of the buffer.
2586 if ( yyg
->yy_c_buf_p
< &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[yyg
->yy_n_chars
] )
2587 /* This was really a NUL. */
2588 *yyg
->yy_c_buf_p
= '\0';
2591 { /* need more input */
2592 int offset
= yyg
->yy_c_buf_p
- yyg
->yytext_ptr
;
2595 switch ( yy_get_next_buffer( yyscanner
) )
2597 case EOB_ACT_LAST_MATCH
:
2598 /* This happens because yy_g_n_b()
2599 * sees that we've accumulated a
2600 * token and flags that we need to
2601 * try matching the token before
2602 * proceeding. But for input(),
2603 * there's no matching to consider.
2604 * So convert the EOB_ACT_LAST_MATCH
2605 * to EOB_ACT_END_OF_FILE.
2608 /* Reset buffer status. */
2609 macrorestart(yyin
,yyscanner
);
2613 case EOB_ACT_END_OF_FILE
:
2615 if ( macrowrap(yyscanner
) )
2618 if ( ! yyg
->yy_did_buffer_switch_on_eof
)
2621 return yyinput(yyscanner
);
2623 return input(yyscanner
);
2627 case EOB_ACT_CONTINUE_SCAN
:
2628 yyg
->yy_c_buf_p
= yyg
->yytext_ptr
+ offset
;
2634 c
= *(unsigned char *) yyg
->yy_c_buf_p
; /* cast for 8-bit char's */
2635 *yyg
->yy_c_buf_p
= '\0'; /* preserve yytext */
2636 yyg
->yy_hold_char
= *++yyg
->yy_c_buf_p
;
2638 /* %% [19.0] update BOL and yylineno */
2643 #endif /* ifndef YY_NO_INPUT */
2646 /** Immediately switch to a different input stream.
2647 * @param input_file A readable stream.
2648 * @param yyscanner The scanner object.
2649 * @note This function does not reset the start condition to @c INITIAL .
2652 void macrorestart (FILE * input_file
, yyscan_t yyscanner
)
2657 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2659 if ( ! YY_CURRENT_BUFFER
){
2660 macroensure_buffer_stack (yyscanner
);
2661 YY_CURRENT_BUFFER_LVALUE
=
2662 macro_create_buffer(yyin
,YY_BUF_SIZE
,yyscanner
);
2665 macro_init_buffer(YY_CURRENT_BUFFER
,input_file
,yyscanner
);
2666 macro_load_buffer_state(yyscanner
);
2669 /** Switch to a different input buffer.
2670 * @param new_buffer The new input buffer.
2671 * @param yyscanner The scanner object.
2674 void macro_switch_to_buffer (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
2679 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2681 /* TODO. We should be able to replace this entire function body
2683 * macropop_buffer_state();
2684 * macropush_buffer_state(new_buffer);
2686 macroensure_buffer_stack (yyscanner
);
2687 if ( YY_CURRENT_BUFFER
== new_buffer
)
2690 if ( YY_CURRENT_BUFFER
)
2692 /* Flush out information for old buffer. */
2693 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2694 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
2695 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2698 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2699 macro_load_buffer_state(yyscanner
);
2701 /* We don't actually know whether we did this switch during
2702 * EOF (macrowrap()) processing, but the only time this flag
2703 * is looked at is after macrowrap() is called, so it's safe
2704 * to go ahead and always set it.
2706 yyg
->yy_did_buffer_switch_on_eof
= 1;
2710 static void macro_load_buffer_state (yyscan_t yyscanner
)
2715 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2716 yyg
->yy_n_chars
= YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
2717 yyg
->yytext_ptr
= yyg
->yy_c_buf_p
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
2718 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
2719 yyg
->yy_hold_char
= *yyg
->yy_c_buf_p
;
2722 /** Allocate and initialize an input buffer state.
2723 * @param file A readable stream.
2724 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2725 * @param yyscanner The scanner object.
2726 * @return the allocated buffer state.
2729 YY_BUFFER_STATE
macro_create_buffer (FILE * file
, int size
, yyscan_t yyscanner
)
2736 b
= (YY_BUFFER_STATE
) macroalloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
2738 YY_FATAL_ERROR( "out of dynamic memory in macro_create_buffer()" );
2740 b
->yy_buf_size
= size
;
2742 /* yy_ch_buf has to be 2 characters longer than the size given because
2743 * we need to put in 2 end-of-buffer characters.
2745 b
->yy_ch_buf
= (char *) macroalloc(b
->yy_buf_size
+ 2 ,yyscanner
);
2746 if ( ! b
->yy_ch_buf
)
2747 YY_FATAL_ERROR( "out of dynamic memory in macro_create_buffer()" );
2749 b
->yy_is_our_buffer
= 1;
2751 macro_init_buffer(b
,file
,yyscanner
);
2756 /** Destroy the buffer.
2757 * @param b a buffer created with macro_create_buffer()
2758 * @param yyscanner The scanner object.
2761 void macro_delete_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
2766 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2771 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
2772 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
2774 if ( b
->yy_is_our_buffer
)
2775 macrofree((void *) b
->yy_ch_buf
,yyscanner
);
2777 macrofree((void *) b
,yyscanner
);
2787 /* Initializes or reinitializes a buffer.
2788 * This function is sometimes called more than once on the same buffer,
2789 * such as during a macrorestart() or at EOF.
2792 static void macro_init_buffer (YY_BUFFER_STATE b
, FILE * file
, yyscan_t yyscanner
)
2799 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2801 macro_flush_buffer(b
,yyscanner
);
2803 b
->yy_input_file
= file
;
2804 b
->yy_fill_buffer
= 1;
2806 /* If b is the current buffer, then macro_init_buffer was _probably_
2807 * called from macrorestart() or through yy_get_next_buffer.
2808 * In that case, we don't want to reset the lineno or column.
2810 if (b
!= YY_CURRENT_BUFFER
){
2811 b
->yy_bs_lineno
= 1;
2812 b
->yy_bs_column
= 0;
2817 b
->yy_is_interactive
= 0;
2825 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2826 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2827 * @param yyscanner The scanner object.
2830 void macro_flush_buffer (YY_BUFFER_STATE b
, yyscan_t yyscanner
)
2835 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2841 /* We always need two end-of-buffer characters. The first causes
2842 * a transition to the end-of-buffer state. The second causes
2843 * a jam in that state.
2845 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
2846 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
2848 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
2851 b
->yy_buffer_status
= YY_BUFFER_NEW
;
2853 if ( b
== YY_CURRENT_BUFFER
)
2854 macro_load_buffer_state(yyscanner
);
2858 /** Pushes the new state onto the stack. The new state becomes
2859 * the current state. This function will allocate the stack
2861 * @param new_buffer The new state.
2862 * @param yyscanner The scanner object.
2865 void macropush_buffer_state (YY_BUFFER_STATE new_buffer
, yyscan_t yyscanner
)
2870 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2871 if (new_buffer
== NULL
)
2874 macroensure_buffer_stack(yyscanner
);
2876 /* This block is copied from macro_switch_to_buffer. */
2877 if ( YY_CURRENT_BUFFER
)
2879 /* Flush out information for old buffer. */
2880 *yyg
->yy_c_buf_p
= yyg
->yy_hold_char
;
2881 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= yyg
->yy_c_buf_p
;
2882 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= yyg
->yy_n_chars
;
2885 /* Only push if top exists. Otherwise, replace top. */
2886 if (YY_CURRENT_BUFFER
)
2887 yyg
->yy_buffer_stack_top
++;
2888 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
2890 /* copied from macro_switch_to_buffer. */
2891 macro_load_buffer_state(yyscanner
);
2892 yyg
->yy_did_buffer_switch_on_eof
= 1;
2897 /** Removes and deletes the top of the stack, if present.
2898 * The next element becomes the new top.
2899 * @param yyscanner The scanner object.
2902 void macropop_buffer_state (yyscan_t yyscanner
)
2907 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2908 if (!YY_CURRENT_BUFFER
)
2911 macro_delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
2912 YY_CURRENT_BUFFER_LVALUE
= NULL
;
2913 if (yyg
->yy_buffer_stack_top
> 0)
2914 --yyg
->yy_buffer_stack_top
;
2916 if (YY_CURRENT_BUFFER
) {
2917 macro_load_buffer_state(yyscanner
);
2918 yyg
->yy_did_buffer_switch_on_eof
= 1;
2924 /* Allocates the stack if it does not exist.
2925 * Guarantees space for at least one push.
2928 static void macroensure_buffer_stack (yyscan_t yyscanner
)
2934 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
2936 if (!yyg
->yy_buffer_stack
) {
2938 /* First allocation is just for 2 elements, since we don't know if this
2939 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2940 * immediate realloc on the next call.
2943 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)macroalloc
2944 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
2946 if ( ! yyg
->yy_buffer_stack
)
2947 YY_FATAL_ERROR( "out of dynamic memory in macroensure_buffer_stack()" );
2949 memset(yyg
->yy_buffer_stack
, 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
2951 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2952 yyg
->yy_buffer_stack_top
= 0;
2956 if (yyg
->yy_buffer_stack_top
>= (yyg
->yy_buffer_stack_max
) - 1){
2958 /* Increase the buffer to prepare for a possible push. */
2959 int grow_size
= 8 /* arbitrary grow size */;
2961 num_to_alloc
= yyg
->yy_buffer_stack_max
+ grow_size
;
2962 yyg
->yy_buffer_stack
= (struct yy_buffer_state
**)macrorealloc
2963 (yyg
->yy_buffer_stack
,
2964 num_to_alloc
* sizeof(struct yy_buffer_state
*)
2966 if ( ! yyg
->yy_buffer_stack
)
2967 YY_FATAL_ERROR( "out of dynamic memory in macroensure_buffer_stack()" );
2969 /* zero only the new slots.*/
2970 memset(yyg
->yy_buffer_stack
+ yyg
->yy_buffer_stack_max
, 0, grow_size
* sizeof(struct yy_buffer_state
*));
2971 yyg
->yy_buffer_stack_max
= num_to_alloc
;
2977 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2978 * @param base the character buffer
2979 * @param size the size in bytes of the character buffer
2980 * @param yyscanner The scanner object.
2981 * @return the newly allocated buffer state object.
2983 YY_BUFFER_STATE
macro_scan_buffer (char * base
, yy_size_t size
, yyscan_t yyscanner
)
2988 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
2989 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
2990 /* They forgot to leave room for the EOB's. */
2993 b
= (YY_BUFFER_STATE
) macroalloc(sizeof( struct yy_buffer_state
) ,yyscanner
);
2995 YY_FATAL_ERROR( "out of dynamic memory in macro_scan_buffer()" );
2997 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
2998 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
2999 b
->yy_is_our_buffer
= 0;
3000 b
->yy_input_file
= 0;
3001 b
->yy_n_chars
= b
->yy_buf_size
;
3002 b
->yy_is_interactive
= 0;
3004 b
->yy_fill_buffer
= 0;
3005 b
->yy_buffer_status
= YY_BUFFER_NEW
;
3007 macro_switch_to_buffer(b
,yyscanner
);
3014 /** Setup the input buffer state to scan a string. The next call to macrolex() will
3015 * scan from a @e copy of @a str.
3016 * @param yystr a NUL-terminated string to scan
3017 * @param yyscanner The scanner object.
3018 * @return the newly allocated buffer state object.
3019 * @note If you want to scan bytes that may contain NUL values, then use
3020 * macro_scan_bytes() instead.
3022 YY_BUFFER_STATE
macro_scan_string (yyconst
char * yystr
, yyscan_t yyscanner
)
3025 return macro_scan_bytes(yystr
,strlen(yystr
) ,yyscanner
);
3030 /** Setup the input buffer state to scan the given bytes. The next call to macrolex() will
3031 * scan from a @e copy of @a bytes.
3032 * @param bytes the byte buffer to scan
3033 * @param len the number of bytes in the buffer pointed to by @a bytes.
3034 * @param yyscanner The scanner object.
3035 * @return the newly allocated buffer state object.
3037 YY_BUFFER_STATE
macro_scan_bytes (yyconst
char * yybytes
, int _yybytes_len
, yyscan_t yyscanner
)
3044 /* Get memory for full buffer, including space for trailing EOB's. */
3045 n
= _yybytes_len
+ 2;
3046 buf
= (char *) macroalloc(n
,yyscanner
);
3048 YY_FATAL_ERROR( "out of dynamic memory in macro_scan_bytes()" );
3050 for ( i
= 0; i
< _yybytes_len
; ++i
)
3051 buf
[i
] = yybytes
[i
];
3053 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
3055 b
= macro_scan_buffer(buf
,n
,yyscanner
);
3057 YY_FATAL_ERROR( "bad buffer in macro_scan_bytes()" );
3059 /* It's okay to grow etc. this buffer, and we should throw it
3060 * away when we're done.
3062 b
->yy_is_our_buffer
= 1;
3069 static void yy_push_state (int new_state
, yyscan_t yyscanner
)
3074 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3075 if ( yyg
->yy_start_stack_ptr
>= yyg
->yy_start_stack_depth
)
3079 yyg
->yy_start_stack_depth
+= YY_START_STACK_INCR
;
3080 new_size
= yyg
->yy_start_stack_depth
* sizeof( int );
3082 if ( ! yyg
->yy_start_stack
)
3083 yyg
->yy_start_stack
= (int *) macroalloc(new_size
,yyscanner
);
3086 yyg
->yy_start_stack
= (int *) macrorealloc((void *) yyg
->yy_start_stack
,new_size
,yyscanner
);
3088 if ( ! yyg
->yy_start_stack
)
3089 YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
3092 yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
++] = YY_START
;
3098 static void yy_pop_state (yyscan_t yyscanner
)
3103 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3104 if ( --yyg
->yy_start_stack_ptr
< 0 )
3105 YY_FATAL_ERROR( "start-condition stack underflow" );
3107 BEGIN(yyg
->yy_start_stack
[yyg
->yy_start_stack_ptr
]);
3110 #ifndef YY_EXIT_FAILURE
3111 #define YY_EXIT_FAILURE 2
3115 static void yy_fatal_error (yyconst
char* msg
, yyscan_t yyscanner
)
3117 (void) fprintf( stderr
, "%s\n", msg
);
3118 exit( YY_EXIT_FAILURE
);
3124 /* Redefine yyless() so it works in section 3 code. */
3130 /* Undo effects of setting up yytext. */ \
3131 int yyless_macro_arg = (n); \
3132 YY_LESS_LINENO(yyless_macro_arg);\
3133 yytext[yyleng] = yyg->yy_hold_char; \
3134 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
3135 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
3136 *yyg->yy_c_buf_p = '\0'; \
3137 yyleng = yyless_macro_arg; \
3141 /* Accessor methods (get/set functions) to struct members. */
3146 /** Get the user-defined data for this scanner.
3147 * @param yyscanner The scanner object.
3149 YY_EXTRA_TYPE
macroget_extra (yyscan_t yyscanner
)
3151 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3157 /** Get the current line number.
3158 * @param yyscanner The scanner object.
3160 int macroget_lineno (yyscan_t yyscanner
)
3162 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3164 if (! YY_CURRENT_BUFFER
)
3170 /** Get the current column number.
3171 * @param yyscanner The scanner object.
3173 int macroget_column (yyscan_t yyscanner
)
3175 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3177 if (! YY_CURRENT_BUFFER
)
3183 /** Get the input stream.
3184 * @param yyscanner The scanner object.
3186 FILE *macroget_in (yyscan_t yyscanner
)
3188 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3192 /** Get the output stream.
3193 * @param yyscanner The scanner object.
3195 FILE *macroget_out (yyscan_t yyscanner
)
3197 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3201 /** Get the length of the current token.
3202 * @param yyscanner The scanner object.
3204 int macroget_leng (yyscan_t yyscanner
)
3206 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3210 /** Get the current token.
3211 * @param yyscanner The scanner object.
3214 char *macroget_text (yyscan_t yyscanner
)
3216 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3222 /** Set the user-defined data. This data is never touched by the scanner.
3223 * @param user_defined The data to be associated with this scanner.
3224 * @param yyscanner The scanner object.
3226 void macroset_extra (YY_EXTRA_TYPE user_defined
, yyscan_t yyscanner
)
3228 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3229 yyextra
= user_defined
;
3234 /** Set the current line number.
3235 * @param line_number
3236 * @param yyscanner The scanner object.
3238 void macroset_lineno (int line_number
, yyscan_t yyscanner
)
3240 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3242 /* lineno is only valid if an input buffer exists. */
3243 if (! YY_CURRENT_BUFFER
)
3244 yy_fatal_error( "macroset_lineno called with no buffer" , yyscanner
);
3246 yylineno
= line_number
;
3249 /** Set the current column.
3250 * @param line_number
3251 * @param yyscanner The scanner object.
3253 void macroset_column (int column_no
, yyscan_t yyscanner
)
3255 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3257 /* column is only valid if an input buffer exists. */
3258 if (! YY_CURRENT_BUFFER
)
3259 yy_fatal_error( "macroset_column called with no buffer" , yyscanner
);
3261 yycolumn
= column_no
;
3264 /** Set the input stream. This does not discard the current
3266 * @param in_str A readable stream.
3267 * @param yyscanner The scanner object.
3268 * @see macro_switch_to_buffer
3270 void macroset_in (FILE * in_str
, yyscan_t yyscanner
)
3272 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3276 void macroset_out (FILE * out_str
, yyscan_t yyscanner
)
3278 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3282 int macroget_debug (yyscan_t yyscanner
)
3284 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3285 return yy_flex_debug
;
3288 void macroset_debug (int bdebug
, yyscan_t yyscanner
)
3290 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3291 yy_flex_debug
= bdebug
;
3297 /* Accessor methods for yylval and yylloc */
3299 /* %if-bison-bridge */
3301 YYSTYPE
* macroget_lval (yyscan_t yyscanner
)
3303 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3307 void macroset_lval (YYSTYPE
* yylval_param
, yyscan_t yyscanner
)
3309 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3310 yylval
= yylval_param
;
3315 /* User-visible API */
3317 /* macrolex_init is special because it creates the scanner itself, so it is
3318 * the ONLY reentrant function that doesn't take the scanner as the last argument.
3319 * That's why we explicitly handle the declaration, instead of using our macros.
3322 int macrolex_init(yyscan_t
* ptr_yy_globals
)
3325 if (ptr_yy_globals
== NULL
){
3330 *ptr_yy_globals
= (yyscan_t
) macroalloc ( sizeof( struct yyguts_t
), NULL
);
3332 if (*ptr_yy_globals
== NULL
){
3337 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
3338 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
3340 return yy_init_globals ( *ptr_yy_globals
);
3343 /* macrolex_init_extra has the same functionality as macrolex_init, but follows the
3344 * convention of taking the scanner as the last argument. Note however, that
3345 * this is a *pointer* to a scanner, as it will be allocated by this call (and
3346 * is the reason, too, why this function also must handle its own declaration).
3347 * The user defined value in the first argument will be available to macroalloc in
3348 * the yyextra field.
3351 int macrolex_init_extra(YY_EXTRA_TYPE yy_user_defined
,yyscan_t
* ptr_yy_globals
)
3354 struct yyguts_t dummy_yyguts
;
3356 macroset_extra (yy_user_defined
, &dummy_yyguts
);
3358 if (ptr_yy_globals
== NULL
){
3363 *ptr_yy_globals
= (yyscan_t
) macroalloc ( sizeof( struct yyguts_t
), &dummy_yyguts
);
3365 if (*ptr_yy_globals
== NULL
){
3370 /* By setting to 0xAA, we expose bugs in
3371 yy_init_globals. Leave at 0x00 for releases. */
3372 memset(*ptr_yy_globals
,0x00,sizeof(struct yyguts_t
));
3374 macroset_extra (yy_user_defined
, *ptr_yy_globals
);
3376 return yy_init_globals ( *ptr_yy_globals
);
3379 /* %endif if-c-only */
3382 static int yy_init_globals (yyscan_t yyscanner
)
3384 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3385 /* Initialization is the same as for the non-reentrant scanner.
3386 * This function is called from macrolex_destroy(), so don't allocate here.
3389 yyg
->yy_buffer_stack
= 0;
3390 yyg
->yy_buffer_stack_top
= 0;
3391 yyg
->yy_buffer_stack_max
= 0;
3392 yyg
->yy_c_buf_p
= (char *) 0;
3396 yyg
->yy_start_stack_ptr
= 0;
3397 yyg
->yy_start_stack_depth
= 0;
3398 yyg
->yy_start_stack
= NULL
;
3400 /* Defined in main.c */
3409 /* For future reference: Set errno on error, since we are called by
3416 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
3417 /* macrolex_destroy is for both reentrant and non-reentrant scanners. */
3418 int macrolex_destroy (yyscan_t yyscanner
)
3420 struct yyguts_t
* yyg
= (struct yyguts_t
*)yyscanner
;
3422 /* Pop the buffer stack, destroying each element. */
3423 while(YY_CURRENT_BUFFER
){
3424 macro_delete_buffer(YY_CURRENT_BUFFER
,yyscanner
);
3425 YY_CURRENT_BUFFER_LVALUE
= NULL
;
3426 macropop_buffer_state(yyscanner
);
3429 /* Destroy the stack itself. */
3430 macrofree(yyg
->yy_buffer_stack
,yyscanner
);
3431 yyg
->yy_buffer_stack
= NULL
;
3433 /* Destroy the start condition stack. */
3434 macrofree(yyg
->yy_start_stack
,yyscanner
);
3435 yyg
->yy_start_stack
= NULL
;
3437 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3438 * macrolex() is called, initialization will occur. */
3439 yy_init_globals( yyscanner
);
3442 /* Destroy the main struct (reentrant only). */
3443 macrofree ( yyscanner
, yyscanner
);
3451 * Internal utility routines.
3455 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
, yyscan_t yyscanner
)
3458 for ( i
= 0; i
< n
; ++i
)
3463 #ifdef YY_NEED_STRLEN
3464 static int yy_flex_strlen (yyconst
char * s
, yyscan_t yyscanner
)
3467 for ( n
= 0; s
[n
]; ++n
)
3474 void *macroalloc (yy_size_t size
, yyscan_t yyscanner
)
3476 return (void *) malloc( size
);
3479 void *macrorealloc (void * ptr
, yy_size_t size
, yyscan_t yyscanner
)
3481 /* The cast to (char *) in the following accommodates both
3482 * implementations that use char* generic pointers, and those
3483 * that use void* generic pointers. It works with the latter
3484 * because both ANSI C and C++ allow castless assignment from
3485 * any pointer type to void*, and deal with argument conversions
3486 * as though doing an assignment.
3488 return (void *) realloc( (char *) ptr
, size
);
3491 void macrofree (void * ptr
, yyscan_t yyscanner
)
3493 free( (char *) ptr
); /* see macrorealloc() for (char *) cast */
3496 /* %if-tables-serialization definitions */
3497 /* %define-yytables The name for this specific scanner's tables. */
3498 #define YYTABLES_NAME "yytables"
3501 /* %ok-for-header */
3514 =item C<is_pir_directive>
3516 Returns a non-zero value if the specified name is a PIR directive.
3520 is_pir_directive(char *name
) {
3522 /* maybe make this a hash or at least a binary search.
3523 * Or, make these "special" macros, and have them expand
3524 * to their own spelling. This would remove the need
3525 * for special code, such as this.
3527 static char * const directives
[] = {
3553 NULL
/* needed to easily write loops on this array */
3556 /* iter is a pointer to constant "char *" (strings). */
3557 char * const *iter
= directives
;
3559 while (*iter
!= NULL
) {
3560 if (strcmp(*iter
, name
) == 0) {
3580 * c-file-style: "parrot"
3582 * vim: expandtab shiftwidth=4: