tagged release 0.7.1
[parrot.git] / compilers / pirc / new / pirlexer.c
blobe09d0f59f62e9eca6a701fed7be751e5c66c9b61
1 #line 2 "pirlexer.c"
3 #line 4 "pirlexer.c"
5 #define YY_INT_ALIGNED short int
7 /* A lexical scanner generated by flex */
9 #define FLEX_SCANNER
10 #define YY_FLEX_MAJOR_VERSION 2
11 #define YY_FLEX_MINOR_VERSION 5
12 #define YY_FLEX_SUBMINOR_VERSION 33
13 #if YY_FLEX_SUBMINOR_VERSION > 0
14 #define FLEX_BETA
15 #endif
17 /* %if-c++-only */
18 /* %endif */
20 /* %if-c-only */
22 /* %endif */
24 /* %if-c-only */
26 /* %endif */
28 /* First, we deal with platform-specific or compiler-specific issues. */
30 /* begin standard C headers. */
31 /* %if-c-only */
32 #include <stdio.h>
33 #include <string.h>
34 #include <errno.h>
35 #include <stdlib.h>
36 /* %endif */
38 /* %if-tables-serialization */
39 /* %endif */
40 /* end standard C headers. */
42 /* %if-c-or-c++ */
43 /* flex integer type definitions */
45 #ifndef FLEXINT_H
46 #define FLEXINT_H
48 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
50 #if __STDC_VERSION__ >= 199901L
52 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
53 * if you want the limit (max/min) macros for int types.
55 #ifndef __STDC_LIMIT_MACROS
56 #define __STDC_LIMIT_MACROS 1
57 #endif
59 #include <inttypes.h>
60 typedef int8_t flex_int8_t;
61 typedef uint8_t flex_uint8_t;
62 typedef int16_t flex_int16_t;
63 typedef uint16_t flex_uint16_t;
64 typedef int32_t flex_int32_t;
65 typedef uint32_t flex_uint32_t;
66 #else
67 typedef signed char flex_int8_t;
68 typedef short int flex_int16_t;
69 typedef int flex_int32_t;
70 typedef unsigned char flex_uint8_t;
71 typedef unsigned short int flex_uint16_t;
72 typedef unsigned int flex_uint32_t;
73 #endif /* ! C99 */
75 /* Limits of integral types. */
76 #ifndef INT8_MIN
77 #define INT8_MIN (-128)
78 #endif
79 #ifndef INT16_MIN
80 #define INT16_MIN (-32767-1)
81 #endif
82 #ifndef INT32_MIN
83 #define INT32_MIN (-2147483647-1)
84 #endif
85 #ifndef INT8_MAX
86 #define INT8_MAX (127)
87 #endif
88 #ifndef INT16_MAX
89 #define INT16_MAX (32767)
90 #endif
91 #ifndef INT32_MAX
92 #define INT32_MAX (2147483647)
93 #endif
94 #ifndef UINT8_MAX
95 #define UINT8_MAX (255U)
96 #endif
97 #ifndef UINT16_MAX
98 #define UINT16_MAX (65535U)
99 #endif
100 #ifndef UINT32_MAX
101 #define UINT32_MAX (4294967295U)
102 #endif
104 #endif /* ! FLEXINT_H */
106 /* %endif */
108 /* %if-c++-only */
109 /* %endif */
111 #ifdef __cplusplus
113 /* The "const" storage-class-modifier is valid. */
114 #define YY_USE_CONST
116 #else /* ! __cplusplus */
118 #if __STDC__
120 #define YY_USE_CONST
122 #endif /* __STDC__ */
123 #endif /* ! __cplusplus */
125 #ifdef YY_USE_CONST
126 #define yyconst const
127 #else
128 #define yyconst
129 #endif
131 /* %not-for-header */
133 /* Returned upon end-of-file. */
134 #define YY_NULL 0
135 /* %ok-for-header */
137 /* %not-for-header */
139 /* Promotes a possibly negative, possibly signed char to an unsigned
140 * integer for use as an array index. If the signed char is negative,
141 * we want to instead treat it as an 8-bit unsigned char, hence the
142 * double cast.
144 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
145 /* %ok-for-header */
147 /* %if-reentrant */
149 /* An opaque pointer. */
150 #ifndef YY_TYPEDEF_YY_SCANNER_T
151 #define YY_TYPEDEF_YY_SCANNER_T
152 typedef void* yyscan_t;
153 #endif
155 /* For convenience, these vars (plus the bison vars far below)
156 are macros in the reentrant scanner. */
157 #define yyin yyg->yyin_r
158 #define yyout yyg->yyout_r
159 #define yyextra yyg->yyextra_r
160 #define yyleng yyg->yyleng_r
161 #define yytext yyg->yytext_r
162 #define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
163 #define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
164 #define yy_flex_debug yyg->yy_flex_debug_r
166 int yylex_init (yyscan_t* scanner);
167 /* %endif */
169 /* %if-not-reentrant */
170 /* %endif */
172 /* Enter a start condition. This macro really ought to take a parameter,
173 * but we do it the disgusting crufty way forced on us by the ()-less
174 * definition of BEGIN.
176 #define BEGIN yyg->yy_start = 1 + 2 *
178 /* Translate the current start state into a value that can be later handed
179 * to BEGIN to return to the state. The YYSTATE alias is for lex
180 * compatibility.
182 #define YY_START ((yyg->yy_start - 1) / 2)
183 #define YYSTATE YY_START
185 /* Action number for EOF rule of a given start state. */
186 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
188 /* Special action meaning "start processing a new file". */
189 #define YY_NEW_FILE yyrestart(yyin ,yyscanner )
191 #define YY_END_OF_BUFFER_CHAR 0
193 /* Size of default input buffer. */
194 #ifndef YY_BUF_SIZE
195 #define YY_BUF_SIZE 16384
196 #endif
198 /* The state buf must be large enough to hold one state per character in the main buffer.
200 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
202 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
203 #define YY_TYPEDEF_YY_BUFFER_STATE
204 typedef struct yy_buffer_state *YY_BUFFER_STATE;
205 #endif
207 /* %if-not-reentrant */
208 /* %endif */
210 /* %if-c-only */
211 /* %if-not-reentrant */
212 /* %endif */
213 /* %endif */
215 #define EOB_ACT_CONTINUE_SCAN 0
216 #define EOB_ACT_END_OF_FILE 1
217 #define EOB_ACT_LAST_MATCH 2
219 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
220 * access to the local variable yy_act. Since yyless() is a macro, it would break
221 * existing scanners that call yyless() from OUTSIDE yylex.
222 * One obvious solution it to make yy_act a global. I tried that, and saw
223 * a 5% performance hit in a non-yylineno scanner, because yy_act is
224 * normally declared as a register variable-- so it is not worth it.
226 #define YY_LESS_LINENO(n) \
227 do { \
228 int yyl;\
229 for ( yyl = n; yyl < yyleng; ++yyl )\
230 if ( yytext[yyl] == '\n' )\
231 --yylineno;\
232 }while(0)
234 /* Return all but the first "n" matched characters back to the input stream. */
235 #define yyless(n) \
236 do \
238 /* Undo effects of setting up yytext. */ \
239 int yyless_macro_arg = (n); \
240 YY_LESS_LINENO(yyless_macro_arg);\
241 *yy_cp = yyg->yy_hold_char; \
242 YY_RESTORE_YY_MORE_OFFSET \
243 yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
244 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
246 while ( 0 )
248 #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
250 /* The following is because we cannot portably get our hands on size_t
251 * (without autoconf's help, which isn't available because we want
252 * flex-generated scanners to compile on their own).
255 #ifndef YY_TYPEDEF_YY_SIZE_T
256 #define YY_TYPEDEF_YY_SIZE_T
257 typedef unsigned int yy_size_t;
258 #endif
260 #ifndef YY_STRUCT_YY_BUFFER_STATE
261 #define YY_STRUCT_YY_BUFFER_STATE
262 struct yy_buffer_state
264 /* %if-c-only */
265 FILE *yy_input_file;
266 /* %endif */
268 /* %if-c++-only */
269 /* %endif */
271 char *yy_ch_buf; /* input buffer */
272 char *yy_buf_pos; /* current position in input buffer */
274 /* Size of input buffer in bytes, not including room for EOB
275 * characters.
277 yy_size_t yy_buf_size;
279 /* Number of characters read into yy_ch_buf, not including EOB
280 * characters.
282 int yy_n_chars;
284 /* Whether we "own" the buffer - i.e., we know we created it,
285 * and can realloc() it to grow it, and should free() it to
286 * delete it.
288 int yy_is_our_buffer;
290 /* Whether this is an "interactive" input source; if so, and
291 * if we're using stdio for input, then we want to use getc()
292 * instead of fread(), to make sure we stop fetching input after
293 * each newline.
295 int yy_is_interactive;
297 /* Whether we're considered to be at the beginning of a line.
298 * If so, '^' rules will be active on the next match, otherwise
299 * not.
301 int yy_at_bol;
303 int yy_bs_lineno; /**< The line count. */
304 int yy_bs_column; /**< The column count. */
306 /* Whether to try to fill the input buffer when we reach the
307 * end of it.
309 int yy_fill_buffer;
311 int yy_buffer_status;
313 #define YY_BUFFER_NEW 0
314 #define YY_BUFFER_NORMAL 1
315 /* When an EOF's been seen but there's still some text to process
316 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
317 * shouldn't try reading from the input source any more. We might
318 * still have a bunch of tokens to match, though, because of
319 * possible backing-up.
321 * When we actually see the EOF, we change the status to "new"
322 * (via yyrestart()), so that the user can continue scanning by
323 * just pointing yyin at a new input file.
325 #define YY_BUFFER_EOF_PENDING 2
328 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
330 /* %if-c-only Standard (non-C++) definition */
331 /* %not-for-header */
333 /* %if-not-reentrant */
334 /* %endif */
335 /* %ok-for-header */
337 /* %endif */
339 /* We provide macros for accessing buffer states in case in the
340 * future we want to put the buffer states in a more general
341 * "scanner state".
343 * Returns the top of the stack, or NULL.
345 #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
346 ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
347 : NULL)
349 /* Same as previous macro, but useful when we know that the buffer stack is not
350 * NULL or when we need an lvalue. For internal use only.
352 #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
354 /* %if-c-only Standard (non-C++) definition */
356 /* %if-not-reentrant */
357 /* %not-for-header */
359 /* %ok-for-header */
361 /* %endif */
363 void yyrestart (FILE *input_file ,yyscan_t yyscanner );
364 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
365 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
366 void yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
367 void yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
368 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
369 void yypop_buffer_state (yyscan_t yyscanner );
371 static void yyensure_buffer_stack (yyscan_t yyscanner );
372 static void yy_load_buffer_state (yyscan_t yyscanner );
373 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
375 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
377 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
378 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
379 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
381 /* %endif */
383 void *yyalloc (yy_size_t ,yyscan_t yyscanner );
384 void *yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
385 void yyfree (void * ,yyscan_t yyscanner );
387 #define yy_new_buffer yy_create_buffer
389 #define yy_set_interactive(is_interactive) \
391 if ( ! YY_CURRENT_BUFFER ){ \
392 yyensure_buffer_stack (yyscanner); \
393 YY_CURRENT_BUFFER_LVALUE = \
394 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
396 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
399 #define yy_set_bol(at_bol) \
401 if ( ! YY_CURRENT_BUFFER ){\
402 yyensure_buffer_stack (yyscanner); \
403 YY_CURRENT_BUFFER_LVALUE = \
404 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
406 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
409 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
411 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
412 /* Begin user sect3 */
414 #define yywrap(n) 1
415 #define YY_SKIP_YYWRAP
417 #define FLEX_DEBUG
419 typedef unsigned char YY_CHAR;
421 typedef int yy_state_type;
423 #define yytext_ptr yytext_r
425 /* %if-c-only Standard (non-C++) definition */
427 static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
428 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
429 static int yy_get_next_buffer (yyscan_t yyscanner );
430 static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
432 /* %endif */
434 /* Done after the current pattern has been matched and before the
435 * corresponding action - sets up yytext.
437 #define YY_DO_BEFORE_ACTION \
438 yyg->yytext_ptr = yy_bp; \
439 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
440 yyleng = (size_t) (yy_cp - yy_bp); \
441 yyg->yy_hold_char = *yy_cp; \
442 *yy_cp = '\0'; \
443 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
444 yyg->yy_c_buf_p = yy_cp;
446 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
447 #define YY_NUM_RULES 119
448 #define YY_END_OF_BUFFER 120
449 /* This struct is not used in this scanner,
450 but its presence is necessary. */
451 struct yy_trans_info
453 flex_int32_t yy_verify;
454 flex_int32_t yy_nxt;
456 static yyconst flex_int16_t yy_accept[400] =
457 { 0,
458 0, 0, 120, 118, 1, 3, 1, 24, 118, 118,
459 118, 21, 118, 118, 27, 28, 22, 20, 29, 26,
460 35, 23, 114, 114, 118, 37, 14, 36, 15, 112,
461 30, 31, 112, 112, 112, 112, 112, 112, 118, 25,
462 33, 3, 3, 11, 0, 106, 0, 0, 2, 0,
463 0, 0, 0, 42, 17, 45, 0, 0, 41, 0,
464 114, 38, 39, 34, 113, 48, 0, 0, 0, 0,
465 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
466 16, 40, 113, 0, 0, 0, 0, 0, 0, 0,
467 0, 0, 0, 0, 0, 0, 0, 0, 8, 12,
469 10, 9, 13, 7, 112, 111, 112, 49, 112, 112,
470 112, 112, 112, 44, 18, 47, 19, 32, 110, 109,
471 107, 108, 43, 0, 0, 0, 0, 0, 0, 0,
472 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
473 0, 0, 0, 46, 113, 116, 0, 113, 117, 115,
474 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
475 0, 0, 0, 0, 0, 0, 6, 5, 112, 53,
476 112, 54, 55, 112, 112, 0, 113, 62, 0, 0,
477 0, 59, 0, 0, 0, 65, 0, 0, 0, 0,
478 0, 0, 0, 0, 81, 0, 0, 0, 0, 0,
480 0, 0, 0, 93, 0, 0, 0, 0, 0, 0,
481 0, 0, 0, 0, 0, 4, 50, 52, 112, 112,
482 0, 0, 75, 0, 0, 0, 0, 0, 0, 0,
483 0, 0, 0, 0, 0, 0, 0, 0, 86, 104,
484 0, 87, 0, 0, 0, 88, 91, 0, 0, 0,
485 0, 0, 0, 0, 0, 0, 0, 112, 112, 0,
486 0, 58, 0, 0, 0, 0, 0, 0, 0, 67,
487 0, 0, 0, 71, 0, 0, 0, 0, 0, 82,
488 0, 0, 0, 97, 0, 96, 103, 0, 0, 94,
489 0, 0, 0, 0, 56, 51, 0, 0, 0, 0,
491 0, 0, 0, 0, 0, 0, 0, 0, 80, 0,
492 0, 0, 0, 0, 0, 0, 92, 0, 0, 0,
493 102, 0, 95, 63, 0, 0, 0, 0, 0, 0,
494 0, 0, 0, 66, 0, 0, 0, 57, 0, 0,
495 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
496 0, 76, 0, 0, 0, 0, 64, 0, 0, 70,
497 0, 0, 85, 0, 0, 105, 101, 100, 89, 0,
498 0, 0, 0, 0, 78, 0, 0, 68, 69, 0,
499 84, 90, 0, 0, 72, 0, 0, 77, 79, 0,
500 83, 98, 99, 0, 74, 60, 61, 73, 0
504 static yyconst flex_int32_t yy_ec[256] =
505 { 0,
506 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
507 1, 4, 5, 1, 1, 1, 1, 1, 1, 1,
508 1, 1, 1, 1, 1, 4, 1, 1, 1, 1,
509 1, 2, 6, 7, 8, 9, 10, 11, 12, 13,
510 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
511 23, 23, 23, 23, 23, 24, 24, 25, 26, 27,
512 28, 29, 1, 30, 31, 32, 31, 31, 33, 31,
513 30, 34, 35, 30, 30, 36, 30, 37, 38, 39,
514 30, 30, 40, 30, 30, 30, 30, 41, 30, 30,
515 42, 43, 44, 1, 45, 1, 46, 47, 48, 49,
517 50, 51, 52, 53, 54, 30, 30, 55, 56, 57,
518 58, 59, 60, 61, 62, 63, 64, 65, 30, 66,
519 67, 30, 1, 68, 1, 69, 1, 1, 1, 1,
520 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
521 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
522 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
523 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
524 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
525 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
526 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
528 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
529 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
530 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
531 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
532 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
533 1, 1, 1, 1, 1
536 static yyconst flex_int32_t yy_meta[70] =
537 { 0,
538 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
539 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
540 3, 3, 3, 3, 4, 1, 1, 1, 1, 4,
541 3, 3, 3, 4, 4, 4, 4, 4, 4, 4,
542 4, 1, 1, 1, 4, 3, 3, 3, 3, 3,
543 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
544 4, 4, 4, 4, 4, 4, 4, 1, 1
547 static yyconst flex_int16_t yy_base[405] =
548 { 0,
549 0, 0, 596, 597, 576, 68, 69, 566, 67, 590,
550 40, 564, 65, 579, 597, 597, 63, 62, 597, 73,
551 109, 78, 158, 96, 179, 597, 72, 74, 76, 565,
552 597, 597, 64, 83, 57, 82, 62, 84, 84, 98,
553 140, 145, 181, 597, 117, 597, 0, 586, 597, 171,
554 179, 188, 196, 597, 597, 597, 576, 559, 597, 205,
555 226, 597, 597, 597, 230, 597, 550, 535, 70, 527,
556 99, 526, 77, 532, 105, 535, 530, 105, 533, 524,
557 549, 597, 234, 152, 248, 166, 0, 519, 520, 141,
558 156, 196, 528, 209, 515, 517, 514, 507, 597, 597,
560 597, 597, 597, 193, 544, 597, 150, 543, 160, 206,
561 114, 179, 240, 597, 597, 597, 597, 597, 264, 268,
562 275, 279, 597, 288, 531, 514, 510, 507, 514, 499,
563 503, 495, 493, 229, 495, 501, 502, 494, 491, 490,
564 505, 497, 500, 597, 292, 257, 296, 300, 260, 0,
565 491, 502, 491, 272, 480, 499, 490, 480, 487, 485,
566 477, 476, 476, 473, 482, 489, 597, 506, 249, 508,
567 280, 507, 506, 153, 283, 306, 317, 485, 475, 473,
568 465, 481, 480, 477, 465, 597, 473, 475, 467, 469,
569 473, 471, 452, 470, 597, 459, 458, 455, 448, 460,
571 446, 445, 449, 452, 456, 447, 450, 439, 451, 291,
572 450, 436, 437, 437, 449, 597, 470, 469, 306, 307,
573 437, 435, 597, 428, 295, 429, 443, 440, 432, 431,
574 440, 422, 435, 426, 420, 298, 432, 430, 597, 597,
575 429, 597, 431, 428, 426, 597, 597, 416, 419, 423,
576 420, 412, 408, 420, 408, 402, 410, 321, 322, 418,
577 418, 597, 416, 411, 406, 409, 403, 411, 402, 597,
578 407, 395, 407, 597, 395, 390, 400, 395, 402, 597,
579 393, 389, 399, 597, 395, 597, 597, 388, 385, 597,
580 383, 373, 389, 388, 412, 411, 376, 300, 379, 370,
582 382, 369, 382, 372, 381, 381, 380, 370, 597, 372,
583 360, 372, 366, 374, 371, 361, 597, 371, 370, 359,
584 597, 369, 597, 597, 367, 362, 357, 355, 345, 353,
585 343, 348, 342, 597, 349, 355, 347, 597, 337, 345,
586 344, 331, 336, 320, 330, 326, 321, 318, 323, 314,
587 326, 597, 314, 325, 317, 314, 597, 315, 318, 597,
588 305, 315, 597, 310, 300, 597, 597, 597, 597, 307,
589 300, 290, 298, 295, 597, 288, 288, 597, 597, 292,
590 597, 597, 243, 241, 597, 178, 183, 597, 153, 95,
591 597, 597, 597, 79, 597, 597, 597, 597, 597, 384,
593 388, 392, 394, 120
596 static yyconst flex_int16_t yy_def[405] =
597 { 0,
598 399, 1, 399, 399, 399, 399, 399, 399, 400, 401,
599 399, 399, 399, 402, 399, 399, 399, 399, 399, 399,
600 399, 399, 399, 399, 399, 399, 399, 399, 399, 403,
601 399, 399, 403, 403, 403, 403, 403, 403, 399, 399,
602 399, 399, 399, 399, 400, 399, 400, 401, 399, 399,
603 399, 399, 399, 399, 399, 399, 402, 399, 399, 399,
604 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
605 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
606 399, 399, 399, 399, 399, 399, 404, 399, 399, 399,
607 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
609 399, 399, 399, 399, 403, 399, 403, 403, 403, 403,
610 403, 403, 403, 399, 399, 399, 399, 399, 399, 399,
611 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
612 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
613 399, 399, 399, 399, 399, 399, 399, 399, 399, 404,
614 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
615 399, 399, 399, 399, 399, 399, 399, 399, 403, 403,
616 403, 403, 403, 403, 403, 399, 399, 399, 399, 399,
617 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
618 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
620 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
621 399, 399, 399, 399, 399, 399, 403, 403, 403, 403,
622 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
623 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
624 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
625 399, 399, 399, 399, 399, 399, 399, 403, 403, 399,
626 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
627 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
628 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
629 399, 399, 399, 399, 403, 403, 399, 399, 399, 399,
631 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
632 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
633 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
634 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
635 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
636 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
637 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
638 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
639 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
640 399, 399, 399, 399, 399, 399, 399, 399, 0, 399,
642 399, 399, 399, 399
645 static yyconst flex_int16_t yy_nxt[667] =
646 { 0,
647 4, 5, 6, 5, 7, 8, 9, 10, 11, 12,
648 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
649 23, 24, 24, 24, 25, 26, 27, 28, 29, 30,
650 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
651 30, 31, 4, 32, 30, 30, 30, 30, 30, 30,
652 30, 33, 30, 34, 30, 30, 35, 30, 36, 30,
653 30, 37, 30, 38, 30, 30, 30, 39, 40, 42,
654 42, 43, 42, 46, 50, 55, 51, 58, 52, 53,
655 60, 106, 61, 61, 61, 61, 106, 41, 106, 62,
656 59, 60, 56, 61, 61, 61, 61, 81, 99, 100,
658 63, 101, 102, 103, 104, 82, 106, 106, 106, 47,
659 64, 114, 64, 64, 83, 127, 61, 61, 61, 61,
660 110, 107, 150, 46, 112, 116, 133, 128, 85, 65,
661 65, 65, 65, 108, 134, 398, 66, 111, 106, 109,
662 113, 118, 67, 118, 118, 85, 42, 42, 130, 42,
663 136, 115, 137, 131, 140, 68, 69, 397, 70, 47,
664 71, 173, 72, 73, 74, 75, 117, 76, 141, 77,
665 78, 79, 146, 146, 106, 80, 83, 106, 61, 61,
666 61, 61, 42, 42, 106, 42, 149, 149, 149, 84,
667 85, 119, 119, 119, 119, 86, 153, 154, 87, 120,
669 120, 120, 120, 106, 84, 155, 219, 85, 121, 121,
670 121, 121, 169, 156, 396, 86, 122, 122, 122, 122,
671 167, 168, 170, 87, 88, 65, 65, 65, 65, 89,
672 106, 395, 90, 91, 92, 93, 94, 95, 394, 174,
673 96, 157, 97, 98, 83, 158, 61, 61, 61, 61,
674 65, 65, 65, 65, 145, 145, 145, 145, 85, 159,
675 171, 172, 124, 147, 106, 147, 124, 161, 148, 148,
676 148, 148, 162, 106, 187, 85, 188, 146, 146, 124,
677 149, 149, 149, 124, 119, 119, 119, 119, 120, 120,
678 120, 120, 393, 392, 175, 121, 121, 121, 121, 122,
680 122, 122, 122, 176, 106, 176, 217, 106, 177, 177,
681 177, 177, 145, 145, 145, 145, 148, 148, 148, 148,
682 148, 148, 148, 148, 124, 201, 177, 177, 177, 177,
683 106, 106, 220, 202, 218, 251, 203, 177, 177, 177,
684 177, 124, 263, 276, 252, 106, 106, 325, 391, 390,
685 389, 388, 387, 386, 385, 264, 384, 383, 277, 382,
686 326, 265, 258, 381, 278, 380, 327, 379, 259, 378,
687 377, 376, 295, 375, 374, 373, 372, 371, 370, 369,
688 368, 367, 366, 296, 45, 365, 45, 45, 48, 48,
689 48, 48, 57, 364, 57, 57, 105, 105, 363, 362,
691 361, 360, 359, 358, 357, 356, 355, 354, 353, 352,
692 351, 350, 349, 348, 347, 346, 345, 344, 343, 342,
693 341, 340, 339, 338, 337, 336, 335, 334, 333, 332,
694 331, 330, 329, 328, 324, 106, 106, 323, 322, 321,
695 320, 319, 318, 317, 316, 315, 314, 313, 312, 311,
696 310, 309, 308, 307, 306, 305, 304, 303, 302, 301,
697 300, 299, 298, 297, 294, 293, 292, 291, 290, 289,
698 288, 287, 286, 285, 284, 283, 282, 281, 280, 279,
699 275, 274, 273, 272, 271, 270, 269, 268, 267, 266,
700 262, 261, 260, 106, 106, 257, 256, 255, 254, 253,
702 250, 249, 248, 247, 246, 245, 244, 243, 242, 241,
703 240, 239, 238, 237, 236, 235, 234, 233, 232, 231,
704 230, 229, 228, 227, 226, 225, 224, 223, 222, 221,
705 106, 106, 106, 216, 215, 214, 213, 212, 211, 210,
706 209, 208, 207, 206, 205, 204, 200, 199, 198, 197,
707 196, 195, 194, 193, 192, 191, 190, 189, 186, 185,
708 184, 183, 182, 181, 180, 179, 178, 106, 106, 166,
709 165, 164, 163, 160, 152, 151, 144, 143, 142, 139,
710 138, 135, 132, 129, 126, 125, 123, 46, 49, 106,
711 46, 54, 49, 44, 41, 399, 3, 399, 399, 399,
713 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
714 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
715 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
716 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
717 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
718 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
719 399, 399, 399, 399, 399, 399
722 static yyconst flex_int16_t yy_chk[667] =
723 { 0,
724 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
725 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
726 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
727 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
728 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
729 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
730 1, 1, 1, 1, 1, 1, 1, 1, 1, 6,
731 6, 7, 6, 9, 11, 13, 11, 17, 11, 11,
732 18, 35, 18, 18, 18, 18, 37, 7, 33, 18,
733 17, 20, 13, 20, 20, 20, 20, 22, 27, 27,
735 20, 28, 28, 29, 29, 22, 36, 34, 38, 9,
736 21, 39, 21, 21, 24, 69, 24, 24, 24, 24,
737 35, 33, 404, 45, 37, 40, 73, 69, 24, 21,
738 21, 21, 21, 34, 73, 394, 21, 36, 111, 34,
739 38, 41, 21, 41, 41, 24, 42, 42, 71, 42,
740 75, 39, 75, 71, 78, 21, 21, 390, 21, 45,
741 21, 111, 21, 21, 21, 21, 40, 21, 78, 21,
742 21, 21, 84, 84, 107, 21, 23, 174, 23, 23,
743 23, 23, 43, 43, 109, 43, 86, 86, 86, 23,
744 23, 50, 50, 50, 50, 23, 90, 90, 23, 51,
746 51, 51, 51, 112, 23, 91, 174, 23, 52, 52,
747 52, 52, 107, 91, 389, 23, 53, 53, 53, 53,
748 104, 104, 109, 23, 25, 60, 60, 60, 60, 25,
749 110, 387, 25, 25, 25, 25, 25, 25, 386, 112,
750 25, 92, 25, 25, 61, 92, 61, 61, 61, 61,
751 65, 65, 65, 65, 83, 83, 83, 83, 61, 92,
752 110, 110, 65, 85, 113, 85, 83, 94, 85, 85,
753 85, 85, 94, 169, 134, 61, 134, 146, 146, 65,
754 149, 149, 149, 83, 119, 119, 119, 119, 120, 120,
755 120, 120, 384, 383, 113, 121, 121, 121, 121, 122,
757 122, 122, 122, 124, 171, 124, 169, 175, 124, 124,
758 124, 124, 145, 145, 145, 145, 147, 147, 147, 147,
759 148, 148, 148, 148, 145, 154, 176, 176, 176, 176,
760 219, 220, 175, 154, 171, 210, 154, 177, 177, 177,
761 177, 145, 225, 236, 210, 258, 259, 298, 380, 377,
762 376, 374, 373, 372, 371, 225, 370, 365, 236, 364,
763 298, 225, 219, 362, 236, 361, 298, 359, 220, 358,
764 356, 355, 258, 354, 353, 351, 350, 349, 348, 347,
765 346, 345, 344, 259, 400, 343, 400, 400, 401, 401,
766 401, 401, 402, 342, 402, 402, 403, 403, 341, 340,
768 339, 337, 336, 335, 333, 332, 331, 330, 329, 328,
769 327, 326, 325, 322, 320, 319, 318, 316, 315, 314,
770 313, 312, 311, 310, 308, 307, 306, 305, 304, 303,
771 302, 301, 300, 299, 297, 296, 295, 294, 293, 292,
772 291, 289, 288, 285, 283, 282, 281, 279, 278, 277,
773 276, 275, 273, 272, 271, 269, 268, 267, 266, 265,
774 264, 263, 261, 260, 257, 256, 255, 254, 253, 252,
775 251, 250, 249, 248, 245, 244, 243, 241, 238, 237,
776 235, 234, 233, 232, 231, 230, 229, 228, 227, 226,
777 224, 222, 221, 218, 217, 215, 214, 213, 212, 211,
779 209, 208, 207, 206, 205, 204, 203, 202, 201, 200,
780 199, 198, 197, 196, 194, 193, 192, 191, 190, 189,
781 188, 187, 185, 184, 183, 182, 181, 180, 179, 178,
782 173, 172, 170, 168, 166, 165, 164, 163, 162, 161,
783 160, 159, 158, 157, 156, 155, 153, 152, 151, 143,
784 142, 141, 140, 139, 138, 137, 136, 135, 133, 132,
785 131, 130, 129, 128, 127, 126, 125, 108, 105, 98,
786 97, 96, 95, 93, 89, 88, 81, 80, 79, 77,
787 76, 74, 72, 70, 68, 67, 58, 57, 48, 30,
788 14, 12, 10, 8, 5, 3, 399, 399, 399, 399,
790 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
791 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
792 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
793 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
794 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
795 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
796 399, 399, 399, 399, 399, 399
799 /* Table of booleans, true if rule could match eol. */
800 static yyconst flex_int32_t yy_rule_can_match_eol[120] =
801 { 0,
802 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
803 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
804 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
805 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
806 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
807 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
810 static yyconst flex_int16_t yy_rule_linenum[119] =
811 { 0,
812 140, 142, 144, 148, 149, 150, 151, 152, 153, 154,
813 155, 156, 157, 158, 159, 161, 162, 163, 164, 166,
814 167, 168, 169, 170, 171, 172, 173, 174, 175, 176,
815 177, 179, 183, 189, 195, 202, 203, 205, 206, 207,
816 208, 209, 210, 211, 212, 213, 214, 215, 217, 218,
817 219, 220, 222, 223, 224, 225, 227, 228, 229, 231,
818 232, 233, 234, 235, 236, 237, 238, 240, 241, 242,
819 243, 244, 245, 246, 247, 248, 249, 250, 251, 252,
820 253, 254, 255, 256, 257, 259, 260, 261, 262, 263,
821 264, 265, 266, 267, 268, 269, 270, 271, 273, 274,
823 275, 276, 277, 278, 279, 282, 287, 288, 289, 290,
824 292, 297, 302, 303, 304, 305, 306, 309
827 /* The intent behind this definition is that it'll catch
828 * any uses of REJECT which flex missed.
830 #define REJECT reject_used_but_not_detected
831 #define yymore() yymore_used_but_not_detected
832 #define YY_MORE_ADJ 0
833 #define YY_RESTORE_YY_MORE_OFFSET
834 #line 1 "pir.l"
835 #line 2 "pir.l"
838 * $Id$
839 * Copyright (C) 2007-2008, The Perl Foundation.
844 =head1 NAME
846 pir.l - implementation of the lexical analyzer of the PIR assembly language.
848 =head1 DESCRIPTION
850 This file implements the lexical analyzer of the PIR assembly language.
852 The current approach is to create a three-pass compiler, but if any optimizations
853 in this schedule can be made, then this is preferred. This needs more experimentation.
855 The first pass is the heredoc pre-processor, which converts all heredoc strings into
856 normal strings (they are "flattened). Furthermore, this phase strips all comments, both
857 POD and line comments.
859 The second pass is the macro pre-processor, which handles the C<.macro>, C<.macro_const>
860 and C<.include> directives. The resulting output is the file that can be fed into the
861 actual PIR parser.
863 The third pass is then the PIR parsing phase. It takes the output of the macro pre-processor,
864 which contains no heredoc strings and macros. For that reason, the PIR lexer is very
865 simple and straightforward.
867 Each of the phases can be easily implemented. When they must be combined, the complexity
868 grows quickly. Therefore, this approach, which is probably not the most efficient, is
869 easier to maintain, and preferable.
872 =cut
876 #include <stdlib.h>
877 #include <string.h>
878 #include <ctype.h>
879 #include <assert.h>
880 #include "pirparser.h"
881 #include "pircompiler.h"
882 #include "piryy.h"
886 /* define the type of the extra field in the yyscan_t object that is passed around;
887 * this is the lexer_state structure, defined in "pircompiler.h"
889 #define YY_EXTRA_TYPE struct lexer_state *
891 /* accessor methods for setting and getting the lexer_state */
892 extern YY_EXTRA_TYPE yyget_extra(yyscan_t scanner);
893 extern void yyset_extra(YY_EXTRA_TYPE lexer,yyscan_t scanner);
898 /* Windows doesn't have <unistd.h> */
899 #ifndef YY_NO_UNISTD_H
900 # define YY_NO_UNISTD_H
901 #endif
903 /* keep MSVC happy */
904 #ifndef YY_MAIN
905 # define YY_MAIN 0
906 #endif
908 /* keep MSVC happy */
909 #ifndef YY_ALWAYS_INTERACTIVE
910 # define YY_ALWAYS_INTERACTIVE 0
911 #endif
914 /* make sure yytext is a pointer */
915 /* slightly more efficient when this option is set; our parser is not interactive anyway. */
916 /* define output file */
917 /* use flex' built-in capability for line counting */
918 /* make the scanner re-entrant */
919 /* needed for bison interaction. */
920 /* make yywrap() always return true. */
921 /* always show warnings if something's wrong with our spec. */
922 /* create a scanner in debug mode; XXX remove this in production build. */
923 #line 924 "pirlexer.c"
925 #define INITIAL 0
927 #ifndef YY_NO_UNISTD_H
928 /* Special case for "unistd.h", since it is non-ANSI. We include it way
929 * down here because we want the user's section 1 to have been scanned first.
930 * The user has a chance to override it with an option.
932 /* %if-c-only */
933 #include <unistd.h>
934 /* %endif */
935 /* %if-c++-only */
936 /* %endif */
937 #endif
939 #ifndef YY_EXTRA_TYPE
940 #define YY_EXTRA_TYPE void *
941 #endif
943 /* %if-c-only Reentrant structure and macros (non-C++). */
944 /* %if-reentrant */
946 /* Holds the entire state of the reentrant scanner. */
947 struct yyguts_t
950 /* User-defined. Not touched by flex. */
951 YY_EXTRA_TYPE yyextra_r;
953 /* The rest are the same as the globals declared in the non-reentrant scanner. */
954 FILE *yyin_r, *yyout_r;
955 size_t yy_buffer_stack_top; /**< index of top of stack. */
956 size_t yy_buffer_stack_max; /**< capacity of stack. */
957 YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
958 char yy_hold_char;
959 int yy_n_chars;
960 int yyleng_r;
961 char *yy_c_buf_p;
962 int yy_init;
963 int yy_start;
964 int yy_did_buffer_switch_on_eof;
965 int yy_start_stack_ptr;
966 int yy_start_stack_depth;
967 int *yy_start_stack;
968 yy_state_type yy_last_accepting_state;
969 char* yy_last_accepting_cpos;
971 int yylineno_r;
972 int yy_flex_debug_r;
974 char *yytext_r;
975 int yy_more_flag;
976 int yy_more_len;
978 YYSTYPE * yylval_r;
980 }; /* end struct yyguts_t */
982 /* %if-c-only */
984 static int yy_init_globals (yyscan_t yyscanner );
986 /* %endif */
988 /* %if-reentrant */
990 /* This must go here because YYSTYPE and YYLTYPE are included
991 * from bison output in section 1.*/
992 # define yylval yyg->yylval_r
994 /* %endif */
996 /* Accessor methods to globals.
997 These are made visible to non-reentrant scanners for convenience. */
999 int yylex_destroy (yyscan_t yyscanner );
1001 int yyget_debug (yyscan_t yyscanner );
1003 void yyset_debug (int debug_flag ,yyscan_t yyscanner );
1005 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner );
1007 void yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
1009 FILE *yyget_in (yyscan_t yyscanner );
1011 void yyset_in (FILE * in_str ,yyscan_t yyscanner );
1013 FILE *yyget_out (yyscan_t yyscanner );
1015 void yyset_out (FILE * out_str ,yyscan_t yyscanner );
1017 int yyget_leng (yyscan_t yyscanner );
1019 char *yyget_text (yyscan_t yyscanner );
1021 int yyget_lineno (yyscan_t yyscanner );
1023 void yyset_lineno (int line_number ,yyscan_t yyscanner );
1025 /* %if-bison-bridge */
1027 YYSTYPE * yyget_lval (yyscan_t yyscanner );
1029 void yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
1031 /* %endif */
1032 /* %endif End reentrant structures and macros. */
1034 /* Macros after this point can all be overridden by user definitions in
1035 * section 1.
1038 #ifndef YY_SKIP_YYWRAP
1039 #ifdef __cplusplus
1040 extern "C" int yywrap (yyscan_t yyscanner );
1041 #else
1042 extern int yywrap (yyscan_t yyscanner );
1043 #endif
1044 #endif
1046 /* %not-for-header */
1048 /* %ok-for-header */
1050 /* %endif */
1052 #ifndef yytext_ptr
1053 static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
1054 #endif
1056 #ifdef YY_NEED_STRLEN
1057 static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
1058 #endif
1060 #ifndef YY_NO_INPUT
1061 /* %if-c-only Standard (non-C++) definition */
1062 /* %not-for-header */
1064 #ifdef __cplusplus
1065 static int yyinput (yyscan_t yyscanner );
1066 #else
1067 static int input (yyscan_t yyscanner );
1068 #endif
1069 /* %ok-for-header */
1071 /* %endif */
1072 #endif
1074 /* %if-c-only */
1076 /* %endif */
1078 /* Amount of stuff to slurp up with each read. */
1079 #ifndef YY_READ_BUF_SIZE
1080 #define YY_READ_BUF_SIZE 8192
1081 #endif
1083 /* Copy whatever the last rule matched to the standard output. */
1084 #ifndef ECHO
1085 /* %if-c-only Standard (non-C++) definition */
1086 /* This used to be an fputs(), but since the string might contain NUL's,
1087 * we now use fwrite().
1089 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1090 /* %endif */
1091 /* %if-c++-only C++ definition */
1092 /* %endif */
1093 #endif
1095 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1096 * is returned in "result".
1098 #ifndef YY_INPUT
1099 #define YY_INPUT(buf,result,max_size) \
1100 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
1101 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1103 int c = '*'; \
1104 size_t n; \
1105 for ( n = 0; n < max_size && \
1106 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1107 buf[n] = (char) c; \
1108 if ( c == '\n' ) \
1109 buf[n++] = (char) c; \
1110 if ( c == EOF && ferror( yyin ) ) \
1111 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1112 result = n; \
1114 else \
1116 errno=0; \
1117 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
1119 if( errno != EINTR) \
1121 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1122 break; \
1124 errno=0; \
1125 clearerr(yyin); \
1129 /* %if-c++-only C++ definition \ */\
1130 /* %endif */
1132 #endif
1134 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1135 * we don't want an extra ';' after the "return" because that will cause
1136 * some compilers to complain about unreachable statements.
1138 #ifndef yyterminate
1139 #define yyterminate() return YY_NULL
1140 #endif
1142 /* Number of entries by which start-condition stack grows. */
1143 #ifndef YY_START_STACK_INCR
1144 #define YY_START_STACK_INCR 25
1145 #endif
1147 /* Report a fatal error. */
1148 #ifndef YY_FATAL_ERROR
1149 /* %if-c-only */
1150 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
1151 /* %endif */
1152 /* %if-c++-only */
1153 /* %endif */
1154 #endif
1156 /* %if-tables-serialization structures and prototypes */
1157 /* %not-for-header */
1159 /* %ok-for-header */
1161 /* %not-for-header */
1163 /* %tables-yydmap generated elements */
1164 /* %endif */
1165 /* end tables serialization structures and prototypes */
1167 /* %ok-for-header */
1169 /* Default declaration of generated scanner - a define so the user can
1170 * easily add parameters.
1172 #ifndef YY_DECL
1173 #define YY_DECL_IS_OURS 1
1174 /* %if-c-only Standard (non-C++) definition */
1176 extern int yylex (YYSTYPE * yylval_param ,yyscan_t yyscanner);
1178 #define YY_DECL int yylex (YYSTYPE * yylval_param , yyscan_t yyscanner)
1179 /* %endif */
1180 /* %if-c++-only C++ definition */
1181 /* %endif */
1182 #endif /* !YY_DECL */
1184 /* Code executed at the beginning of each rule, after yytext and yyleng
1185 * have been set up.
1187 #ifndef YY_USER_ACTION
1188 #define YY_USER_ACTION
1189 #endif
1191 /* Code executed at the end of each rule. */
1192 #ifndef YY_BREAK
1193 #define YY_BREAK break;
1194 #endif
1196 /* %% [6.0] YY_RULE_SETUP definition goes here */
1197 #define YY_RULE_SETUP \
1198 YY_USER_ACTION
1200 /* %not-for-header */
1202 /** The main scanner function which does all the work.
1204 YY_DECL
1206 register yy_state_type yy_current_state;
1207 register char *yy_cp, *yy_bp;
1208 register int yy_act;
1209 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
1211 /* %% [7.0] user's declarations go here */
1212 #line 137 "pir.l"
1216 #line 1217 "pirlexer.c"
1218 yylval = yylval_param;
1220 if ( !yyg->yy_init )
1222 yyg->yy_init = 1;
1224 #ifdef YY_USER_INIT
1225 YY_USER_INIT;
1226 #endif
1228 if ( ! yyg->yy_start )
1229 yyg->yy_start = 1; /* first start state */
1231 if ( ! yyin )
1232 /* %if-c-only */
1233 yyin = stdin;
1234 /* %endif */
1235 /* %if-c++-only */
1236 /* %endif */
1238 if ( ! yyout )
1239 /* %if-c-only */
1240 yyout = stdout;
1241 /* %endif */
1242 /* %if-c++-only */
1243 /* %endif */
1245 if ( ! YY_CURRENT_BUFFER ) {
1246 yyensure_buffer_stack (yyscanner);
1247 YY_CURRENT_BUFFER_LVALUE =
1248 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
1251 yy_load_buffer_state(yyscanner );
1254 while ( 1 ) /* loops until end-of-file is reached */
1256 /* %% [8.0] yymore()-related code goes here */
1257 yy_cp = yyg->yy_c_buf_p;
1259 /* Support of yytext. */
1260 *yy_cp = yyg->yy_hold_char;
1262 /* yy_bp points to the position in yy_ch_buf of the start of
1263 * the current run.
1265 yy_bp = yy_cp;
1267 /* %% [9.0] code to set up and find next match goes here */
1268 yy_current_state = yyg->yy_start;
1269 yy_match:
1272 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1273 if ( yy_accept[yy_current_state] )
1275 yyg->yy_last_accepting_state = yy_current_state;
1276 yyg->yy_last_accepting_cpos = yy_cp;
1278 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1280 yy_current_state = (int) yy_def[yy_current_state];
1281 if ( yy_current_state >= 400 )
1282 yy_c = yy_meta[(unsigned int) yy_c];
1284 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1285 ++yy_cp;
1287 while ( yy_current_state != 399 );
1288 yy_cp = yyg->yy_last_accepting_cpos;
1289 yy_current_state = yyg->yy_last_accepting_state;
1291 yy_find_action:
1292 /* %% [10.0] code to find the action number goes here */
1293 yy_act = yy_accept[yy_current_state];
1295 YY_DO_BEFORE_ACTION;
1297 /* %% [11.0] code for yylineno update goes here */
1299 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1301 int yyl;
1302 for ( yyl = 0; yyl < yyleng; ++yyl )
1303 if ( yytext[yyl] == '\n' )
1305 do{ yylineno++;
1306 yycolumn=0;
1307 }while(0)
1311 do_action: /* This label is used only to access EOF actions. */
1313 /* %% [12.0] debug code goes here */
1314 if ( yy_flex_debug )
1316 if ( yy_act == 0 )
1317 fprintf( stderr, "--scanner backing up\n" );
1318 else if ( yy_act < 119 )
1319 fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
1320 (long)yy_rule_linenum[yy_act], yytext );
1321 else if ( yy_act == 119 )
1322 fprintf( stderr, "--accepting default rule (\"%s\")\n",
1323 yytext );
1324 else if ( yy_act == 120 )
1325 fprintf( stderr, "--(end of buffer or a NUL)\n" );
1326 else
1327 fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
1330 switch ( yy_act )
1331 { /* beginning of action switch */
1332 /* %% [13.0] actions go here */
1333 case 0: /* must back up */
1334 /* undo the effects of YY_DO_BEFORE_ACTION */
1335 *yy_cp = yyg->yy_hold_char;
1336 yy_cp = yyg->yy_last_accepting_cpos;
1337 yy_current_state = yyg->yy_last_accepting_state;
1338 goto yy_find_action;
1340 case 1:
1341 YY_RULE_SETUP
1342 #line 140 "pir.l"
1343 { /* ignore whitespace */ }
1344 YY_BREAK
1345 case 2:
1346 /* rule 2 can match eol */
1347 YY_RULE_SETUP
1348 #line 142 "pir.l"
1349 { /* ignore line comments */ }
1350 YY_BREAK
1351 case 3:
1352 /* rule 3 can match eol */
1353 YY_RULE_SETUP
1354 #line 144 "pir.l"
1355 { /* a set of continuous newlines yields a single newline token. */
1356 return TK_NL;
1358 YY_BREAK
1359 case 4:
1360 YY_RULE_SETUP
1361 #line 148 "pir.l"
1362 { return TK_ASSIGN_USHIFT; }
1363 YY_BREAK
1364 case 5:
1365 YY_RULE_SETUP
1366 #line 149 "pir.l"
1367 { return TK_USHIFT; }
1368 YY_BREAK
1369 case 6:
1370 YY_RULE_SETUP
1371 #line 150 "pir.l"
1372 { return TK_ASSIGN_RSHIFT; }
1373 YY_BREAK
1374 case 7:
1375 YY_RULE_SETUP
1376 #line 151 "pir.l"
1377 { return TK_RSHIFT; }
1378 YY_BREAK
1379 case 8:
1380 YY_RULE_SETUP
1381 #line 152 "pir.l"
1382 { return TK_LSHIFT; }
1383 YY_BREAK
1384 case 9:
1385 YY_RULE_SETUP
1386 #line 153 "pir.l"
1387 { return TK_ARROW; }
1388 YY_BREAK
1389 case 10:
1390 YY_RULE_SETUP
1391 #line 154 "pir.l"
1392 { return TK_EQ; }
1393 YY_BREAK
1394 case 11:
1395 YY_RULE_SETUP
1396 #line 155 "pir.l"
1397 { return TK_NE; }
1398 YY_BREAK
1399 case 12:
1400 YY_RULE_SETUP
1401 #line 156 "pir.l"
1402 { return TK_LE; }
1403 YY_BREAK
1404 case 13:
1405 YY_RULE_SETUP
1406 #line 157 "pir.l"
1407 { return TK_GE; }
1408 YY_BREAK
1409 case 14:
1410 YY_RULE_SETUP
1411 #line 158 "pir.l"
1412 { return TK_LT; }
1413 YY_BREAK
1414 case 15:
1415 YY_RULE_SETUP
1416 #line 159 "pir.l"
1417 { return TK_GT; }
1418 YY_BREAK
1419 case 16:
1420 YY_RULE_SETUP
1421 #line 161 "pir.l"
1422 { return TK_FDIV; }
1423 YY_BREAK
1424 case 17:
1425 YY_RULE_SETUP
1426 #line 162 "pir.l"
1427 { return TK_AND; }
1428 YY_BREAK
1429 case 18:
1430 YY_RULE_SETUP
1431 #line 163 "pir.l"
1432 { return TK_OR; }
1433 YY_BREAK
1434 case 19:
1435 YY_RULE_SETUP
1436 #line 164 "pir.l"
1437 { return TK_XOR; }
1438 YY_BREAK
1439 case 20:
1440 YY_RULE_SETUP
1441 #line 166 "pir.l"
1442 { return '+'; }
1443 YY_BREAK
1444 case 21:
1445 YY_RULE_SETUP
1446 #line 167 "pir.l"
1447 { return '%'; }
1448 YY_BREAK
1449 case 22:
1450 YY_RULE_SETUP
1451 #line 168 "pir.l"
1452 { return '*'; }
1453 YY_BREAK
1454 case 23:
1455 YY_RULE_SETUP
1456 #line 169 "pir.l"
1457 { return '/'; }
1458 YY_BREAK
1459 case 24:
1460 YY_RULE_SETUP
1461 #line 170 "pir.l"
1462 { return '!'; }
1463 YY_BREAK
1464 case 25:
1465 YY_RULE_SETUP
1466 #line 171 "pir.l"
1467 { return '~'; }
1468 YY_BREAK
1469 case 26:
1470 YY_RULE_SETUP
1471 #line 172 "pir.l"
1472 { return '-'; }
1473 YY_BREAK
1474 case 27:
1475 YY_RULE_SETUP
1476 #line 173 "pir.l"
1477 { return '('; }
1478 YY_BREAK
1479 case 28:
1480 YY_RULE_SETUP
1481 #line 174 "pir.l"
1482 { return ')'; }
1483 YY_BREAK
1484 case 29:
1485 YY_RULE_SETUP
1486 #line 175 "pir.l"
1487 { return ','; }
1488 YY_BREAK
1489 case 30:
1490 YY_RULE_SETUP
1491 #line 176 "pir.l"
1492 { return '['; }
1493 YY_BREAK
1494 case 31:
1495 YY_RULE_SETUP
1496 #line 177 "pir.l"
1497 { return ']'; }
1498 YY_BREAK
1499 case 32:
1500 YY_RULE_SETUP
1501 #line 179 "pir.l"
1502 { /* if the dot is surrounded by whitespace, it's a concatenation operator */
1503 return TK_CONC;
1505 YY_BREAK
1506 case 33:
1507 YY_RULE_SETUP
1508 #line 183 "pir.l"
1509 { /* $P0 .$P1 means error; either space on both side or none at all. */
1510 yyerror(yyscanner, yyget_extra(yyscanner),
1511 "ambiguous '.'; must be enclosed in space on both sides or none at all.");
1512 return TK_CONC;
1514 YY_BREAK
1515 case 34:
1516 YY_RULE_SETUP
1517 #line 189 "pir.l"
1518 { /* $P0. $P1 means error; see {WS}"." */
1519 yyerror(yyscanner, yyget_extra(yyscanner),
1520 "ambiguous '.'; must be enclosed in space on both sides or none at all.");
1521 return TK_CONC;
1523 YY_BREAK
1524 case 35:
1525 YY_RULE_SETUP
1526 #line 195 "pir.l"
1527 { /* at this point all dot-whitespace combinations have been covered;
1528 * so we can be sure that the dot does not have any surrounding
1529 * whitespace: that's the method-call dot, as in $P0.$P1().
1531 return '.';
1533 YY_BREAK
1534 case 36:
1535 YY_RULE_SETUP
1536 #line 202 "pir.l"
1537 { return '='; }
1538 YY_BREAK
1539 case 37:
1540 YY_RULE_SETUP
1541 #line 203 "pir.l"
1542 { return ';'; }
1543 YY_BREAK
1544 case 38:
1545 YY_RULE_SETUP
1546 #line 205 "pir.l"
1547 { return TK_ASSIGN_INC; }
1548 YY_BREAK
1549 case 39:
1550 YY_RULE_SETUP
1551 #line 206 "pir.l"
1552 { return TK_ASSIGN_DEC; }
1553 YY_BREAK
1554 case 40:
1555 YY_RULE_SETUP
1556 #line 207 "pir.l"
1557 { return TK_ASSIGN_DIV; }
1558 YY_BREAK
1559 case 41:
1560 YY_RULE_SETUP
1561 #line 208 "pir.l"
1562 { return TK_ASSIGN_MUL; }
1563 YY_BREAK
1564 case 42:
1565 YY_RULE_SETUP
1566 #line 209 "pir.l"
1567 { return TK_ASSIGN_MOD; }
1568 YY_BREAK
1569 case 43:
1570 YY_RULE_SETUP
1571 #line 210 "pir.l"
1572 { return TK_ASSIGN_POW; }
1573 YY_BREAK
1574 case 44:
1575 YY_RULE_SETUP
1576 #line 211 "pir.l"
1577 { return TK_ASSIGN_BOR; }
1578 YY_BREAK
1579 case 45:
1580 YY_RULE_SETUP
1581 #line 212 "pir.l"
1582 { return TK_ASSIGN_BAND; }
1583 YY_BREAK
1584 case 46:
1585 YY_RULE_SETUP
1586 #line 213 "pir.l"
1587 { return TK_ASSIGN_FDIV; }
1588 YY_BREAK
1589 case 47:
1590 YY_RULE_SETUP
1591 #line 214 "pir.l"
1592 { return TK_ASSIGN_BNOT; }
1593 YY_BREAK
1594 case 48:
1595 YY_RULE_SETUP
1596 #line 215 "pir.l"
1597 { return TK_ASSIGN_CONC; }
1598 YY_BREAK
1599 case 49:
1600 YY_RULE_SETUP
1601 #line 217 "pir.l"
1602 { return TK_IF; }
1603 YY_BREAK
1604 case 50:
1605 YY_RULE_SETUP
1606 #line 218 "pir.l"
1607 { return TK_GOTO; }
1608 YY_BREAK
1609 case 51:
1610 YY_RULE_SETUP
1611 #line 219 "pir.l"
1612 { return TK_UNLESS; }
1613 YY_BREAK
1614 case 52:
1615 YY_RULE_SETUP
1616 #line 220 "pir.l"
1617 { return TK_NULL; }
1618 YY_BREAK
1619 case 53:
1620 YY_RULE_SETUP
1621 #line 222 "pir.l"
1622 { return TK_INT; }
1623 YY_BREAK
1624 case 54:
1625 YY_RULE_SETUP
1626 #line 223 "pir.l"
1627 { return TK_NUM; }
1628 YY_BREAK
1629 case 55:
1630 YY_RULE_SETUP
1631 #line 224 "pir.l"
1632 { return TK_PMC; }
1633 YY_BREAK
1634 case 56:
1635 YY_RULE_SETUP
1636 #line 225 "pir.l"
1637 { return TK_STRING; }
1638 YY_BREAK
1639 case 57:
1640 YY_RULE_SETUP
1641 #line 227 "pir.l"
1642 { return TK_SET_ARG; }
1643 YY_BREAK
1644 case 58:
1645 YY_RULE_SETUP
1646 #line 228 "pir.l"
1647 { return TK_CONST; }
1648 YY_BREAK
1649 case 59:
1650 YY_RULE_SETUP
1651 #line 229 "pir.l"
1652 { return TK_END; }
1653 YY_BREAK
1654 case 60:
1655 YY_RULE_SETUP
1656 #line 231 "pir.l"
1657 { return TK_GET_RESULTS; }
1658 YY_BREAK
1659 case 61:
1660 YY_RULE_SETUP
1661 #line 232 "pir.l"
1662 { return TK_GLOBALCONST; }
1663 YY_BREAK
1664 case 62:
1665 YY_RULE_SETUP
1666 #line 233 "pir.l"
1667 { return TK_HLL; }
1668 YY_BREAK
1669 case 63:
1670 YY_RULE_SETUP
1671 #line 234 "pir.l"
1672 { return TK_HLL_MAP; }
1673 YY_BREAK
1674 case 64:
1675 YY_RULE_SETUP
1676 #line 235 "pir.l"
1677 { return TK_INVOCANT; }
1678 YY_BREAK
1679 case 65:
1680 YY_RULE_SETUP
1681 #line 236 "pir.l"
1682 { return TK_LEX; }
1683 YY_BREAK
1684 case 66:
1685 YY_RULE_SETUP
1686 #line 237 "pir.l"
1687 { return TK_LOADLIB; }
1688 YY_BREAK
1689 case 67:
1690 YY_RULE_SETUP
1691 #line 238 "pir.l"
1692 { return TK_LOCAL; }
1693 YY_BREAK
1694 case 68:
1695 YY_RULE_SETUP
1696 #line 240 "pir.l"
1697 { return TK_METH_CALL; }
1698 YY_BREAK
1699 case 69:
1700 YY_RULE_SETUP
1701 #line 241 "pir.l"
1702 { return TK_NAMESPACE; }
1703 YY_BREAK
1704 case 70:
1705 YY_RULE_SETUP
1706 #line 242 "pir.l"
1707 { return TK_NCI_CALL; }
1708 YY_BREAK
1709 case 71:
1710 YY_RULE_SETUP
1711 #line 243 "pir.l"
1712 { return TK_PARAM; }
1713 YY_BREAK
1714 case 72:
1715 YY_RULE_SETUP
1716 #line 244 "pir.l"
1717 { return TK_BEGIN_CALL; }
1718 YY_BREAK
1719 case 73:
1720 YY_RULE_SETUP
1721 #line 245 "pir.l"
1722 { return TK_BEGIN_RETURN; }
1723 YY_BREAK
1724 case 74:
1725 YY_RULE_SETUP
1726 #line 246 "pir.l"
1727 { return TK_BEGIN_YIELD; }
1728 YY_BREAK
1729 case 75:
1730 YY_RULE_SETUP
1731 #line 247 "pir.l"
1732 { return TK_CALL; }
1733 YY_BREAK
1734 case 76:
1735 YY_RULE_SETUP
1736 #line 248 "pir.l"
1737 { return TK_END_CALL; }
1738 YY_BREAK
1739 case 77:
1740 YY_RULE_SETUP
1741 #line 249 "pir.l"
1742 { return TK_END_RETURN; }
1743 YY_BREAK
1744 case 78:
1745 YY_RULE_SETUP
1746 #line 250 "pir.l"
1747 { return TK_END_YIELD; }
1748 YY_BREAK
1749 case 79:
1750 YY_RULE_SETUP
1751 #line 251 "pir.l"
1752 { return TK_GET_RESULT; }
1753 YY_BREAK
1754 case 80:
1755 YY_RULE_SETUP
1756 #line 252 "pir.l"
1757 { return TK_RETURN; }
1758 YY_BREAK
1759 case 81:
1760 YY_RULE_SETUP
1761 #line 253 "pir.l"
1762 { return TK_SUB; }
1763 YY_BREAK
1764 case 82:
1765 YY_RULE_SETUP
1766 #line 254 "pir.l"
1767 { return TK_YIELD; }
1768 YY_BREAK
1769 case 83:
1770 YY_RULE_SETUP
1771 #line 255 "pir.l"
1772 { return TK_SET_RETURN; }
1773 YY_BREAK
1774 case 84:
1775 YY_RULE_SETUP
1776 #line 256 "pir.l"
1777 { return TK_SET_YIELD; }
1778 YY_BREAK
1779 case 85:
1780 YY_RULE_SETUP
1781 #line 257 "pir.l"
1782 { return TK_TAILCALL; }
1783 YY_BREAK
1784 case 86:
1785 YY_RULE_SETUP
1786 #line 259 "pir.l"
1787 { return TK_FLAG_ANON; }
1788 YY_BREAK
1789 case 87:
1790 YY_RULE_SETUP
1791 #line 260 "pir.l"
1792 { return TK_FLAG_INIT; }
1793 YY_BREAK
1794 case 88:
1795 YY_RULE_SETUP
1796 #line 261 "pir.l"
1797 { return TK_FLAG_LOAD; }
1798 YY_BREAK
1799 case 89:
1800 YY_RULE_SETUP
1801 #line 262 "pir.l"
1802 { return TK_FLAG_POSTCOMP; }
1803 YY_BREAK
1804 case 90:
1805 YY_RULE_SETUP
1806 #line 263 "pir.l"
1807 { return TK_FLAG_IMMEDIATE; }
1808 YY_BREAK
1809 case 91:
1810 YY_RULE_SETUP
1811 #line 264 "pir.l"
1812 { return TK_FLAG_MAIN; }
1813 YY_BREAK
1814 case 92:
1815 YY_RULE_SETUP
1816 #line 265 "pir.l"
1817 { return TK_FLAG_METHOD; }
1818 YY_BREAK
1819 case 93:
1820 YY_RULE_SETUP
1821 #line 266 "pir.l"
1822 { return TK_FLAG_LEX; }
1823 YY_BREAK
1824 case 94:
1825 YY_RULE_SETUP
1826 #line 267 "pir.l"
1827 { return TK_FLAG_OUTER; }
1828 YY_BREAK
1829 case 95:
1830 YY_RULE_SETUP
1831 #line 268 "pir.l"
1832 { return TK_FLAG_VTABLE; }
1833 YY_BREAK
1834 case 96:
1835 YY_RULE_SETUP
1836 #line 269 "pir.l"
1837 { return TK_FLAG_MULTI; }
1838 YY_BREAK
1839 case 97:
1840 YY_RULE_SETUP
1841 #line 270 "pir.l"
1842 { return TK_FLAG_LEXID; }
1843 YY_BREAK
1844 case 98:
1845 YY_RULE_SETUP
1846 #line 271 "pir.l"
1847 { return TK_INSTANCEOF; }
1848 YY_BREAK
1849 case 99:
1850 YY_RULE_SETUP
1851 #line 273 "pir.l"
1852 { return TK_FLAG_UNIQUE_REG; }
1853 YY_BREAK
1854 case 100:
1855 YY_RULE_SETUP
1856 #line 274 "pir.l"
1857 { return TK_FLAG_OPTIONAL; }
1858 YY_BREAK
1859 case 101:
1860 YY_RULE_SETUP
1861 #line 275 "pir.l"
1862 { return TK_FLAG_OPT_FLAG; }
1863 YY_BREAK
1864 case 102:
1865 YY_RULE_SETUP
1866 #line 276 "pir.l"
1867 { return TK_FLAG_SLURPY; }
1868 YY_BREAK
1869 case 103:
1870 YY_RULE_SETUP
1871 #line 277 "pir.l"
1872 { return TK_FLAG_NAMED; }
1873 YY_BREAK
1874 case 104:
1875 YY_RULE_SETUP
1876 #line 278 "pir.l"
1877 { return TK_FLAG_FLAT; }
1878 YY_BREAK
1879 case 105:
1880 YY_RULE_SETUP
1881 #line 279 "pir.l"
1882 { return TK_FLAG_INVOCANT; }
1883 YY_BREAK
1884 case 106:
1885 YY_RULE_SETUP
1886 #line 282 "pir.l"
1887 { /* copy the string, remove the quotes. */
1888 yylval->sval = dupstrn(yyget_extra(yyscanner), yytext + 1, yyleng - 2);
1889 return TK_STRINGC;
1891 YY_BREAK
1892 case 107:
1893 YY_RULE_SETUP
1894 #line 287 "pir.l"
1895 { yylval->ival = atoi(yytext + 2); return TK_PREG; }
1896 YY_BREAK
1897 case 108:
1898 YY_RULE_SETUP
1899 #line 288 "pir.l"
1900 { yylval->ival = atoi(yytext + 2); return TK_SREG; }
1901 YY_BREAK
1902 case 109:
1903 YY_RULE_SETUP
1904 #line 289 "pir.l"
1905 { yylval->ival = atoi(yytext + 2); return TK_NREG; }
1906 YY_BREAK
1907 case 110:
1908 YY_RULE_SETUP
1909 #line 290 "pir.l"
1910 { yylval->ival = atoi(yytext + 2); return TK_IREG; }
1911 YY_BREAK
1912 case 111:
1913 YY_RULE_SETUP
1914 #line 292 "pir.l"
1915 { /* make the label Id available in the parser. remove the ":" first. */
1916 yylval->sval = dupstrn(yyget_extra(yyscanner), yytext, yyleng - 1);
1917 return TK_LABEL;
1919 YY_BREAK
1920 case 112:
1921 YY_RULE_SETUP
1922 #line 297 "pir.l"
1923 { /* identifier; can be a global (sub or const), local or parrot op */
1924 yylval->sval = dupstr(yyget_extra(yyscanner), yytext);
1925 return TK_IDENT;
1927 YY_BREAK
1928 case 113:
1929 YY_RULE_SETUP
1930 #line 302 "pir.l"
1931 { yylval->dval = atof(yytext); return TK_NUMC; }
1932 YY_BREAK
1933 case 114:
1934 YY_RULE_SETUP
1935 #line 303 "pir.l"
1936 { yylval->ival = atoi(yytext); return TK_INTC; }
1937 YY_BREAK
1938 case 115:
1939 YY_RULE_SETUP
1940 #line 304 "pir.l"
1941 { yylval->ival = atoi(yytext); return TK_INTC; }
1942 YY_BREAK
1943 case 116:
1944 YY_RULE_SETUP
1945 #line 305 "pir.l"
1946 { yylval->ival = atoi(yytext); return TK_INTC; }
1947 YY_BREAK
1948 case 117:
1949 YY_RULE_SETUP
1950 #line 306 "pir.l"
1951 { yylval->ival = atoi(yytext); return TK_INTC; }
1952 YY_BREAK
1953 case 118:
1954 YY_RULE_SETUP
1955 #line 309 "pir.l"
1956 { /* any character not covered in the rules above is an error. */
1957 yyerror(yyscanner, yyget_extra(yyscanner), "unexpected character: '%c'", yytext[0]);
1959 YY_BREAK
1960 case YY_STATE_EOF(INITIAL):
1961 #line 313 "pir.l"
1962 { /* end of file, stop scanning. */
1963 yyterminate();
1965 YY_BREAK
1966 case 119:
1967 YY_RULE_SETUP
1968 #line 317 "pir.l"
1969 ECHO;
1970 YY_BREAK
1971 #line 1972 "pirlexer.c"
1973 case YY_END_OF_BUFFER:
1975 /* Amount of text matched not including the EOB char. */
1976 int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
1978 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1979 *yy_cp = yyg->yy_hold_char;
1980 YY_RESTORE_YY_MORE_OFFSET
1982 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1984 /* We're scanning a new file or input source. It's
1985 * possible that this happened because the user
1986 * just pointed yyin at a new source and called
1987 * yylex(). If so, then we have to assure
1988 * consistency between YY_CURRENT_BUFFER and our
1989 * globals. Here is the right place to do so, because
1990 * this is the first action (other than possibly a
1991 * back-up) that will match for the new input source.
1993 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1994 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1995 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1998 /* Note that here we test for yy_c_buf_p "<=" to the position
1999 * of the first EOB in the buffer, since yy_c_buf_p will
2000 * already have been incremented past the NUL character
2001 * (since all states make transitions on EOB to the
2002 * end-of-buffer state). Contrast this with the test
2003 * in input().
2005 if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
2006 { /* This was really a NUL. */
2007 yy_state_type yy_next_state;
2009 yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
2011 yy_current_state = yy_get_previous_state( yyscanner );
2013 /* Okay, we're now positioned to make the NUL
2014 * transition. We couldn't have
2015 * yy_get_previous_state() go ahead and do it
2016 * for us because it doesn't know how to deal
2017 * with the possibility of jamming (and we don't
2018 * want to build jamming into it because then it
2019 * will run more slowly).
2022 yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
2024 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2026 if ( yy_next_state )
2028 /* Consume the NUL. */
2029 yy_cp = ++yyg->yy_c_buf_p;
2030 yy_current_state = yy_next_state;
2031 goto yy_match;
2034 else
2036 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
2037 yy_cp = yyg->yy_last_accepting_cpos;
2038 yy_current_state = yyg->yy_last_accepting_state;
2039 goto yy_find_action;
2043 else switch ( yy_get_next_buffer( yyscanner ) )
2045 case EOB_ACT_END_OF_FILE:
2047 yyg->yy_did_buffer_switch_on_eof = 0;
2049 if ( yywrap(yyscanner ) )
2051 /* Note: because we've taken care in
2052 * yy_get_next_buffer() to have set up
2053 * yytext, we can now set up
2054 * yy_c_buf_p so that if some total
2055 * hoser (like flex itself) wants to
2056 * call the scanner after we return the
2057 * YY_NULL, it'll still work - another
2058 * YY_NULL will get returned.
2060 yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
2062 yy_act = YY_STATE_EOF(YY_START);
2063 goto do_action;
2066 else
2068 if ( ! yyg->yy_did_buffer_switch_on_eof )
2069 YY_NEW_FILE;
2071 break;
2074 case EOB_ACT_CONTINUE_SCAN:
2075 yyg->yy_c_buf_p =
2076 yyg->yytext_ptr + yy_amount_of_matched_text;
2078 yy_current_state = yy_get_previous_state( yyscanner );
2080 yy_cp = yyg->yy_c_buf_p;
2081 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2082 goto yy_match;
2084 case EOB_ACT_LAST_MATCH:
2085 yyg->yy_c_buf_p =
2086 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
2088 yy_current_state = yy_get_previous_state( yyscanner );
2090 yy_cp = yyg->yy_c_buf_p;
2091 yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
2092 goto yy_find_action;
2094 break;
2097 default:
2098 YY_FATAL_ERROR(
2099 "fatal flex scanner internal error--no action found" );
2100 } /* end of action switch */
2101 } /* end of scanning one token */
2102 } /* end of yylex */
2103 /* %ok-for-header */
2105 /* %if-c++-only */
2106 /* %not-for-header */
2108 /* %ok-for-header */
2110 /* %endif */
2112 /* yy_get_next_buffer - try to read in a new buffer
2114 * Returns a code representing an action:
2115 * EOB_ACT_LAST_MATCH -
2116 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2117 * EOB_ACT_END_OF_FILE - end of file
2119 /* %if-c-only */
2120 static int yy_get_next_buffer (yyscan_t yyscanner)
2121 /* %endif */
2122 /* %if-c++-only */
2123 /* %endif */
2125 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2126 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2127 register char *source = yyg->yytext_ptr;
2128 register int number_to_move, i;
2129 int ret_val;
2131 if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
2132 YY_FATAL_ERROR(
2133 "fatal flex scanner internal error--end of buffer missed" );
2135 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2136 { /* Don't try to fill the buffer, so this is an EOF. */
2137 if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
2139 /* We matched a single character, the EOB, so
2140 * treat this as a final EOF.
2142 return EOB_ACT_END_OF_FILE;
2145 else
2147 /* We matched some text prior to the EOB, first
2148 * process it.
2150 return EOB_ACT_LAST_MATCH;
2154 /* Try to read more data. */
2156 /* First move last chars to start of buffer. */
2157 number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
2159 for ( i = 0; i < number_to_move; ++i )
2160 *(dest++) = *(source++);
2162 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2163 /* don't do the read, it's not guaranteed to return an EOF,
2164 * just force an EOF
2166 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
2168 else
2170 int num_to_read =
2171 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2173 while ( num_to_read <= 0 )
2174 { /* Not enough room in the buffer - grow it. */
2176 /* just a shorter name for the current buffer */
2177 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2179 int yy_c_buf_p_offset =
2180 (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
2182 if ( b->yy_is_our_buffer )
2184 int new_size = b->yy_buf_size * 2;
2186 if ( new_size <= 0 )
2187 b->yy_buf_size += b->yy_buf_size / 8;
2188 else
2189 b->yy_buf_size *= 2;
2191 b->yy_ch_buf = (char *)
2192 /* Include room in for 2 EOB chars. */
2193 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
2195 else
2196 /* Can't grow it, we don't own it. */
2197 b->yy_ch_buf = 0;
2199 if ( ! b->yy_ch_buf )
2200 YY_FATAL_ERROR(
2201 "fatal error - scanner input buffer overflow" );
2203 yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2205 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2206 number_to_move - 1;
2210 if ( num_to_read > YY_READ_BUF_SIZE )
2211 num_to_read = YY_READ_BUF_SIZE;
2213 /* Read in more data. */
2214 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
2215 yyg->yy_n_chars, num_to_read );
2217 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2220 if ( yyg->yy_n_chars == 0 )
2222 if ( number_to_move == YY_MORE_ADJ )
2224 ret_val = EOB_ACT_END_OF_FILE;
2225 yyrestart(yyin ,yyscanner);
2228 else
2230 ret_val = EOB_ACT_LAST_MATCH;
2231 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2232 YY_BUFFER_EOF_PENDING;
2236 else
2237 ret_val = EOB_ACT_CONTINUE_SCAN;
2239 yyg->yy_n_chars += number_to_move;
2240 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2241 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2243 yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2245 return ret_val;
2248 /* yy_get_previous_state - get the state just before the EOB char was reached */
2250 /* %if-c-only */
2251 /* %not-for-header */
2253 static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
2254 /* %endif */
2255 /* %if-c++-only */
2256 /* %endif */
2258 register yy_state_type yy_current_state;
2259 register char *yy_cp;
2260 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2262 /* %% [15.0] code to get the start state into yy_current_state goes here */
2263 yy_current_state = yyg->yy_start;
2265 for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
2267 /* %% [16.0] code to find the next state goes here */
2268 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2269 if ( yy_accept[yy_current_state] )
2271 yyg->yy_last_accepting_state = yy_current_state;
2272 yyg->yy_last_accepting_cpos = yy_cp;
2274 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2276 yy_current_state = (int) yy_def[yy_current_state];
2277 if ( yy_current_state >= 400 )
2278 yy_c = yy_meta[(unsigned int) yy_c];
2280 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2283 return yy_current_state;
2286 /* yy_try_NUL_trans - try to make a transition on the NUL character
2288 * synopsis
2289 * next_state = yy_try_NUL_trans( current_state );
2291 /* %if-c-only */
2292 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
2293 /* %endif */
2294 /* %if-c++-only */
2295 /* %endif */
2297 register int yy_is_jam;
2298 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
2299 /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
2300 register char *yy_cp = yyg->yy_c_buf_p;
2302 register YY_CHAR yy_c = 1;
2303 if ( yy_accept[yy_current_state] )
2305 yyg->yy_last_accepting_state = yy_current_state;
2306 yyg->yy_last_accepting_cpos = yy_cp;
2308 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2310 yy_current_state = (int) yy_def[yy_current_state];
2311 if ( yy_current_state >= 400 )
2312 yy_c = yy_meta[(unsigned int) yy_c];
2314 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2315 yy_is_jam = (yy_current_state == 399);
2317 return yy_is_jam ? 0 : yy_current_state;
2320 /* %if-c-only */
2322 /* %endif */
2324 /* %if-c-only */
2325 #ifndef YY_NO_INPUT
2326 #ifdef __cplusplus
2327 static int yyinput (yyscan_t yyscanner)
2328 #else
2329 static int input (yyscan_t yyscanner)
2330 #endif
2332 /* %endif */
2333 /* %if-c++-only */
2334 /* %endif */
2336 int c;
2337 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2339 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2341 if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2343 /* yy_c_buf_p now points to the character we want to return.
2344 * If this occurs *before* the EOB characters, then it's a
2345 * valid NUL; if not, then we've hit the end of the buffer.
2347 if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
2348 /* This was really a NUL. */
2349 *yyg->yy_c_buf_p = '\0';
2351 else
2352 { /* need more input */
2353 int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
2354 ++yyg->yy_c_buf_p;
2356 switch ( yy_get_next_buffer( yyscanner ) )
2358 case EOB_ACT_LAST_MATCH:
2359 /* This happens because yy_g_n_b()
2360 * sees that we've accumulated a
2361 * token and flags that we need to
2362 * try matching the token before
2363 * proceeding. But for input(),
2364 * there's no matching to consider.
2365 * So convert the EOB_ACT_LAST_MATCH
2366 * to EOB_ACT_END_OF_FILE.
2369 /* Reset buffer status. */
2370 yyrestart(yyin ,yyscanner);
2372 /*FALLTHROUGH*/
2374 case EOB_ACT_END_OF_FILE:
2376 if ( yywrap(yyscanner ) )
2377 return EOF;
2379 if ( ! yyg->yy_did_buffer_switch_on_eof )
2380 YY_NEW_FILE;
2381 #ifdef __cplusplus
2382 return yyinput(yyscanner);
2383 #else
2384 return input(yyscanner);
2385 #endif
2388 case EOB_ACT_CONTINUE_SCAN:
2389 yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
2390 break;
2395 c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
2396 *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
2397 yyg->yy_hold_char = *++yyg->yy_c_buf_p;
2399 /* %% [19.0] update BOL and yylineno */
2400 if ( c == '\n' )
2402 do{ yylineno++;
2403 yycolumn=0;
2404 }while(0)
2407 return c;
2409 /* %if-c-only */
2410 #endif /* ifndef YY_NO_INPUT */
2411 /* %endif */
2413 /** Immediately switch to a different input stream.
2414 * @param input_file A readable stream.
2415 * @param yyscanner The scanner object.
2416 * @note This function does not reset the start condition to @c INITIAL .
2418 /* %if-c-only */
2419 void yyrestart (FILE * input_file , yyscan_t yyscanner)
2420 /* %endif */
2421 /* %if-c++-only */
2422 /* %endif */
2424 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2426 if ( ! YY_CURRENT_BUFFER ){
2427 yyensure_buffer_stack (yyscanner);
2428 YY_CURRENT_BUFFER_LVALUE =
2429 yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
2432 yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
2433 yy_load_buffer_state(yyscanner );
2436 /** Switch to a different input buffer.
2437 * @param new_buffer The new input buffer.
2438 * @param yyscanner The scanner object.
2440 /* %if-c-only */
2441 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2442 /* %endif */
2443 /* %if-c++-only */
2444 /* %endif */
2446 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2448 /* TODO. We should be able to replace this entire function body
2449 * with
2450 * yypop_buffer_state();
2451 * yypush_buffer_state(new_buffer);
2453 yyensure_buffer_stack (yyscanner);
2454 if ( YY_CURRENT_BUFFER == new_buffer )
2455 return;
2457 if ( YY_CURRENT_BUFFER )
2459 /* Flush out information for old buffer. */
2460 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2461 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2462 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2465 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2466 yy_load_buffer_state(yyscanner );
2468 /* We don't actually know whether we did this switch during
2469 * EOF (yywrap()) processing, but the only time this flag
2470 * is looked at is after yywrap() is called, so it's safe
2471 * to go ahead and always set it.
2473 yyg->yy_did_buffer_switch_on_eof = 1;
2476 /* %if-c-only */
2477 static void yy_load_buffer_state (yyscan_t yyscanner)
2478 /* %endif */
2479 /* %if-c++-only */
2480 /* %endif */
2482 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2483 yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2484 yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2485 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2486 yyg->yy_hold_char = *yyg->yy_c_buf_p;
2489 /** Allocate and initialize an input buffer state.
2490 * @param file A readable stream.
2491 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
2492 * @param yyscanner The scanner object.
2493 * @return the allocated buffer state.
2495 /* %if-c-only */
2496 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
2497 /* %endif */
2498 /* %if-c++-only */
2499 /* %endif */
2501 YY_BUFFER_STATE b;
2503 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2504 if ( ! b )
2505 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2507 b->yy_buf_size = size;
2509 /* yy_ch_buf has to be 2 characters longer than the size given because
2510 * we need to put in 2 end-of-buffer characters.
2512 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ,yyscanner );
2513 if ( ! b->yy_ch_buf )
2514 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2516 b->yy_is_our_buffer = 1;
2518 yy_init_buffer(b,file ,yyscanner);
2520 return b;
2523 /** Destroy the buffer.
2524 * @param b a buffer created with yy_create_buffer()
2525 * @param yyscanner The scanner object.
2527 /* %if-c-only */
2528 void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2529 /* %endif */
2530 /* %if-c++-only */
2531 /* %endif */
2533 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2535 if ( ! b )
2536 return;
2538 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2539 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2541 if ( b->yy_is_our_buffer )
2542 yyfree((void *) b->yy_ch_buf ,yyscanner );
2544 yyfree((void *) b ,yyscanner );
2547 /* %if-c-only */
2549 /* %endif */
2551 /* %if-c++-only */
2552 /* %endif */
2554 /* Initializes or reinitializes a buffer.
2555 * This function is sometimes called more than once on the same buffer,
2556 * such as during a yyrestart() or at EOF.
2558 /* %if-c-only */
2559 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
2560 /* %endif */
2561 /* %if-c++-only */
2562 /* %endif */
2565 int oerrno = errno;
2566 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2568 yy_flush_buffer(b ,yyscanner);
2570 b->yy_input_file = file;
2571 b->yy_fill_buffer = 1;
2573 /* If b is the current buffer, then yy_init_buffer was _probably_
2574 * called from yyrestart() or through yy_get_next_buffer.
2575 * In that case, we don't want to reset the lineno or column.
2577 if (b != YY_CURRENT_BUFFER){
2578 b->yy_bs_lineno = 1;
2579 b->yy_bs_column = 0;
2582 /* %if-c-only */
2584 b->yy_is_interactive = 0;
2586 /* %endif */
2587 /* %if-c++-only */
2588 /* %endif */
2589 errno = oerrno;
2592 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2593 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2594 * @param yyscanner The scanner object.
2596 /* %if-c-only */
2597 void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
2598 /* %endif */
2599 /* %if-c++-only */
2600 /* %endif */
2602 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2603 if ( ! b )
2604 return;
2606 b->yy_n_chars = 0;
2608 /* We always need two end-of-buffer characters. The first causes
2609 * a transition to the end-of-buffer state. The second causes
2610 * a jam in that state.
2612 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2613 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2615 b->yy_buf_pos = &b->yy_ch_buf[0];
2617 b->yy_at_bol = 1;
2618 b->yy_buffer_status = YY_BUFFER_NEW;
2620 if ( b == YY_CURRENT_BUFFER )
2621 yy_load_buffer_state(yyscanner );
2624 /* %if-c-or-c++ */
2625 /** Pushes the new state onto the stack. The new state becomes
2626 * the current state. This function will allocate the stack
2627 * if necessary.
2628 * @param new_buffer The new state.
2629 * @param yyscanner The scanner object.
2631 /* %if-c-only */
2632 void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
2633 /* %endif */
2634 /* %if-c++-only */
2635 /* %endif */
2637 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2638 if (new_buffer == NULL)
2639 return;
2641 yyensure_buffer_stack(yyscanner);
2643 /* This block is copied from yy_switch_to_buffer. */
2644 if ( YY_CURRENT_BUFFER )
2646 /* Flush out information for old buffer. */
2647 *yyg->yy_c_buf_p = yyg->yy_hold_char;
2648 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
2649 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
2652 /* Only push if top exists. Otherwise, replace top. */
2653 if (YY_CURRENT_BUFFER)
2654 yyg->yy_buffer_stack_top++;
2655 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2657 /* copied from yy_switch_to_buffer. */
2658 yy_load_buffer_state(yyscanner );
2659 yyg->yy_did_buffer_switch_on_eof = 1;
2661 /* %endif */
2663 /* %if-c-or-c++ */
2664 /** Removes and deletes the top of the stack, if present.
2665 * The next element becomes the new top.
2666 * @param yyscanner The scanner object.
2668 /* %if-c-only */
2669 void yypop_buffer_state (yyscan_t yyscanner)
2670 /* %endif */
2671 /* %if-c++-only */
2672 /* %endif */
2674 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2675 if (!YY_CURRENT_BUFFER)
2676 return;
2678 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
2679 YY_CURRENT_BUFFER_LVALUE = NULL;
2680 if (yyg->yy_buffer_stack_top > 0)
2681 --yyg->yy_buffer_stack_top;
2683 if (YY_CURRENT_BUFFER) {
2684 yy_load_buffer_state(yyscanner );
2685 yyg->yy_did_buffer_switch_on_eof = 1;
2688 /* %endif */
2690 /* %if-c-or-c++ */
2691 /* Allocates the stack if it does not exist.
2692 * Guarantees space for at least one push.
2694 /* %if-c-only */
2695 static void yyensure_buffer_stack (yyscan_t yyscanner)
2696 /* %endif */
2697 /* %if-c++-only */
2698 /* %endif */
2700 int num_to_alloc;
2701 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2703 if (!yyg->yy_buffer_stack) {
2705 /* First allocation is just for 2 elements, since we don't know if this
2706 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2707 * immediate realloc on the next call.
2709 num_to_alloc = 1;
2710 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
2711 (num_to_alloc * sizeof(struct yy_buffer_state*)
2712 , yyscanner);
2714 memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2716 yyg->yy_buffer_stack_max = num_to_alloc;
2717 yyg->yy_buffer_stack_top = 0;
2718 return;
2721 if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
2723 /* Increase the buffer to prepare for a possible push. */
2724 int grow_size = 8 /* arbitrary grow size */;
2726 num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
2727 yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
2728 (yyg->yy_buffer_stack,
2729 num_to_alloc * sizeof(struct yy_buffer_state*)
2730 , yyscanner);
2732 /* zero only the new slots.*/
2733 memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
2734 yyg->yy_buffer_stack_max = num_to_alloc;
2737 /* %endif */
2739 /* %if-c-only */
2740 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2741 * @param base the character buffer
2742 * @param size the size in bytes of the character buffer
2743 * @param yyscanner The scanner object.
2744 * @return the newly allocated buffer state object.
2746 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
2748 YY_BUFFER_STATE b;
2750 if ( size < 2 ||
2751 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2752 base[size-1] != YY_END_OF_BUFFER_CHAR )
2753 /* They forgot to leave room for the EOB's. */
2754 return 0;
2756 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
2757 if ( ! b )
2758 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2760 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2761 b->yy_buf_pos = b->yy_ch_buf = base;
2762 b->yy_is_our_buffer = 0;
2763 b->yy_input_file = 0;
2764 b->yy_n_chars = b->yy_buf_size;
2765 b->yy_is_interactive = 0;
2766 b->yy_at_bol = 1;
2767 b->yy_fill_buffer = 0;
2768 b->yy_buffer_status = YY_BUFFER_NEW;
2770 yy_switch_to_buffer(b ,yyscanner );
2772 return b;
2774 /* %endif */
2776 /* %if-c-only */
2777 /** Setup the input buffer state to scan a string. The next call to yylex() will
2778 * scan from a @e copy of @a str.
2779 * @param str a NUL-terminated string to scan
2780 * @param yyscanner The scanner object.
2781 * @return the newly allocated buffer state object.
2782 * @note If you want to scan bytes that may contain NUL values, then use
2783 * yy_scan_bytes() instead.
2785 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
2788 return yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
2790 /* %endif */
2792 /* %if-c-only */
2793 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2794 * scan from a @e copy of @a bytes.
2795 * @param bytes the byte buffer to scan
2796 * @param len the number of bytes in the buffer pointed to by @a bytes.
2797 * @param yyscanner The scanner object.
2798 * @return the newly allocated buffer state object.
2800 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
2802 YY_BUFFER_STATE b;
2803 char *buf;
2804 yy_size_t n;
2805 int i;
2807 /* Get memory for full buffer, including space for trailing EOB's. */
2808 n = _yybytes_len + 2;
2809 buf = (char *) yyalloc(n ,yyscanner );
2810 if ( ! buf )
2811 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2813 for ( i = 0; i < _yybytes_len; ++i )
2814 buf[i] = yybytes[i];
2816 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2818 b = yy_scan_buffer(buf,n ,yyscanner);
2819 if ( ! b )
2820 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2822 /* It's okay to grow etc. this buffer, and we should throw it
2823 * away when we're done.
2825 b->yy_is_our_buffer = 1;
2827 return b;
2829 /* %endif */
2831 #ifndef YY_EXIT_FAILURE
2832 #define YY_EXIT_FAILURE 2
2833 #endif
2835 /* %if-c-only */
2836 static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
2838 (void) fprintf( stderr, "%s\n", msg );
2839 exit( YY_EXIT_FAILURE );
2841 /* %endif */
2842 /* %if-c++-only */
2843 /* %endif */
2845 /* Redefine yyless() so it works in section 3 code. */
2847 #undef yyless
2848 #define yyless(n) \
2849 do \
2851 /* Undo effects of setting up yytext. */ \
2852 int yyless_macro_arg = (n); \
2853 YY_LESS_LINENO(yyless_macro_arg);\
2854 yytext[yyleng] = yyg->yy_hold_char; \
2855 yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
2856 yyg->yy_hold_char = *yyg->yy_c_buf_p; \
2857 *yyg->yy_c_buf_p = '\0'; \
2858 yyleng = yyless_macro_arg; \
2860 while ( 0 )
2862 /* Accessor methods (get/set functions) to struct members. */
2864 /* %if-c-only */
2865 /* %if-reentrant */
2867 /** Get the user-defined data for this scanner.
2868 * @param yyscanner The scanner object.
2870 YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
2872 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2873 return yyextra;
2876 /* %endif */
2878 /** Get the current line number.
2879 * @param yyscanner The scanner object.
2881 int yyget_lineno (yyscan_t yyscanner)
2883 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2885 if (! YY_CURRENT_BUFFER)
2886 return 0;
2888 return yylineno;
2891 /** Get the current column number.
2892 * @param yyscanner The scanner object.
2894 int yyget_column (yyscan_t yyscanner)
2896 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2898 if (! YY_CURRENT_BUFFER)
2899 return 0;
2901 return yycolumn;
2904 /** Get the input stream.
2905 * @param yyscanner The scanner object.
2907 FILE *yyget_in (yyscan_t yyscanner)
2909 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2910 return yyin;
2913 /** Get the output stream.
2914 * @param yyscanner The scanner object.
2916 FILE *yyget_out (yyscan_t yyscanner)
2918 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2919 return yyout;
2922 /** Get the length of the current token.
2923 * @param yyscanner The scanner object.
2925 int yyget_leng (yyscan_t yyscanner)
2927 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2928 return yyleng;
2931 /** Get the current token.
2932 * @param yyscanner The scanner object.
2935 char *yyget_text (yyscan_t yyscanner)
2937 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2938 return yytext;
2941 /* %if-reentrant */
2943 /** Set the user-defined data. This data is never touched by the scanner.
2944 * @param user_defined The data to be associated with this scanner.
2945 * @param yyscanner The scanner object.
2947 void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
2949 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2950 yyextra = user_defined ;
2953 /* %endif */
2955 /** Set the current line number.
2956 * @param line_number
2957 * @param yyscanner The scanner object.
2959 void yyset_lineno (int line_number , yyscan_t yyscanner)
2961 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2963 /* lineno is only valid if an input buffer exists. */
2964 if (! YY_CURRENT_BUFFER )
2965 yy_fatal_error( "yyset_lineno called with no buffer" , yyscanner);
2967 yylineno = line_number;
2970 /** Set the current column.
2971 * @param line_number
2972 * @param yyscanner The scanner object.
2974 void yyset_column (int column_no , yyscan_t yyscanner)
2976 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2978 /* column is only valid if an input buffer exists. */
2979 if (! YY_CURRENT_BUFFER )
2980 yy_fatal_error( "yyset_column called with no buffer" , yyscanner);
2982 yycolumn = column_no;
2985 /** Set the input stream. This does not discard the current
2986 * input buffer.
2987 * @param in_str A readable stream.
2988 * @param yyscanner The scanner object.
2989 * @see yy_switch_to_buffer
2991 void yyset_in (FILE * in_str , yyscan_t yyscanner)
2993 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
2994 yyin = in_str ;
2997 void yyset_out (FILE * out_str , yyscan_t yyscanner)
2999 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3000 yyout = out_str ;
3003 int yyget_debug (yyscan_t yyscanner)
3005 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3006 return yy_flex_debug;
3009 void yyset_debug (int bdebug , yyscan_t yyscanner)
3011 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3012 yy_flex_debug = bdebug ;
3015 /* %endif */
3017 /* %if-reentrant */
3018 /* Accessor methods for yylval and yylloc */
3020 /* %if-bison-bridge */
3022 YYSTYPE * yyget_lval (yyscan_t yyscanner)
3024 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3025 return yylval;
3028 void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
3030 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3031 yylval = yylval_param;
3034 /* %endif */
3036 /* User-visible API */
3038 /* yylex_init is special because it creates the scanner itself, so it is
3039 * the ONLY reentrant function that doesn't take the scanner as the last argument.
3040 * That's why we explicitly handle the declaration, instead of using our macros.
3043 int yylex_init(yyscan_t* ptr_yy_globals)
3046 if (ptr_yy_globals == NULL){
3047 errno = EINVAL;
3048 return 1;
3051 *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
3053 if (*ptr_yy_globals == NULL){
3054 errno = ENOMEM;
3055 return 1;
3058 /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
3059 memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
3061 return yy_init_globals ( *ptr_yy_globals );
3064 /* %endif */
3066 /* %if-c-only */
3067 static int yy_init_globals (yyscan_t yyscanner)
3069 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3070 /* Initialization is the same as for the non-reentrant scanner.
3071 * This function is called from yylex_destroy(), so don't allocate here.
3074 yyg->yy_buffer_stack = 0;
3075 yyg->yy_buffer_stack_top = 0;
3076 yyg->yy_buffer_stack_max = 0;
3077 yyg->yy_c_buf_p = (char *) 0;
3078 yyg->yy_init = 0;
3079 yyg->yy_start = 0;
3081 yyg->yy_start_stack_ptr = 0;
3082 yyg->yy_start_stack_depth = 0;
3083 yyg->yy_start_stack = NULL;
3085 /* Defined in main.c */
3086 #ifdef YY_STDINIT
3087 yyin = stdin;
3088 yyout = stdout;
3089 #else
3090 yyin = (FILE *) 0;
3091 yyout = (FILE *) 0;
3092 #endif
3094 /* For future reference: Set errno on error, since we are called by
3095 * yylex_init()
3097 return 0;
3099 /* %endif */
3101 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
3102 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
3103 int yylex_destroy (yyscan_t yyscanner)
3105 struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
3107 /* Pop the buffer stack, destroying each element. */
3108 while(YY_CURRENT_BUFFER){
3109 yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
3110 YY_CURRENT_BUFFER_LVALUE = NULL;
3111 yypop_buffer_state(yyscanner);
3114 /* Destroy the stack itself. */
3115 yyfree(yyg->yy_buffer_stack ,yyscanner);
3116 yyg->yy_buffer_stack = NULL;
3118 /* Destroy the start condition stack. */
3119 yyfree(yyg->yy_start_stack ,yyscanner );
3120 yyg->yy_start_stack = NULL;
3122 /* Reset the globals. This is important in a non-reentrant scanner so the next time
3123 * yylex() is called, initialization will occur. */
3124 yy_init_globals( yyscanner);
3126 /* %if-reentrant */
3127 /* Destroy the main struct (reentrant only). */
3128 yyfree ( yyscanner , yyscanner );
3129 yyscanner = NULL;
3130 /* %endif */
3131 return 0;
3133 /* %endif */
3136 * Internal utility routines.
3139 #ifndef yytext_ptr
3140 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
3142 register int i;
3143 for ( i = 0; i < n; ++i )
3144 s1[i] = s2[i];
3146 #endif
3148 #ifdef YY_NEED_STRLEN
3149 static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
3151 register int n;
3152 for ( n = 0; s[n]; ++n )
3155 return n;
3157 #endif
3159 void *yyalloc (yy_size_t size , yyscan_t yyscanner)
3161 return (void *) malloc( size );
3164 void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
3166 /* The cast to (char *) in the following accommodates both
3167 * implementations that use char* generic pointers, and those
3168 * that use void* generic pointers. It works with the latter
3169 * because both ANSI C and C++ allow castless assignment from
3170 * any pointer type to void*, and deal with argument conversions
3171 * as though doing an assignment.
3173 return (void *) realloc( (char *) ptr, size );
3176 void yyfree (void * ptr , yyscan_t yyscanner)
3178 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
3181 /* %if-tables-serialization definitions */
3182 /* %define-yytables The name for this specific scanner's tables. */
3183 #define YYTABLES_NAME "yytables"
3184 /* %endif */
3186 /* %ok-for-header */
3188 #line 317 "pir.l"
3198 * Local variables:
3199 * c-file-style: "parrot"
3200 * End:
3201 * vim: expandtab shiftwidth=4: