1 #define yy_create_buffer llvmAsm_create_buffer
2 #define yy_delete_buffer llvmAsm_delete_buffer
3 #define yy_scan_buffer llvmAsm_scan_buffer
4 #define yy_scan_string llvmAsm_scan_string
5 #define yy_scan_bytes llvmAsm_scan_bytes
6 #define yy_flex_debug llvmAsm_flex_debug
7 #define yy_init_buffer llvmAsm_init_buffer
8 #define yy_flush_buffer llvmAsm_flush_buffer
9 #define yy_load_buffer_state llvmAsm_load_buffer_state
10 #define yy_switch_to_buffer llvmAsm_switch_to_buffer
11 #define yyin llvmAsmin
12 #define yyleng llvmAsmleng
13 #define yylex llvmAsmlex
14 #define yyout llvmAsmout
15 #define yyrestart llvmAsmrestart
16 #define yytext llvmAsmtext
17 #define yylineno llvmAsmlineno
20 /* A lexical scanner generated by flex */
22 /* Scanner skeleton version:
27 #define YY_FLEX_MAJOR_VERSION 2
28 #define YY_FLEX_MINOR_VERSION 5
33 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
46 /* Use prototypes in function declarations. */
49 /* The "const" storage-class-modifier is valid. */
52 #else /* ! __cplusplus */
60 #endif /* ! __cplusplus */
79 #define YY_PROTO(proto) proto
81 #define YY_PROTO(proto) ()
84 /* Returned upon end-of-file. */
87 /* Promotes a possibly negative, possibly signed char to an unsigned
88 * integer for use as an array index. If the signed char is negative,
89 * we want to instead treat it as an 8-bit unsigned char, hence the
92 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
94 /* Enter a start condition. This macro really ought to take a parameter,
95 * but we do it the disgusting crufty way forced on us by the ()-less
96 * definition of BEGIN.
98 #define BEGIN yy_start = 1 + 2 *
100 /* Translate the current start state into a value that can be later handed
101 * to BEGIN to return to the state. The YYSTATE alias is for lex
104 #define YY_START ((yy_start - 1) / 2)
105 #define YYSTATE YY_START
107 /* Action number for EOF rule of a given start state. */
108 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
110 /* Special action meaning "start processing a new file". */
111 #define YY_NEW_FILE yyrestart( yyin )
113 #define YY_END_OF_BUFFER_CHAR 0
115 /* Size of default input buffer. */
116 #define YY_BUF_SIZE 16384
118 typedef struct yy_buffer_state *YY_BUFFER_STATE;
121 extern FILE *yyin, *yyout;
123 #define EOB_ACT_CONTINUE_SCAN 0
124 #define EOB_ACT_END_OF_FILE 1
125 #define EOB_ACT_LAST_MATCH 2
127 /* The funky do-while in the following #define is used to turn the definition
128 * int a single C statement (which needs a semi-colon terminator). This
129 * avoids problems with code like:
131 * if ( condition_holds )
134 * do_something_else();
136 * Prior to using the do-while the compiler would get upset at the
137 * "else" because it interpreted the "if" statement as being all
138 * done when it reached the ';' after the yyless() call.
141 /* Return all but the first 'n' matched characters back to the input stream. */
146 /* Undo effects of setting up yytext. */ \
147 *yy_cp = yy_hold_char; \
148 YY_RESTORE_YY_MORE_OFFSET \
149 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
150 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
154 #define unput(c) yyunput( c, yytext_ptr )
156 /* The following is because we cannot portably get our hands on size_t
157 * (without autoconf's help, which isn't available because we want
158 * flex-generated scanners to compile on their own).
160 typedef unsigned int yy_size_t;
163 struct yy_buffer_state
167 char *yy_ch_buf; /* input buffer */
168 char *yy_buf_pos; /* current position in input buffer */
170 /* Size of input buffer in bytes, not including room for EOB
173 yy_size_t yy_buf_size;
175 /* Number of characters read into yy_ch_buf, not including EOB
180 /* Whether we "own" the buffer - i.e., we know we created it,
181 * and can realloc() it to grow it, and should free() it to
184 int yy_is_our_buffer;
186 /* Whether this is an "interactive" input source; if so, and
187 * if we're using stdio for input, then we want to use getc()
188 * instead of fread(), to make sure we stop fetching input after
191 int yy_is_interactive;
193 /* Whether we're considered to be at the beginning of a line.
194 * If so, '^' rules will be active on the next match, otherwise
199 /* Whether to try to fill the input buffer when we reach the
204 int yy_buffer_status;
205 #define YY_BUFFER_NEW 0
206 #define YY_BUFFER_NORMAL 1
207 /* When an EOF's been seen but there's still some text to process
208 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
209 * shouldn't try reading from the input source any more. We might
210 * still have a bunch of tokens to match, though, because of
211 * possible backing-up.
213 * When we actually see the EOF, we change the status to "new"
214 * (via yyrestart()), so that the user can continue scanning by
215 * just pointing yyin at a new input file.
217 #define YY_BUFFER_EOF_PENDING 2
220 static YY_BUFFER_STATE yy_current_buffer = 0;
222 /* We provide macros for accessing buffer states in case in the
223 * future we want to put the buffer states in a more general
226 #define YY_CURRENT_BUFFER yy_current_buffer
229 /* yy_hold_char holds the character lost when yytext is formed. */
230 static char yy_hold_char;
232 static int yy_n_chars; /* number of characters read into yy_ch_buf */
237 /* Points to current character in buffer. */
238 static char *yy_c_buf_p = (char *) 0;
239 static int yy_init = 1; /* whether we need to initialize */
240 static int yy_start = 0; /* start state number */
242 /* Flag which is used to allow yywrap()'s to do buffer switches
243 * instead of setting up a fresh yyin. A bit of a hack ...
245 static int yy_did_buffer_switch_on_eof;
247 void yyrestart YY_PROTO(( FILE *input_file ));
249 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
250 void yy_load_buffer_state YY_PROTO(( void ));
251 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
252 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
253 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
254 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
255 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
257 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
258 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
259 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
261 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
262 static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
263 static void yy_flex_free YY_PROTO(( void * ));
265 #define yy_new_buffer yy_create_buffer
267 #define yy_set_interactive(is_interactive) \
269 if ( ! yy_current_buffer ) \
270 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
271 yy_current_buffer->yy_is_interactive = is_interactive; \
274 #define yy_set_bol(at_bol) \
276 if ( ! yy_current_buffer ) \
277 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
278 yy_current_buffer->yy_at_bol = at_bol; \
281 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
284 #define YY_USES_REJECT
287 #define YY_SKIP_YYWRAP
288 typedef unsigned char YY_CHAR;
289 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
290 typedef int yy_state_type;
294 #define yytext_ptr yytext
296 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
297 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
298 static int yy_get_next_buffer YY_PROTO(( void ));
299 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
301 /* Done after the current pattern has been matched and before the
302 * corresponding action - sets up yytext.
304 #define YY_DO_BEFORE_ACTION \
305 yytext_ptr = yy_bp; \
306 yyleng = (int) (yy_cp - yy_bp); \
307 yy_hold_char = *yy_cp; \
311 #define YY_NUM_RULES 59
312 #define YY_END_OF_BUFFER 60
313 static yyconst short int yy_acclist[115] =
315 60, 58, 59, 57, 58, 59, 57, 59, 58, 59,
316 58, 59, 58, 59, 58, 59, 52, 58, 59, 1,
317 58, 59, 58, 59, 58, 59, 58, 59, 58, 59,
318 58, 59, 58, 59, 58, 59, 58, 59, 58, 59,
319 58, 59, 58, 59, 58, 59, 58, 59, 58, 59,
320 58, 59, 58, 59, 58, 59, 50, 49, 54, 53,
321 56, 52, 1, 41, 34, 51, 49, 55, 56, 23,
322 26, 3, 14, 25, 22, 35, 27, 40, 38, 39,
323 24, 9, 36, 37, 45, 46, 16, 4, 20, 15,
324 8, 2, 5, 18, 21, 10, 29, 33, 31, 32,
326 30, 28, 12, 47, 11, 17, 44, 19, 43, 42,
330 static yyconst short int yy_accept[201] =
332 1, 1, 1, 2, 4, 7, 9, 11, 13, 15,
333 17, 20, 23, 25, 27, 29, 31, 33, 35, 37,
334 39, 41, 43, 45, 47, 49, 51, 53, 55, 57,
335 57, 57, 58, 59, 59, 60, 61, 62, 63, 64,
336 64, 64, 64, 64, 65, 65, 65, 65, 65, 65,
337 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
338 65, 65, 65, 65, 65, 65, 65, 65, 65, 66,
339 66, 66, 66, 66, 66, 66, 66, 67, 68, 69,
340 70, 71, 71, 71, 71, 71, 71, 71, 72, 72,
341 73, 73, 73, 73, 73, 73, 74, 74, 74, 74,
343 74, 75, 76, 77, 78, 79, 79, 79, 80, 80,
344 81, 81, 82, 82, 82, 82, 82, 82, 82, 82,
345 82, 82, 82, 83, 84, 85, 85, 85, 85, 85,
346 86, 86, 86, 86, 87, 88, 88, 88, 88, 88,
347 88, 88, 88, 88, 88, 89, 90, 90, 91, 91,
348 91, 92, 92, 93, 93, 93, 94, 95, 95, 95,
349 96, 96, 97, 98, 99, 100, 101, 102, 103, 104,
350 105, 105, 106, 107, 107, 108, 108, 109, 109, 109,
351 110, 111, 112, 113, 113, 113, 113, 113, 113, 113,
352 113, 113, 113, 113, 113, 113, 114, 114, 115, 115
356 static yyconst int yy_ec[256] =
358 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
359 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
360 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
361 1, 2, 1, 4, 1, 5, 6, 1, 1, 1,
362 1, 1, 1, 1, 7, 8, 1, 9, 9, 9,
363 9, 9, 9, 9, 9, 9, 9, 10, 11, 1,
364 1, 1, 1, 1, 5, 5, 5, 5, 5, 5,
365 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
366 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
367 1, 1, 1, 1, 5, 1, 12, 13, 14, 15,
369 16, 17, 18, 19, 20, 5, 5, 21, 22, 23,
370 24, 25, 26, 27, 28, 29, 30, 31, 32, 5,
371 33, 5, 1, 1, 1, 1, 1, 1, 1, 1,
372 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
373 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
374 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
382 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
383 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388 static yyconst int yy_meta[34] =
390 1, 1, 2, 3, 4, 1, 5, 4, 4, 6,
391 1, 4, 4, 4, 4, 4, 4, 4, 4, 4,
392 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
396 static yyconst short int yy_base[205] =
398 0, 0, 396, 397, 397, 397, 0, 385, 27, 385,
399 29, 0, 25, 31, 32, 33, 38, 42, 35, 49,
400 50, 54, 46, 57, 63, 75, 65, 98, 58, 389,
401 382, 397, 0, 382, 381, 380, 68, 87, 0, 71,
402 80, 92, 89, 378, 93, 73, 96, 70, 102, 99,
403 105, 106, 113, 40, 114, 115, 121, 120, 124, 122,
404 126, 125, 127, 128, 129, 138, 139, 145, 377, 148,
405 149, 130, 154, 151, 157, 159, 397, 0, 377, 161,
406 375, 156, 162, 163, 171, 158, 173, 374, 175, 373,
407 176, 179, 180, 183, 185, 372, 187, 190, 191, 192,
409 371, 370, 369, 368, 367, 188, 208, 366, 198, 365,
410 200, 364, 201, 204, 205, 206, 209, 213, 218, 197,
411 223, 222, 363, 362, 361, 229, 230, 233, 224, 360,
412 234, 236, 237, 359, 358, 238, 240, 244, 247, 249,
413 250, 251, 257, 254, 357, 356, 259, 355, 261, 262,
414 354, 271, 353, 264, 272, 352, 351, 274, 275, 350,
415 282, 349, 348, 347, 346, 345, 344, 343, 342, 341,
416 267, 336, 331, 277, 326, 283, 319, 285, 284, 317,
417 315, 311, 310, 288, 291, 292, 293, 295, 298, 301,
418 299, 302, 303, 306, 308, 309, 307, 212, 397, 333,
423 static yyconst short int yy_def[205] =
425 199, 1, 199, 199, 199, 199, 200, 201, 202, 199,
426 201, 203, 201, 201, 201, 201, 201, 201, 201, 201,
427 201, 201, 201, 201, 201, 201, 201, 201, 201, 200,
428 201, 199, 204, 199, 199, 199, 201, 201, 203, 201,
429 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
430 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
431 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
432 201, 201, 201, 201, 201, 201, 199, 204, 199, 201,
433 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
434 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
436 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
437 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
438 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
439 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
440 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
441 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
442 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
443 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
444 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
445 201, 201, 201, 201, 201, 201, 201, 201, 0, 199,
450 static yyconst short int yy_nxt[431] =
452 4, 5, 6, 7, 8, 9, 10, 8, 11, 4,
453 12, 13, 14, 15, 16, 17, 18, 19, 8, 20,
454 21, 22, 23, 8, 24, 8, 25, 26, 27, 28,
455 29, 8, 8, 34, 32, 35, 37, 38, 32, 40,
456 32, 32, 32, 45, 32, 41, 42, 32, 46, 32,
457 53, 32, 47, 50, 43, 32, 48, 44, 32, 32,
458 49, 56, 51, 32, 95, 58, 32, 32, 52, 60,
459 54, 55, 32, 57, 32, 61, 80, 32, 62, 32,
460 32, 76, 32, 59, 32, 81, 87, 63, 69, 32,
461 64, 70, 78, 65, 37, 38, 32, 71, 32, 89,
463 82, 32, 32, 66, 67, 32, 68, 32, 32, 83,
464 72, 32, 84, 85, 32, 32, 90, 73, 74, 91,
465 86, 93, 32, 32, 32, 75, 88, 97, 92, 32,
466 32, 32, 98, 32, 32, 32, 32, 32, 32, 32,
467 100, 94, 96, 99, 101, 103, 104, 32, 32, 108,
468 102, 112, 109, 105, 32, 110, 107, 32, 32, 106,
469 32, 111, 116, 32, 113, 32, 32, 32, 32, 80,
470 32, 32, 32, 115, 118, 119, 117, 114, 120, 121,
471 32, 122, 32, 123, 32, 32, 125, 127, 32, 32,
472 129, 124, 32, 126, 32, 130, 32, 32, 131, 32,
474 32, 32, 133, 128, 134, 132, 32, 32, 135, 32,
475 32, 151, 136, 32, 32, 32, 137, 32, 32, 145,
476 146, 32, 32, 138, 142, 139, 143, 32, 140, 144,
477 141, 32, 32, 32, 147, 149, 152, 148, 32, 32,
478 154, 150, 32, 32, 153, 32, 32, 32, 156, 32,
479 155, 159, 157, 32, 158, 162, 32, 160, 32, 32,
480 32, 161, 164, 32, 166, 168, 32, 171, 32, 163,
481 32, 32, 170, 32, 172, 165, 32, 167, 173, 169,
482 32, 32, 175, 32, 32, 181, 32, 177, 174, 178,
483 176, 32, 32, 32, 32, 180, 179, 32, 183, 185,
485 32, 32, 32, 186, 32, 182, 184, 32, 32, 191,
486 32, 32, 32, 187, 188, 32, 32, 32, 32, 32,
487 32, 189, 195, 190, 32, 192, 32, 193, 32, 198,
488 194, 197, 196, 30, 30, 32, 30, 30, 30, 31,
489 32, 31, 33, 33, 39, 32, 39, 39, 39, 39,
490 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
491 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
492 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
493 32, 32, 32, 32, 32, 79, 32, 32, 36, 35,
494 79, 32, 77, 36, 32, 199, 3, 199, 199, 199,
496 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
497 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
498 199, 199, 199, 199, 199, 199, 199, 199, 199, 199
501 static yyconst short int yy_chk[431] =
503 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
504 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
505 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
506 1, 1, 1, 9, 13, 9, 11, 11, 11, 13,
507 14, 15, 16, 15, 19, 13, 14, 17, 16, 54,
508 19, 18, 16, 18, 14, 23, 16, 14, 20, 21,
509 17, 21, 18, 22, 54, 22, 24, 29, 18, 23,
510 20, 20, 25, 21, 27, 24, 37, 37, 25, 48,
511 40, 29, 46, 22, 26, 40, 46, 26, 27, 41,
512 26, 27, 204, 26, 38, 38, 38, 27, 43, 48,
514 41, 42, 45, 26, 26, 47, 26, 28, 50, 42,
515 28, 49, 43, 45, 51, 52, 49, 28, 28, 50,
516 45, 52, 53, 55, 56, 28, 47, 56, 51, 58,
517 57, 60, 57, 59, 62, 61, 63, 64, 65, 72,
518 58, 53, 55, 57, 59, 61, 62, 66, 67, 65,
519 60, 67, 65, 62, 68, 65, 64, 70, 71, 63,
520 74, 66, 72, 73, 68, 82, 75, 86, 76, 80,
521 80, 83, 84, 71, 74, 75, 73, 70, 76, 82,
522 85, 83, 87, 84, 89, 91, 86, 89, 92, 93,
523 92, 85, 94, 87, 95, 93, 97, 106, 94, 98,
525 99, 100, 97, 91, 98, 95, 120, 109, 99, 111,
526 113, 120, 100, 114, 115, 116, 106, 107, 117, 114,
527 115, 198, 118, 107, 109, 107, 111, 119, 107, 113,
528 107, 122, 121, 129, 116, 118, 121, 117, 126, 127,
529 126, 119, 128, 131, 122, 132, 133, 136, 128, 137,
530 127, 132, 129, 138, 131, 137, 139, 133, 140, 141,
531 142, 136, 139, 144, 140, 141, 143, 144, 147, 138,
532 149, 150, 143, 154, 147, 139, 171, 140, 149, 142,
533 152, 155, 152, 158, 159, 171, 174, 155, 150, 158,
534 154, 161, 176, 179, 178, 161, 159, 184, 176, 179,
536 185, 186, 187, 184, 188, 174, 178, 189, 191, 189,
537 190, 192, 193, 185, 186, 194, 197, 195, 196, 183,
538 182, 187, 193, 188, 181, 190, 180, 191, 177, 197,
539 192, 195, 194, 200, 200, 175, 200, 200, 200, 201,
540 173, 201, 202, 202, 203, 172, 203, 203, 203, 203,
541 170, 169, 168, 167, 166, 165, 164, 163, 162, 160,
542 157, 156, 153, 151, 148, 146, 145, 135, 134, 130,
543 125, 124, 123, 112, 110, 108, 105, 104, 103, 102,
544 101, 96, 90, 88, 81, 79, 69, 44, 36, 35,
545 34, 31, 30, 10, 8, 3, 199, 199, 199, 199,
547 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
548 199, 199, 199, 199, 199, 199, 199, 199, 199, 199,
549 199, 199, 199, 199, 199, 199, 199, 199, 199, 199
552 static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
553 static char *yy_full_match;
557 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
558 yy_cp = yy_full_match; /* restore poss. backed-over text */ \
562 #define yymore() yymore_used_but_not_detected
563 #define YY_MORE_ADJ 0
564 #define YY_RESTORE_YY_MORE_OFFSET
568 /*===-- Lexer.l - Scanner for llvm assembly files ----------------*- C++ -*--=//
570 // This file implements the flex scanner for LLVM assembly languages files.
572 //===------------------------------------------------------------------------=*/
573 #define YY_NEVER_INTERACTIVE 1
575 #include "ParserInternals.h"
576 #include "llvm/BasicBlock.h"
577 #include "llvm/Method.h"
578 #include "llvm/Module.h"
580 #include "llvmAsmParser.h"
582 #define RET_TOK(type, Enum, sym) \
583 llvmAsmlval.type = Instruction::Enum; return sym
586 // TODO: All of the static identifiers are figured out by the lexer,
587 // these should be hashed.
590 // atoull - Convert an ascii string of decimal digits into the unsigned long
591 // long representation... this does not have to do input error checking,
592 // because we know that the input will be matched by a suitable regex...
594 uint64_t atoull(const char *Buffer) {
596 for (; *Buffer; Buffer++) {
597 uint64_t OldRes = Result;
599 Result += *Buffer-'0';
600 if (Result < OldRes) { // Uh, oh, overflow detected!!!
601 ThrowException("constant bigger than 64 bits detected!");
608 #define YY_NEVER_INTERACTIVE 1
609 /* Comments start with a ; and go till end of line */
610 /* Variable(Value) identifiers start with a % sign */
611 /* Label identifiers end with a colon */
612 /* Quoted names can contain any character except " and \ */
613 /* [PN]Integer: match positive and negative literal integer values that
614 * are preceeded by a '%' character. These represent unnamed variable slots.
616 /* E[PN]Integer: match positive and negative literal integer values */
617 /* FPConstant - A Floating point constant.
618 TODO: Expand lexer to support 10e50 FP constant notation */
619 #line 620 "Lexer.cpp"
621 /* Macros after this point can all be overridden by user definitions in
625 #ifndef YY_SKIP_YYWRAP
627 extern "C" int yywrap YY_PROTO(( void ));
629 extern int yywrap YY_PROTO(( void ));
634 static inline void yyunput YY_PROTO(( int c, char *buf_ptr ));
638 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
641 #ifdef YY_NEED_STRLEN
642 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
647 static int yyinput YY_PROTO(( void ));
649 static int input YY_PROTO(( void ));
654 static int yy_start_stack_ptr = 0;
655 static int yy_start_stack_depth = 0;
656 static int *yy_start_stack = 0;
657 #ifndef YY_NO_PUSH_STATE
658 static void yy_push_state YY_PROTO(( int new_state ));
660 #ifndef YY_NO_POP_STATE
661 static void yy_pop_state YY_PROTO(( void ));
663 #ifndef YY_NO_TOP_STATE
664 static int yy_top_state YY_PROTO(( void ));
668 #define YY_NO_PUSH_STATE 1
669 #define YY_NO_POP_STATE 1
670 #define YY_NO_TOP_STATE 1
673 #ifdef YY_MALLOC_DECL
681 /* Just try to get by without declaring the routines. This will fail
682 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
683 * or sizeof(void*) != sizeof(int).
688 /* Amount of stuff to slurp up with each read. */
689 #ifndef YY_READ_BUF_SIZE
690 #define YY_READ_BUF_SIZE 8192
693 /* Copy whatever the last rule matched to the standard output. */
696 /* This used to be an fputs(), but since the string might contain NUL's,
697 * we now use fwrite().
699 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
702 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
703 * is returned in "result".
706 #define YY_INPUT(buf,result,max_size) \
707 if ( yy_current_buffer->yy_is_interactive ) \
710 for ( n = 0; n < max_size && \
711 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
714 buf[n++] = (char) c; \
715 if ( c == EOF && ferror( yyin ) ) \
716 YY_FATAL_ERROR( "input in flex scanner failed" ); \
719 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
720 && ferror( yyin ) ) \
721 YY_FATAL_ERROR( "input in flex scanner failed" );
724 /* No semi-colon after return; correct usage is to write "yyterminate();" -
725 * we don't want an extra ';' after the "return" because that will cause
726 * some compilers to complain about unreachable statements.
729 #define yyterminate() return YY_NULL
732 /* Number of entries by which start-condition stack grows. */
733 #ifndef YY_START_STACK_INCR
734 #define YY_START_STACK_INCR 25
737 /* Report a fatal error. */
738 #ifndef YY_FATAL_ERROR
739 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
742 /* Default declaration of generated scanner - a define so the user can
743 * easily add parameters.
746 #define YY_DECL int yylex YY_PROTO(( void ))
749 /* Code executed at the beginning of each rule, after yytext and yyleng
752 #ifndef YY_USER_ACTION
753 #define YY_USER_ACTION
756 /* Code executed at the end of each rule. */
758 #define YY_BREAK break;
761 #define YY_RULE_SETUP \
766 register yy_state_type yy_current_state;
767 register char *yy_cp, *yy_bp;
773 #line 774 "Lexer.cpp"
784 yy_start = 1; /* first start state */
792 if ( ! yy_current_buffer )
794 yy_create_buffer( yyin, YY_BUF_SIZE );
796 yy_load_buffer_state();
799 while ( 1 ) /* loops until end-of-file is reached */
803 /* Support of yytext. */
804 *yy_cp = yy_hold_char;
806 /* yy_bp points to the position in yy_ch_buf of the start of
811 yy_current_state = yy_start;
812 yy_state_ptr = yy_state_buf;
813 *yy_state_ptr++ = yy_current_state;
817 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
818 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
820 yy_current_state = (int) yy_def[yy_current_state];
821 if ( yy_current_state >= 200 )
822 yy_c = yy_meta[(unsigned int) yy_c];
824 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
825 *yy_state_ptr++ = yy_current_state;
828 while ( yy_current_state != 199 );
831 yy_current_state = *--yy_state_ptr;
832 yy_lp = yy_accept[yy_current_state];
833 for ( ; ; ) /* until we find what rule we matched */
835 if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
837 yy_act = yy_acclist[yy_lp];
839 yy_full_match = yy_cp;
844 yy_current_state = *--yy_state_ptr;
845 yy_lp = yy_accept[yy_current_state];
850 if ( yy_act != YY_END_OF_BUFFER )
853 for ( yyl = 0; yyl < yyleng; ++yyl )
854 if ( yytext[yyl] == '\n' )
858 do_action: /* This label is used only to access EOF actions. */
862 { /* beginning of action switch */
866 { /* Ignore comments for now */ }
896 { return IMPLEMENTATION; }
901 { llvmAsmlval.TypeVal = Type::VoidTy ; return VOID; }
906 { llvmAsmlval.TypeVal = Type::BoolTy ; return BOOL; }
911 { llvmAsmlval.TypeVal = Type::SByteTy ; return SBYTE; }
916 { llvmAsmlval.TypeVal = Type::UByteTy ; return UBYTE; }
921 { llvmAsmlval.TypeVal = Type::ShortTy ; return SHORT; }
926 { llvmAsmlval.TypeVal = Type::UShortTy; return USHORT; }
931 { llvmAsmlval.TypeVal = Type::IntTy ; return INT; }
936 { llvmAsmlval.TypeVal = Type::UIntTy ; return UINT; }
941 { llvmAsmlval.TypeVal = Type::LongTy ; return LONG; }
946 { llvmAsmlval.TypeVal = Type::ULongTy ; return ULONG; }
951 { llvmAsmlval.TypeVal = Type::FloatTy ; return FLOAT; }
956 { llvmAsmlval.TypeVal = Type::DoubleTy; return DOUBLE; }
961 { llvmAsmlval.TypeVal = Type::TypeTy ; return TYPE; }
966 { llvmAsmlval.TypeVal = Type::LabelTy ; return LABEL; }
971 { RET_TOK(UnaryOpVal, Not, NOT); }
976 { RET_TOK(BinaryOpVal, Add, ADD); }
981 { RET_TOK(BinaryOpVal, Sub, SUB); }
986 { RET_TOK(BinaryOpVal, Mul, MUL); }
991 { RET_TOK(BinaryOpVal, Div, DIV); }
996 { RET_TOK(BinaryOpVal, Rem, REM); }
1001 { RET_TOK(BinaryOpVal, SetNE, SETNE); }
1006 { RET_TOK(BinaryOpVal, SetEQ, SETEQ); }
1011 { RET_TOK(BinaryOpVal, SetLT, SETLT); }
1016 { RET_TOK(BinaryOpVal, SetGT, SETGT); }
1021 { RET_TOK(BinaryOpVal, SetLE, SETLE); }
1026 { RET_TOK(BinaryOpVal, SetGE, SETGE); }
1036 { RET_TOK(OtherOpVal, PHINode, PHI); }
1041 { RET_TOK(OtherOpVal, Call, CALL); }
1046 { RET_TOK(OtherOpVal, Cast, CAST); }
1051 { RET_TOK(OtherOpVal, Shl, SHL); }
1056 { RET_TOK(OtherOpVal, Shr, SHR); }
1061 { RET_TOK(TermOpVal, Ret, RET); }
1066 { RET_TOK(TermOpVal, Br, BR); }
1071 { RET_TOK(TermOpVal, Switch, SWITCH); }
1076 { RET_TOK(MemOpVal, Malloc, MALLOC); }
1081 { RET_TOK(MemOpVal, Alloca, ALLOCA); }
1086 { RET_TOK(MemOpVal, Free, FREE); }
1091 { RET_TOK(MemOpVal, Load, LOAD); }
1096 { RET_TOK(MemOpVal, Store, STORE); }
1101 { RET_TOK(MemOpVal, GetElementPtr, GETELEMENTPTR); }
1106 { llvmAsmlval.StrVal = strdup(yytext+1); return VAR_ID; }
1112 yytext[strlen(yytext)-1] = 0; // nuke colon
1113 llvmAsmlval.StrVal = strdup(yytext);
1121 yytext[strlen(yytext)-1] = 0; // nuke end quote
1122 llvmAsmlval.StrVal = strdup(yytext+1); // Nuke start quote
1123 return STRINGCONSTANT;
1129 { llvmAsmlval.UInt64Val = atoull(yytext); return EUINT64VAL; }
1135 uint64_t Val = atoull(yytext+1);
1136 // +1: we have bigger negative range
1137 if (Val > (uint64_t)INT64_MAX+1)
1138 ThrowException("Constant too large for signed 64 bits!");
1139 llvmAsmlval.SInt64Val = -Val;
1146 { llvmAsmlval.UIntVal = atoull(yytext+1); return UINTVAL; }
1152 uint64_t Val = atoull(yytext+2);
1153 // +1: we have bigger negative range
1154 if (Val > (uint64_t)INT32_MAX+1)
1155 ThrowException("Constant too large for signed 32 bits!");
1156 llvmAsmlval.SIntVal = -Val;
1163 { llvmAsmlval.FPVal = atof(yytext); return FPVAL; }
1168 { /* Ignore whitespace */ }
1173 { /*printf("'%s'", yytext);*/ return yytext[0]; }
1178 YY_FATAL_ERROR( "flex scanner jammed" );
1180 #line 1182 "Lexer.cpp"
1181 case YY_STATE_EOF(INITIAL):
1184 case YY_END_OF_BUFFER:
1186 /* Amount of text matched not including the EOB char. */
1187 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1189 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1190 *yy_cp = yy_hold_char;
1191 YY_RESTORE_YY_MORE_OFFSET
1193 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1195 /* We're scanning a new file or input source. It's
1196 * possible that this happened because the user
1197 * just pointed yyin at a new source and called
1198 * yylex(). If so, then we have to assure
1199 * consistency between yy_current_buffer and our
1200 * globals. Here is the right place to do so, because
1201 * this is the first action (other than possibly a
1202 * back-up) that will match for the new input source.
1204 yy_n_chars = yy_current_buffer->yy_n_chars;
1205 yy_current_buffer->yy_input_file = yyin;
1206 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1209 /* Note that here we test for yy_c_buf_p "<=" to the position
1210 * of the first EOB in the buffer, since yy_c_buf_p will
1211 * already have been incremented past the NUL character
1212 * (since all states make transitions on EOB to the
1213 * end-of-buffer state). Contrast this with the test
1216 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1217 { /* This was really a NUL. */
1218 yy_state_type yy_next_state;
1220 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1222 yy_current_state = yy_get_previous_state();
1224 /* Okay, we're now positioned to make the NUL
1225 * transition. We couldn't have
1226 * yy_get_previous_state() go ahead and do it
1227 * for us because it doesn't know how to deal
1228 * with the possibility of jamming (and we don't
1229 * want to build jamming into it because then it
1230 * will run more slowly).
1233 yy_next_state = yy_try_NUL_trans( yy_current_state );
1235 yy_bp = yytext_ptr + YY_MORE_ADJ;
1237 if ( yy_next_state )
1239 /* Consume the NUL. */
1240 yy_cp = ++yy_c_buf_p;
1241 yy_current_state = yy_next_state;
1248 goto yy_find_action;
1252 else switch ( yy_get_next_buffer() )
1254 case EOB_ACT_END_OF_FILE:
1256 yy_did_buffer_switch_on_eof = 0;
1260 /* Note: because we've taken care in
1261 * yy_get_next_buffer() to have set up
1262 * yytext, we can now set up
1263 * yy_c_buf_p so that if some total
1264 * hoser (like flex itself) wants to
1265 * call the scanner after we return the
1266 * YY_NULL, it'll still work - another
1267 * YY_NULL will get returned.
1269 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1271 yy_act = YY_STATE_EOF(YY_START);
1277 if ( ! yy_did_buffer_switch_on_eof )
1283 case EOB_ACT_CONTINUE_SCAN:
1285 yytext_ptr + yy_amount_of_matched_text;
1287 yy_current_state = yy_get_previous_state();
1290 yy_bp = yytext_ptr + YY_MORE_ADJ;
1293 case EOB_ACT_LAST_MATCH:
1295 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1297 yy_current_state = yy_get_previous_state();
1300 yy_bp = yytext_ptr + YY_MORE_ADJ;
1301 goto yy_find_action;
1308 "fatal flex scanner internal error--no action found" );
1309 } /* end of action switch */
1310 } /* end of scanning one token */
1311 } /* end of yylex */
1314 /* yy_get_next_buffer - try to read in a new buffer
1316 * Returns a code representing an action:
1317 * EOB_ACT_LAST_MATCH -
1318 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1319 * EOB_ACT_END_OF_FILE - end of file
1322 static int yy_get_next_buffer()
1324 register char *dest = yy_current_buffer->yy_ch_buf;
1325 register char *source = yytext_ptr;
1326 register int number_to_move, i;
1329 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1331 "fatal flex scanner internal error--end of buffer missed" );
1333 if ( yy_current_buffer->yy_fill_buffer == 0 )
1334 { /* Don't try to fill the buffer, so this is an EOF. */
1335 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1337 /* We matched a single character, the EOB, so
1338 * treat this as a final EOF.
1340 return EOB_ACT_END_OF_FILE;
1345 /* We matched some text prior to the EOB, first
1348 return EOB_ACT_LAST_MATCH;
1352 /* Try to read more data. */
1354 /* First move last chars to start of buffer. */
1355 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1357 for ( i = 0; i < number_to_move; ++i )
1358 *(dest++) = *(source++);
1360 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1361 /* don't do the read, it's not guaranteed to return an EOF,
1364 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1369 yy_current_buffer->yy_buf_size - number_to_move - 1;
1371 while ( num_to_read <= 0 )
1372 { /* Not enough room in the buffer - grow it. */
1373 #ifdef YY_USES_REJECT
1375 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1378 /* just a shorter name for the current buffer */
1379 YY_BUFFER_STATE b = yy_current_buffer;
1381 int yy_c_buf_p_offset =
1382 (int) (yy_c_buf_p - b->yy_ch_buf);
1384 if ( b->yy_is_our_buffer )
1386 int new_size = b->yy_buf_size * 2;
1388 if ( new_size <= 0 )
1389 b->yy_buf_size += b->yy_buf_size / 8;
1391 b->yy_buf_size *= 2;
1393 b->yy_ch_buf = (char *)
1394 /* Include room in for 2 EOB chars. */
1395 yy_flex_realloc( (void *) b->yy_ch_buf,
1396 b->yy_buf_size + 2 );
1399 /* Can't grow it, we don't own it. */
1402 if ( ! b->yy_ch_buf )
1404 "fatal error - scanner input buffer overflow" );
1406 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1408 num_to_read = yy_current_buffer->yy_buf_size -
1413 if ( num_to_read > YY_READ_BUF_SIZE )
1414 num_to_read = YY_READ_BUF_SIZE;
1416 /* Read in more data. */
1417 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1418 yy_n_chars, num_to_read );
1420 yy_current_buffer->yy_n_chars = yy_n_chars;
1423 if ( yy_n_chars == 0 )
1425 if ( number_to_move == YY_MORE_ADJ )
1427 ret_val = EOB_ACT_END_OF_FILE;
1433 ret_val = EOB_ACT_LAST_MATCH;
1434 yy_current_buffer->yy_buffer_status =
1435 YY_BUFFER_EOF_PENDING;
1440 ret_val = EOB_ACT_CONTINUE_SCAN;
1442 yy_n_chars += number_to_move;
1443 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1444 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1446 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1452 /* yy_get_previous_state - get the state just before the EOB char was reached */
1454 static yy_state_type yy_get_previous_state()
1456 register yy_state_type yy_current_state;
1457 register char *yy_cp;
1459 yy_current_state = yy_start;
1460 yy_state_ptr = yy_state_buf;
1461 *yy_state_ptr++ = yy_current_state;
1463 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1465 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1466 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1468 yy_current_state = (int) yy_def[yy_current_state];
1469 if ( yy_current_state >= 200 )
1470 yy_c = yy_meta[(unsigned int) yy_c];
1472 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1473 *yy_state_ptr++ = yy_current_state;
1476 return yy_current_state;
1480 /* yy_try_NUL_trans - try to make a transition on the NUL character
1483 * next_state = yy_try_NUL_trans( current_state );
1486 #ifdef YY_USE_PROTOS
1487 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1489 static yy_state_type yy_try_NUL_trans( yy_current_state )
1490 yy_state_type yy_current_state;
1493 register int yy_is_jam;
1495 register YY_CHAR yy_c = 1;
1496 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1498 yy_current_state = (int) yy_def[yy_current_state];
1499 if ( yy_current_state >= 200 )
1500 yy_c = yy_meta[(unsigned int) yy_c];
1502 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1503 yy_is_jam = (yy_current_state == 199);
1505 *yy_state_ptr++ = yy_current_state;
1507 return yy_is_jam ? 0 : yy_current_state;
1512 #ifdef YY_USE_PROTOS
1513 static inline void yyunput( int c, register char *yy_bp )
1515 static inline void yyunput( c, yy_bp )
1517 register char *yy_bp;
1520 register char *yy_cp = yy_c_buf_p;
1522 /* undo effects of setting up yytext */
1523 *yy_cp = yy_hold_char;
1525 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1526 { /* need to shift things up to make room */
1527 /* +2 for EOB chars. */
1528 register int number_to_move = yy_n_chars + 2;
1529 register char *dest = &yy_current_buffer->yy_ch_buf[
1530 yy_current_buffer->yy_buf_size + 2];
1531 register char *source =
1532 &yy_current_buffer->yy_ch_buf[number_to_move];
1534 while ( source > yy_current_buffer->yy_ch_buf )
1535 *--dest = *--source;
1537 yy_cp += (int) (dest - source);
1538 yy_bp += (int) (dest - source);
1539 yy_current_buffer->yy_n_chars =
1540 yy_n_chars = yy_current_buffer->yy_buf_size;
1542 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1543 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1546 *--yy_cp = (char) c;
1552 yy_hold_char = *yy_cp;
1555 #endif /* ifndef YY_NO_UNPUT */
1559 static int yyinput()
1566 *yy_c_buf_p = yy_hold_char;
1568 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1570 /* yy_c_buf_p now points to the character we want to return.
1571 * If this occurs *before* the EOB characters, then it's a
1572 * valid NUL; if not, then we've hit the end of the buffer.
1574 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1575 /* This was really a NUL. */
1579 { /* need more input */
1580 int offset = yy_c_buf_p - yytext_ptr;
1583 switch ( yy_get_next_buffer() )
1585 case EOB_ACT_LAST_MATCH:
1586 /* This happens because yy_g_n_b()
1587 * sees that we've accumulated a
1588 * token and flags that we need to
1589 * try matching the token before
1590 * proceeding. But for input(),
1591 * there's no matching to consider.
1592 * So convert the EOB_ACT_LAST_MATCH
1593 * to EOB_ACT_END_OF_FILE.
1596 /* Reset buffer status. */
1601 case EOB_ACT_END_OF_FILE:
1606 if ( ! yy_did_buffer_switch_on_eof )
1615 case EOB_ACT_CONTINUE_SCAN:
1616 yy_c_buf_p = yytext_ptr + offset;
1622 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1623 *yy_c_buf_p = '\0'; /* preserve yytext */
1624 yy_hold_char = *++yy_c_buf_p;
1633 #ifdef YY_USE_PROTOS
1634 void yyrestart( FILE *input_file )
1636 void yyrestart( input_file )
1640 if ( ! yy_current_buffer )
1641 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1643 yy_init_buffer( yy_current_buffer, input_file );
1644 yy_load_buffer_state();
1648 #ifdef YY_USE_PROTOS
1649 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1651 void yy_switch_to_buffer( new_buffer )
1652 YY_BUFFER_STATE new_buffer;
1655 if ( yy_current_buffer == new_buffer )
1658 if ( yy_current_buffer )
1660 /* Flush out information for old buffer. */
1661 *yy_c_buf_p = yy_hold_char;
1662 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1663 yy_current_buffer->yy_n_chars = yy_n_chars;
1666 yy_current_buffer = new_buffer;
1667 yy_load_buffer_state();
1669 /* We don't actually know whether we did this switch during
1670 * EOF (yywrap()) processing, but the only time this flag
1671 * is looked at is after yywrap() is called, so it's safe
1672 * to go ahead and always set it.
1674 yy_did_buffer_switch_on_eof = 1;
1678 #ifdef YY_USE_PROTOS
1679 void yy_load_buffer_state( void )
1681 void yy_load_buffer_state()
1684 yy_n_chars = yy_current_buffer->yy_n_chars;
1685 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1686 yyin = yy_current_buffer->yy_input_file;
1687 yy_hold_char = *yy_c_buf_p;
1691 #ifdef YY_USE_PROTOS
1692 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1694 YY_BUFFER_STATE yy_create_buffer( file, size )
1701 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1703 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1705 b->yy_buf_size = size;
1707 /* yy_ch_buf has to be 2 characters longer than the size given because
1708 * we need to put in 2 end-of-buffer characters.
1710 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1711 if ( ! b->yy_ch_buf )
1712 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1714 b->yy_is_our_buffer = 1;
1716 yy_init_buffer( b, file );
1722 #ifdef YY_USE_PROTOS
1723 void yy_delete_buffer( YY_BUFFER_STATE b )
1725 void yy_delete_buffer( b )
1732 if ( b == yy_current_buffer )
1733 yy_current_buffer = (YY_BUFFER_STATE) 0;
1735 if ( b->yy_is_our_buffer )
1736 yy_flex_free( (void *) b->yy_ch_buf );
1738 yy_flex_free( (void *) b );
1742 #ifndef YY_ALWAYS_INTERACTIVE
1743 #ifndef YY_NEVER_INTERACTIVE
1744 extern int isatty YY_PROTO(( int ));
1748 #ifdef YY_USE_PROTOS
1749 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1751 void yy_init_buffer( b, file )
1758 yy_flush_buffer( b );
1760 b->yy_input_file = file;
1761 b->yy_fill_buffer = 1;
1763 #if YY_ALWAYS_INTERACTIVE
1764 b->yy_is_interactive = 1;
1766 #if YY_NEVER_INTERACTIVE
1767 b->yy_is_interactive = 0;
1769 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1775 #ifdef YY_USE_PROTOS
1776 void yy_flush_buffer( YY_BUFFER_STATE b )
1778 void yy_flush_buffer( b )
1788 /* We always need two end-of-buffer characters. The first causes
1789 * a transition to the end-of-buffer state. The second causes
1790 * a jam in that state.
1792 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1793 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1795 b->yy_buf_pos = &b->yy_ch_buf[0];
1798 b->yy_buffer_status = YY_BUFFER_NEW;
1800 if ( b == yy_current_buffer )
1801 yy_load_buffer_state();
1805 #ifndef YY_NO_SCAN_BUFFER
1806 #ifdef YY_USE_PROTOS
1807 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1809 YY_BUFFER_STATE yy_scan_buffer( base, size )
1817 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1818 base[size-1] != YY_END_OF_BUFFER_CHAR )
1819 /* They forgot to leave room for the EOB's. */
1822 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1824 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1826 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1827 b->yy_buf_pos = b->yy_ch_buf = base;
1828 b->yy_is_our_buffer = 0;
1829 b->yy_input_file = 0;
1830 b->yy_n_chars = b->yy_buf_size;
1831 b->yy_is_interactive = 0;
1833 b->yy_fill_buffer = 0;
1834 b->yy_buffer_status = YY_BUFFER_NEW;
1836 yy_switch_to_buffer( b );
1843 #ifndef YY_NO_SCAN_STRING
1844 #ifdef YY_USE_PROTOS
1845 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1847 YY_BUFFER_STATE yy_scan_string( yy_str )
1848 yyconst char *yy_str;
1852 for ( len = 0; yy_str[len]; ++len )
1855 return yy_scan_bytes( yy_str, len );
1860 #ifndef YY_NO_SCAN_BYTES
1861 #ifdef YY_USE_PROTOS
1862 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1864 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1865 yyconst char *bytes;
1874 /* Get memory for full buffer, including space for trailing EOB's. */
1876 buf = (char *) yy_flex_alloc( n );
1878 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1880 for ( i = 0; i < len; ++i )
1883 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1885 b = yy_scan_buffer( buf, n );
1887 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1889 /* It's okay to grow etc. this buffer, and we should throw it
1890 * away when we're done.
1892 b->yy_is_our_buffer = 1;
1899 #ifndef YY_NO_PUSH_STATE
1900 #ifdef YY_USE_PROTOS
1901 static void yy_push_state( int new_state )
1903 static void yy_push_state( new_state )
1907 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1911 yy_start_stack_depth += YY_START_STACK_INCR;
1912 new_size = yy_start_stack_depth * sizeof( int );
1914 if ( ! yy_start_stack )
1915 yy_start_stack = (int *) yy_flex_alloc( new_size );
1918 yy_start_stack = (int *) yy_flex_realloc(
1919 (void *) yy_start_stack, new_size );
1921 if ( ! yy_start_stack )
1923 "out of memory expanding start-condition stack" );
1926 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1933 #ifndef YY_NO_POP_STATE
1934 static void yy_pop_state()
1936 if ( --yy_start_stack_ptr < 0 )
1937 YY_FATAL_ERROR( "start-condition stack underflow" );
1939 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1944 #ifndef YY_NO_TOP_STATE
1945 static int yy_top_state()
1947 return yy_start_stack[yy_start_stack_ptr - 1];
1951 #ifndef YY_EXIT_FAILURE
1952 #define YY_EXIT_FAILURE 2
1955 #ifdef YY_USE_PROTOS
1956 static void yy_fatal_error( yyconst char msg[] )
1958 static void yy_fatal_error( msg )
1962 (void) fprintf( stderr, "%s\n", msg );
1963 exit( YY_EXIT_FAILURE );
1968 /* Redefine yyless() so it works in section 3 code. */
1974 /* Undo effects of setting up yytext. */ \
1975 yytext[yyleng] = yy_hold_char; \
1976 yy_c_buf_p = yytext + n; \
1977 yy_hold_char = *yy_c_buf_p; \
1978 *yy_c_buf_p = '\0'; \
1984 /* Internal utility routines. */
1987 #ifdef YY_USE_PROTOS
1988 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1990 static void yy_flex_strncpy( s1, s2, n )
1997 for ( i = 0; i < n; ++i )
2002 #ifdef YY_NEED_STRLEN
2003 #ifdef YY_USE_PROTOS
2004 static int yy_flex_strlen( yyconst char *s )
2006 static int yy_flex_strlen( s )
2011 for ( n = 0; s[n]; ++n )
2019 #ifdef YY_USE_PROTOS
2020 static void *yy_flex_alloc( yy_size_t size )
2022 static void *yy_flex_alloc( size )
2026 return (void *) malloc( size );
2029 #ifdef YY_USE_PROTOS
2030 static inline void *yy_flex_realloc( void *ptr, yy_size_t size )
2032 static inline void *yy_flex_realloc( ptr, size )
2037 /* The cast to (char *) in the following accommodates both
2038 * implementations that use char* generic pointers, and those
2039 * that use void* generic pointers. It works with the latter
2040 * because both ANSI C and C++ allow castless assignment from
2041 * any pointer type to void*, and deal with argument conversions
2042 * as though doing an assignment.
2044 return (void *) realloc( (char *) ptr, size );
2047 #ifdef YY_USE_PROTOS
2048 static void yy_flex_free( void *ptr )
2050 static void yy_flex_free( ptr )