blob: 700486db9b3fecc67217278ab8aa14e580f88ad2 [file] [log] [blame]
Reid Spencer68a24bd2005-08-27 18:50:39 +00001#define yy_create_buffer File_create_buffer
2#define yy_delete_buffer File_delete_buffer
3#define yy_scan_buffer File_scan_buffer
4#define yy_scan_string File_scan_string
5#define yy_scan_bytes File_scan_bytes
6#define yy_flex_debug File_flex_debug
7#define yy_init_buffer File_init_buffer
8#define yy_flush_buffer File_flush_buffer
9#define yy_load_buffer_state File_load_buffer_state
10#define yy_switch_to_buffer File_switch_to_buffer
11#define yyin Filein
12#define yyleng Fileleng
13#define yylex Filelex
14#define yyout Fileout
15#define yyrestart Filerestart
16#define yytext Filetext
17#define yylineno Filelineno
18#define yywrap Filewrap
19
20#line 21 "Lexer.cpp"
21/* A lexical scanner generated by flex */
22
23/* Scanner skeleton version:
24 * $Header$
25 */
26
27#define FLEX_SCANNER
28#define YY_FLEX_MAJOR_VERSION 2
29#define YY_FLEX_MINOR_VERSION 5
30
31#include <stdio.h>
32#include <unistd.h>
33
34
35/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
36#ifdef c_plusplus
37#ifndef __cplusplus
38#define __cplusplus
39#endif
40#endif
41
42
43#ifdef __cplusplus
44
45#include <stdlib.h>
46
47/* Use prototypes in function declarations. */
48#define YY_USE_PROTOS
49
50/* The "const" storage-class-modifier is valid. */
51#define YY_USE_CONST
52
53#else /* ! __cplusplus */
54
55#if __STDC__
56
57#define YY_USE_PROTOS
58#define YY_USE_CONST
59
60#endif /* __STDC__ */
61#endif /* ! __cplusplus */
62
63#ifdef __TURBOC__
64 #pragma warn -rch
65 #pragma warn -use
66#include <io.h>
67#include <stdlib.h>
68#define YY_USE_CONST
69#define YY_USE_PROTOS
70#endif
71
72#ifdef YY_USE_CONST
73#define yyconst const
74#else
75#define yyconst
76#endif
77
78
79#ifdef YY_USE_PROTOS
80#define YY_PROTO(proto) proto
81#else
82#define YY_PROTO(proto) ()
83#endif
84
85/* Returned upon end-of-file. */
86#define YY_NULL 0
87
88/* Promotes a possibly negative, possibly signed char to an unsigned
89 * integer for use as an array index. If the signed char is negative,
90 * we want to instead treat it as an 8-bit unsigned char, hence the
91 * double cast.
92 */
93#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
94
95/* Enter a start condition. This macro really ought to take a parameter,
96 * but we do it the disgusting crufty way forced on us by the ()-less
97 * definition of BEGIN.
98 */
99#define BEGIN yy_start = 1 + 2 *
100
101/* Translate the current start state into a value that can be later handed
102 * to BEGIN to return to the state. The YYSTATE alias is for lex
103 * compatibility.
104 */
105#define YY_START ((yy_start - 1) / 2)
106#define YYSTATE YY_START
107
108/* Action number for EOF rule of a given start state. */
109#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
110
111/* Special action meaning "start processing a new file". */
112#define YY_NEW_FILE yyrestart( yyin )
113
114#define YY_END_OF_BUFFER_CHAR 0
115
116/* Size of default input buffer. */
117#define YY_BUF_SIZE (16384*64)
118
119typedef struct yy_buffer_state *YY_BUFFER_STATE;
120
121extern int yyleng;
122extern FILE *yyin, *yyout;
123
124#define EOB_ACT_CONTINUE_SCAN 0
125#define EOB_ACT_END_OF_FILE 1
126#define EOB_ACT_LAST_MATCH 2
127
128/* The funky do-while in the following #define is used to turn the definition
129 * int a single C statement (which needs a semi-colon terminator). This
130 * avoids problems with code like:
131 *
132 * if ( condition_holds )
133 * yyless( 5 );
134 * else
135 * do_something_else();
136 *
137 * Prior to using the do-while the compiler would get upset at the
138 * "else" because it interpreted the "if" statement as being all
139 * done when it reached the ';' after the yyless() call.
140 */
141
142/* Return all but the first 'n' matched characters back to the input stream. */
143
144#define yyless(n) \
145 do \
146 { \
147 /* Undo effects of setting up yytext. */ \
148 *yy_cp = yy_hold_char; \
149 YY_RESTORE_YY_MORE_OFFSET \
150 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
151 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
152 } \
153 while ( 0 )
154
155#define unput(c) yyunput( c, yytext_ptr )
156
157/* The following is because we cannot portably get our hands on size_t
158 * (without autoconf's help, which isn't available because we want
159 * flex-generated scanners to compile on their own).
160 */
161typedef unsigned int yy_size_t;
162
163
164struct yy_buffer_state
165 {
166 FILE *yy_input_file;
167
168 char *yy_ch_buf; /* input buffer */
169 char *yy_buf_pos; /* current position in input buffer */
170
171 /* Size of input buffer in bytes, not including room for EOB
172 * characters.
173 */
174 yy_size_t yy_buf_size;
175
176 /* Number of characters read into yy_ch_buf, not including EOB
177 * characters.
178 */
179 int yy_n_chars;
180
181 /* Whether we "own" the buffer - i.e., we know we created it,
182 * and can realloc() it to grow it, and should free() it to
183 * delete it.
184 */
185 int yy_is_our_buffer;
186
187 /* Whether this is an "interactive" input source; if so, and
188 * if we're using stdio for input, then we want to use getc()
189 * instead of fread(), to make sure we stop fetching input after
190 * each newline.
191 */
192 int yy_is_interactive;
193
194 /* Whether we're considered to be at the beginning of a line.
195 * If so, '^' rules will be active on the next match, otherwise
196 * not.
197 */
198 int yy_at_bol;
199
200 /* Whether to try to fill the input buffer when we reach the
201 * end of it.
202 */
203 int yy_fill_buffer;
204
205 int yy_buffer_status;
206#define YY_BUFFER_NEW 0
207#define YY_BUFFER_NORMAL 1
208 /* When an EOF's been seen but there's still some text to process
209 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
210 * shouldn't try reading from the input source any more. We might
211 * still have a bunch of tokens to match, though, because of
212 * possible backing-up.
213 *
214 * When we actually see the EOF, we change the status to "new"
215 * (via yyrestart()), so that the user can continue scanning by
216 * just pointing yyin at a new input file.
217 */
218#define YY_BUFFER_EOF_PENDING 2
219 };
220
221static YY_BUFFER_STATE yy_current_buffer = 0;
222
223/* We provide macros for accessing buffer states in case in the
224 * future we want to put the buffer states in a more general
225 * "scanner state".
226 */
227#define YY_CURRENT_BUFFER yy_current_buffer
228
229
230/* yy_hold_char holds the character lost when yytext is formed. */
231static char yy_hold_char;
232
233static int yy_n_chars; /* number of characters read into yy_ch_buf */
234
235
236int yyleng;
237
238/* Points to current character in buffer. */
239static char *yy_c_buf_p = (char *) 0;
240static int yy_init = 1; /* whether we need to initialize */
241static int yy_start = 0; /* start state number */
242
243/* Flag which is used to allow yywrap()'s to do buffer switches
244 * instead of setting up a fresh yyin. A bit of a hack ...
245 */
246static int yy_did_buffer_switch_on_eof;
247
248void yyrestart YY_PROTO(( FILE *input_file ));
249
250void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
251void yy_load_buffer_state YY_PROTO(( void ));
252YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
253void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
254void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
255void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
256#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
257
258YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
259YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
260YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
261
262static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
263static inline void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
264static void yy_flex_free YY_PROTO(( void * ));
265
266#define yy_new_buffer yy_create_buffer
267
268#define yy_set_interactive(is_interactive) \
269 { \
270 if ( ! yy_current_buffer ) \
271 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
272 yy_current_buffer->yy_is_interactive = is_interactive; \
273 }
274
275#define yy_set_bol(at_bol) \
276 { \
277 if ( ! yy_current_buffer ) \
278 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
279 yy_current_buffer->yy_at_bol = at_bol; \
280 }
281
282#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
283
284
285#define YY_USES_REJECT
286typedef unsigned char YY_CHAR;
287FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
288typedef int yy_state_type;
289extern int yylineno;
290int yylineno = 1;
291extern char *yytext;
292#define yytext_ptr yytext
293
294static yy_state_type yy_get_previous_state YY_PROTO(( void ));
295static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
296static int yy_get_next_buffer YY_PROTO(( void ));
297static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
298
299/* Done after the current pattern has been matched and before the
300 * corresponding action - sets up yytext.
301 */
302#define YY_DO_BEFORE_ACTION \
303 yytext_ptr = yy_bp; \
304 yyleng = (int) (yy_cp - yy_bp); \
305 yy_hold_char = *yy_cp; \
306 *yy_cp = '\0'; \
307 yy_c_buf_p = yy_cp;
308
309#define YY_NUM_RULES 31
310#define YY_END_OF_BUFFER 32
311static yyconst short int yy_acclist[129] =
312 { 0,
313 25, 25, 32, 30, 31, 23, 30, 31, 23, 31,
314 30, 31, 30, 31, 30, 31, 30, 31, 30, 31,
315 22, 30, 31, 22, 30, 31, 19, 30, 31, 30,
316 31, 19, 30, 31, 19, 30, 31, 19, 30, 31,
317 19, 30, 31, 19, 30, 31, 19, 30, 31, 19,
318 30, 31, 25, 31, 26, 31, 28, 31, 23, 21,
319 20, 22, 24, 1, 19, 19, 19, 19, 19, 19,
320 19, 15, 19, 19, 19, 19, 25, 26, 26, 29,
321 28, 27, 28, 20, 1, 22, 22, 5, 19, 19,
322 19, 10, 19, 12, 19, 19, 19, 4, 19, 14,
323
324 19, 19, 19, 18, 16, 17, 3, 6, 19, 19,
325 9, 19, 19, 19, 8, 19, 19, 11, 19, 13,
326 19, 19, 19, 19, 7, 19, 19, 2
327 } ;
328
329static yyconst short int yy_accept[101] =
330 { 0,
331 1, 1, 1, 2, 3, 4, 6, 9, 11, 13,
332 15, 17, 19, 21, 24, 27, 30, 32, 35, 38,
333 41, 44, 47, 50, 53, 55, 57, 59, 60, 60,
334 60, 61, 62, 63, 64, 65, 65, 65, 66, 66,
335 67, 68, 69, 70, 71, 72, 74, 75, 76, 77,
336 78, 79, 80, 81, 82, 83, 84, 84, 84, 85,
337 86, 87, 88, 88, 88, 90, 91, 92, 94, 96,
338 97, 98, 100, 102, 103, 104, 105, 106, 107, 107,
339 108, 110, 111, 113, 114, 115, 117, 118, 120, 122,
340 123, 124, 125, 127, 128, 128, 128, 128, 129, 129
341
342 } ;
343
344static yyconst int yy_ec[256] =
345 { 0,
346 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
347 1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 2, 5, 6, 1, 7, 1, 1, 1, 1,
350 1, 8, 9, 1, 9, 1, 10, 11, 12, 13,
351 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
352 1, 1, 1, 1, 14, 14, 14, 14, 14, 14,
353 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
354 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
355 16, 1, 17, 1, 15, 1, 18, 19, 20, 21,
356
357 22, 23, 24, 25, 26, 15, 15, 27, 15, 28,
358 29, 15, 15, 30, 31, 32, 33, 15, 15, 34,
359 15, 15, 35, 1, 36, 1, 1, 1, 1, 1,
360 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
361 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
362 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
363 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
364 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
365 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
366 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
367
368 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
369 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
370 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
371 1, 1, 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
374 } ;
375
376static yyconst int yy_meta[37] =
377 { 0,
378 1, 1, 2, 1, 1, 1, 1, 3, 1, 3,
379 4, 4, 4, 5, 6, 1, 1, 5, 5, 5,
380 5, 5, 5, 6, 6, 6, 6, 6, 6, 6,
381 6, 6, 6, 6, 1, 1
382 } ;
383
384static yyconst short int yy_base[113] =
385 { 0,
386 0, 0, 29, 30, 198, 199, 39, 42, 166, 190,
387 0, 36, 42, 42, 45, 0, 160, 168, 33, 41,
388 167, 164, 42, 159, 0, 57, 61, 70, 45, 184,
389 199, 0, 66, 199, 0, 69, 0, 0, 153, 156,
390 169, 165, 161, 161, 161, 62, 150, 150, 150, 0,
391 75, 76, 199, 171, 199, 79, 151, 70, 0, 0,
392 79, 0, 141, 159, 144, 143, 151, 0, 0, 145,
393 144, 0, 0, 138, 143, 199, 199, 199, 132, 199,
394 0, 136, 0, 145, 132, 0, 136, 0, 0, 118,
395 95, 76, 0, 90, 93, 60, 45, 199, 199, 99,
396
397 105, 107, 110, 116, 122, 128, 131, 137, 140, 145,
398 151, 157
399 } ;
400
401static yyconst short int yy_def[113] =
402 { 0,
403 99, 1, 100, 100, 99, 99, 99, 99, 99, 101,
404 102, 99, 99, 99, 99, 103, 99, 103, 103, 103,
405 103, 103, 103, 103, 104, 105, 106, 99, 99, 101,
406 99, 107, 99, 99, 108, 99, 109, 103, 110, 103,
407 103, 103, 103, 103, 103, 103, 103, 103, 103, 104,
408 105, 105, 99, 106, 99, 106, 99, 99, 107, 108,
409 99, 109, 110, 111, 103, 103, 103, 103, 103, 103,
410 103, 103, 103, 103, 103, 99, 99, 99, 110, 99,
411 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
412 103, 103, 103, 103, 99, 112, 112, 99, 0, 99,
413
414 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
415 99, 99
416 } ;
417
418static yyconst short int yy_nxt[236] =
419 { 0,
420 6, 7, 8, 7, 9, 10, 11, 6, 12, 13,
421 14, 15, 15, 16, 16, 17, 6, 16, 18, 19,
422 20, 16, 21, 16, 16, 22, 23, 16, 16, 16,
423 24, 16, 16, 16, 6, 6, 26, 26, 27, 27,
424 28, 28, 28, 28, 28, 28, 33, 33, 33, 34,
425 98, 35, 33, 33, 33, 33, 33, 33, 43, 41,
426 36, 42, 44, 47, 52, 98, 53, 48, 55, 57,
427 56, 28, 28, 28, 58, 37, 33, 33, 33, 61,
428 61, 71, 99, 52, 99, 53, 99, 77, 56, 61,
429 61, 95, 95, 72, 95, 95, 78, 94, 96, 25,
430
431 25, 25, 25, 25, 25, 30, 30, 30, 30, 30,
432 30, 32, 32, 38, 38, 38, 50, 50, 93, 50,
433 50, 50, 51, 51, 51, 51, 51, 51, 54, 54,
434 54, 54, 54, 54, 59, 59, 59, 60, 92, 60,
435 60, 60, 60, 62, 62, 63, 63, 63, 63, 63,
436 63, 79, 79, 79, 79, 79, 79, 97, 97, 97,
437 97, 97, 97, 91, 90, 89, 88, 64, 87, 86,
438 85, 84, 83, 82, 81, 80, 64, 76, 99, 75,
439 74, 73, 70, 69, 68, 67, 66, 65, 64, 31,
440 49, 46, 45, 40, 39, 31, 29, 99, 5, 99,
441
442 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
443 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
444 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
445 99, 99, 99, 99, 99
446 } ;
447
448static yyconst short int yy_chk[236] =
449 { 0,
450 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
451 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
452 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
453 1, 1, 1, 1, 1, 1, 3, 4, 3, 4,
454 7, 7, 7, 8, 8, 8, 12, 12, 12, 13,
455 97, 13, 14, 14, 14, 15, 15, 15, 20, 19,
456 14, 19, 20, 23, 26, 96, 26, 23, 27, 29,
457 27, 28, 28, 28, 29, 14, 33, 33, 33, 36,
458 36, 46, 51, 52, 51, 52, 56, 58, 56, 61,
459 61, 94, 94, 46, 95, 95, 58, 92, 95, 100,
460
461 100, 100, 100, 100, 100, 101, 101, 101, 101, 101,
462 101, 102, 102, 103, 103, 103, 104, 104, 91, 104,
463 104, 104, 105, 105, 105, 105, 105, 105, 106, 106,
464 106, 106, 106, 106, 107, 107, 107, 108, 90, 108,
465 108, 108, 108, 109, 109, 110, 110, 110, 110, 110,
466 110, 111, 111, 111, 111, 111, 111, 112, 112, 112,
467 112, 112, 112, 87, 85, 84, 82, 79, 75, 74,
468 71, 70, 67, 66, 65, 64, 63, 57, 54, 49,
469 48, 47, 45, 44, 43, 42, 41, 40, 39, 30,
470 24, 22, 21, 18, 17, 10, 9, 5, 99, 99,
471
472 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
473 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
474 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
475 99, 99, 99, 99, 99
476 } ;
477
478static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr;
479static char *yy_full_match;
480static int yy_lp;
481#define REJECT \
482{ \
483*yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \
484yy_cp = yy_full_match; /* restore poss. backed-over text */ \
485++yy_lp; \
486goto find_rule; \
487}
488#define yymore() yymore_used_but_not_detected
489#define YY_MORE_ADJ 0
490#define YY_RESTORE_YY_MORE_OFFSET
491char *yytext;
492#line 1 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
493#define INITIAL 0
494/*===-- FileLexer.l - Scanner for TableGen Files ----------------*- C++ -*-===//
495//
496// The LLVM Compiler Infrastructure
497//
498// This file was developed by the LLVM research group and is distributed under
499// the University of Illinois Open Source License. See LICENSE.TXT for details.
500//
501//===----------------------------------------------------------------------===//
502//
503// This file defines a simple flex scanner for TableGen files. This is pretty
504// straight-forward, except for the magic to handle file inclusion.
505//
506//===----------------------------------------------------------------------===*/
507#define YY_NEVER_INTERACTIVE 1
508#define comment 1
509
510#line 30 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
511#include "Record.h"
512typedef std::pair<llvm::Record*, std::vector<llvm::Init*>*> SubClassRefTy;
513#include "FileParser.h"
514
515int Fileparse();
516
517namespace llvm {
518
519// Global variable recording the location of the include directory
520std::string IncludeDirectory;
521
522/// ParseInt - This has to handle the special case of binary numbers 0b0101
523///
524static int ParseInt(const char *Str) {
525 if (Str[0] == '0' && Str[1] == 'b')
526 return strtol(Str+2, 0, 2);
527 return strtol(Str, 0, 0);
528}
529
530static int CommentDepth = 0;
531
532struct IncludeRec {
533 std::string Filename;
534 FILE *File;
535 unsigned LineNo;
536 YY_BUFFER_STATE Buffer;
537
538 IncludeRec(const std::string &FN, FILE *F)
539 : Filename(FN), File(F), LineNo(0){
540 }
541};
542
543static std::vector<IncludeRec> IncludeStack;
544
545std::ostream &err() {
546 if (IncludeStack.empty())
547 return std::cerr << "At end of input: ";
548
549 for (unsigned i = 0, e = IncludeStack.size()-1; i != e; ++i)
550 std::cerr << "Included from " << IncludeStack[i].Filename << ":"
551 << IncludeStack[i].LineNo << ":\n";
552 return std::cerr << "Parsing " << IncludeStack.back().Filename << ":"
553 << Filelineno << ": ";
554}
555
556/// ParseFile - this function begins the parsing of the specified tablegen file.
557///
558void ParseFile(const std::string &Filename, const std::string & IncludeDir) {
559 FILE *F = stdin;
560 if (Filename != "-") {
561 F = fopen(Filename.c_str(), "r");
562
563 if (F == 0) {
564 std::cerr << "Could not open input file '" + Filename + "'!\n";
565 exit (1);
566 }
567 IncludeStack.push_back(IncludeRec(Filename, F));
568 } else {
569 IncludeStack.push_back(IncludeRec("<stdin>", stdin));
570 }
571
572 // Record the location of the include directory so that the lexer can find
573 // it later.
574 IncludeDirectory = IncludeDir;
575
576 Filein = F;
577 Filelineno = 1;
578 Fileparse();
579 Filein = stdin;
580}
581
582/// HandleInclude - This function is called when an include directive is
583/// encountered in the input stream...
584///
585static void HandleInclude(const char *Buffer) {
586 unsigned Length = yyleng;
587 assert(Buffer[Length-1] == '"');
588 Buffer += strlen("include ");
589 Length -= strlen("include ");
590 while (*Buffer != '"') {
591 ++Buffer;
592 --Length;
593 }
594 assert(Length >= 2 && "Double quotes not found?");
595 std::string Filename(Buffer+1, Buffer+Length-1);
596 //std::cerr << "Filename = '" << Filename << "'\n";
597
598 // Save the line number and lex buffer of the includer...
599 IncludeStack.back().LineNo = Filelineno;
600 IncludeStack.back().Buffer = YY_CURRENT_BUFFER;
601
602 // Open the new input file...
603 yyin = fopen(Filename.c_str(), "r");
604 if (yyin == 0) {
605 // If we couldn't find the file in the current directory, look for it in
606 // the include directories.
607 //
608 // NOTE: Right now, there is only one directory. We need to eventually add
609 // support for more.
610 std::string NextFilename = IncludeDirectory + "/" + Filename;
611 yyin = fopen(NextFilename.c_str(), "r");
612 if (yyin == 0) {
613 err() << "Could not find include file '" << Filename << "'!\n";
614 exit(1);
615 }
616 Filename = NextFilename;
617 }
618
619 // Add the file to our include stack...
620 IncludeStack.push_back(IncludeRec(Filename, yyin));
621 Filelineno = 1; // Reset line numbering...
622 //yyrestart(yyin); // Start lexing the new file...
623
624 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
625}
626
627/// yywrap - This is called when the lexer runs out of input in one of the
628/// files. Switch back to an includer if an includee has run out of input.
629///
630extern "C"
631int yywrap(void) {
632 if (IncludeStack.back().File != stdin)
633 fclose(IncludeStack.back().File);
634 IncludeStack.pop_back();
635 if (IncludeStack.empty()) return 1; // Top-level file is done.
636
637 // Otherwise, we need to switch back to a file which included the current one.
638 Filelineno = IncludeStack.back().LineNo; // Restore current line number
639 yy_switch_to_buffer(IncludeStack.back().Buffer);
640 return 0;
641}
642
643} // End llvm namespace
644
645using namespace llvm;
646
647#line 648 "Lexer.cpp"
648
649/* Macros after this point can all be overridden by user definitions in
650 * section 1.
651 */
652
653#ifndef YY_SKIP_YYWRAP
654#ifdef __cplusplus
655extern "C" int yywrap YY_PROTO(( void ));
656#else
657extern int yywrap YY_PROTO(( void ));
658#endif
659#endif
660
661#ifndef YY_NO_UNPUT
662static inline void yyunput YY_PROTO(( int c, char *buf_ptr ));
663#endif
664
665#ifndef yytext_ptr
666static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
667#endif
668
669#ifdef YY_NEED_STRLEN
670static int yy_flex_strlen YY_PROTO(( yyconst char * ));
671#endif
672
673#ifndef YY_NO_INPUT
674#ifdef __cplusplus
675static int yyinput YY_PROTO(( void ));
676#else
677static int input YY_PROTO(( void ));
678#endif
679#endif
680
681#if YY_STACK_USED
682static int yy_start_stack_ptr = 0;
683static int yy_start_stack_depth = 0;
684static int *yy_start_stack = 0;
685#ifndef YY_NO_PUSH_STATE
686static void yy_push_state YY_PROTO(( int new_state ));
687#endif
688#ifndef YY_NO_POP_STATE
689static void yy_pop_state YY_PROTO(( void ));
690#endif
691#ifndef YY_NO_TOP_STATE
692static int yy_top_state YY_PROTO(( void ));
693#endif
694
695#else
696#define YY_NO_PUSH_STATE 1
697#define YY_NO_POP_STATE 1
698#define YY_NO_TOP_STATE 1
699#endif
700
701#ifdef YY_MALLOC_DECL
702YY_MALLOC_DECL
703#else
704#if __STDC__
705#ifndef __cplusplus
706#include <stdlib.h>
707#endif
708#else
709/* Just try to get by without declaring the routines. This will fail
710 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
711 * or sizeof(void*) != sizeof(int).
712 */
713#endif
714#endif
715
716/* Amount of stuff to slurp up with each read. */
717#ifndef YY_READ_BUF_SIZE
718#define YY_READ_BUF_SIZE 8192
719#endif
720
721/* Copy whatever the last rule matched to the standard output. */
722
723#ifndef ECHO
724/* This used to be an fputs(), but since the string might contain NUL's,
725 * we now use fwrite().
726 */
727#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
728#endif
729
730/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
731 * is returned in "result".
732 */
733#ifndef YY_INPUT
734#define YY_INPUT(buf,result,max_size) \
735 if ( yy_current_buffer->yy_is_interactive ) \
736 { \
737 int c = '*', n; \
738 for ( n = 0; n < max_size && \
739 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
740 buf[n] = (char) c; \
741 if ( c == '\n' ) \
742 buf[n++] = (char) c; \
743 if ( c == EOF && ferror( yyin ) ) \
744 YY_FATAL_ERROR( "input in flex scanner failed" ); \
745 result = n; \
746 } \
747 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
748 && ferror( yyin ) ) \
749 YY_FATAL_ERROR( "input in flex scanner failed" );
750#endif
751
752/* No semi-colon after return; correct usage is to write "yyterminate();" -
753 * we don't want an extra ';' after the "return" because that will cause
754 * some compilers to complain about unreachable statements.
755 */
756#ifndef yyterminate
757#define yyterminate() return YY_NULL
758#endif
759
760/* Number of entries by which start-condition stack grows. */
761#ifndef YY_START_STACK_INCR
762#define YY_START_STACK_INCR 25
763#endif
764
765/* Report a fatal error. */
766#ifndef YY_FATAL_ERROR
767#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
768#endif
769
770/* Default declaration of generated scanner - a define so the user can
771 * easily add parameters.
772 */
773#ifndef YY_DECL
774#define YY_DECL int yylex YY_PROTO(( void ))
775#endif
776
777/* Code executed at the beginning of each rule, after yytext and yyleng
778 * have been set up.
779 */
780#ifndef YY_USER_ACTION
781#define YY_USER_ACTION
782#endif
783
784/* Code executed at the end of each rule. */
785#ifndef YY_BREAK
786#define YY_BREAK break;
787#endif
788
789#define YY_RULE_SETUP \
790 YY_USER_ACTION
791
792YY_DECL
793 {
794 register yy_state_type yy_current_state;
795 register char *yy_cp = NULL, *yy_bp = NULL;
796 register int yy_act;
797
798#line 176 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
799
800
801#line 802 "Lexer.cpp"
802
803 if ( yy_init )
804 {
805 yy_init = 0;
806
807#ifdef YY_USER_INIT
808 YY_USER_INIT;
809#endif
810
811 if ( ! yy_start )
812 yy_start = 1; /* first start state */
813
814 if ( ! yyin )
815 yyin = stdin;
816
817 if ( ! yyout )
818 yyout = stdout;
819
820 if ( ! yy_current_buffer )
821 yy_current_buffer =
822 yy_create_buffer( yyin, YY_BUF_SIZE );
823
824 yy_load_buffer_state();
825 }
826
827 while ( 1 ) /* loops until end-of-file is reached */
828 {
829 yy_cp = yy_c_buf_p;
830
831 /* Support of yytext. */
832 *yy_cp = yy_hold_char;
833
834 /* yy_bp points to the position in yy_ch_buf of the start of
835 * the current run.
836 */
837 yy_bp = yy_cp;
838
839 yy_current_state = yy_start;
840 yy_state_ptr = yy_state_buf;
841 *yy_state_ptr++ = yy_current_state;
842yy_match:
843 do
844 {
845 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
846 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
847 {
848 yy_current_state = (int) yy_def[yy_current_state];
849 if ( yy_current_state >= 100 )
850 yy_c = yy_meta[(unsigned int) yy_c];
851 }
852 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
853 *yy_state_ptr++ = yy_current_state;
854 ++yy_cp;
855 }
856 while ( yy_current_state != 99 );
857
858yy_find_action:
859 yy_current_state = *--yy_state_ptr;
860 yy_lp = yy_accept[yy_current_state];
861find_rule: /* we branch to this label when backing up */
862 for ( ; ; ) /* until we find what rule we matched */
863 {
864 if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
865 {
866 yy_act = yy_acclist[yy_lp];
867 {
868 yy_full_match = yy_cp;
869 break;
870 }
871 }
872 --yy_cp;
873 yy_current_state = *--yy_state_ptr;
874 yy_lp = yy_accept[yy_current_state];
875 }
876
877 YY_DO_BEFORE_ACTION;
878
879 if ( yy_act != YY_END_OF_BUFFER )
880 {
881 int yyl;
882 for ( yyl = 0; yyl < yyleng; ++yyl )
883 if ( yytext[yyl] == '\n' )
884 ++yylineno;
885 }
886
887do_action: /* This label is used only to access EOF actions. */
888
889
890 switch ( yy_act )
891 { /* beginning of action switch */
892case 1:
893YY_RULE_SETUP
894#line 178 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
895{ /* Ignore comments */ }
896 YY_BREAK
897case 2:
898YY_RULE_SETUP
899#line 180 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
900{ HandleInclude(yytext); }
901 YY_BREAK
902case 3:
903YY_RULE_SETUP
904#line 181 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
905{ Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2);
906 return CODEFRAGMENT; }
907 YY_BREAK
908case 4:
909YY_RULE_SETUP
910#line 184 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
911{ return INT; }
912 YY_BREAK
913case 5:
914YY_RULE_SETUP
915#line 185 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
916{ return BIT; }
917 YY_BREAK
918case 6:
919YY_RULE_SETUP
920#line 186 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
921{ return BITS; }
922 YY_BREAK
923case 7:
924YY_RULE_SETUP
925#line 187 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
926{ return STRING; }
927 YY_BREAK
928case 8:
929YY_RULE_SETUP
930#line 188 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
931{ return LIST; }
932 YY_BREAK
933case 9:
934YY_RULE_SETUP
935#line 189 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
936{ return CODE; }
937 YY_BREAK
938case 10:
939YY_RULE_SETUP
940#line 190 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
941{ return DAG; }
942 YY_BREAK
943case 11:
944YY_RULE_SETUP
945#line 192 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
946{ return CLASS; }
947 YY_BREAK
948case 12:
949YY_RULE_SETUP
950#line 193 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
951{ return DEF; }
952 YY_BREAK
953case 13:
954YY_RULE_SETUP
955#line 194 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
956{ return FIELD; }
957 YY_BREAK
958case 14:
959YY_RULE_SETUP
960#line 195 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
961{ return LET; }
962 YY_BREAK
963case 15:
964YY_RULE_SETUP
965#line 196 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
966{ return IN; }
967 YY_BREAK
968case 16:
969YY_RULE_SETUP
970#line 198 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
971{ return SRATOK; }
972 YY_BREAK
973case 17:
974YY_RULE_SETUP
975#line 199 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
976{ return SRLTOK; }
977 YY_BREAK
978case 18:
979YY_RULE_SETUP
980#line 200 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
981{ return SHLTOK; }
982 YY_BREAK
983case 19:
984YY_RULE_SETUP
985#line 203 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
986{ Filelval.StrVal = new std::string(yytext, yytext+yyleng);
987 return ID; }
988 YY_BREAK
989case 20:
990YY_RULE_SETUP
991#line 205 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
992{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
993 return VARNAME; }
994 YY_BREAK
995case 21:
996YY_RULE_SETUP
997#line 208 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
998{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
999 return STRVAL; }
1000 YY_BREAK
1001case 22:
1002YY_RULE_SETUP
1003#line 211 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1004{ Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
1005 YY_BREAK
1006case 23:
1007YY_RULE_SETUP
1008#line 213 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1009{ /* Ignore whitespace */ }
1010 YY_BREAK
1011case 24:
1012YY_RULE_SETUP
1013#line 216 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1014{ BEGIN(comment); CommentDepth++; }
1015 YY_BREAK
1016case 25:
1017YY_RULE_SETUP
1018#line 217 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1019/* eat anything that's not a '*' or '/' */
1020 YY_BREAK
1021case 26:
1022YY_RULE_SETUP
1023#line 218 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1024/* eat up '*'s not followed by '/'s */
1025 YY_BREAK
1026case 27:
1027YY_RULE_SETUP
1028#line 219 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1029{ ++CommentDepth; }
1030 YY_BREAK
1031case 28:
1032YY_RULE_SETUP
1033#line 220 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1034/* eat up /'s not followed by *'s */
1035 YY_BREAK
1036case 29:
1037YY_RULE_SETUP
1038#line 221 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1039{ if (!--CommentDepth) { BEGIN(INITIAL); } }
1040 YY_BREAK
1041case YY_STATE_EOF(comment):
1042#line 222 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1043{ err() << "Unterminated comment!\n"; exit(1); }
1044 YY_BREAK
1045case 30:
1046YY_RULE_SETUP
1047#line 224 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1048{ return Filetext[0]; }
1049 YY_BREAK
1050case 31:
1051YY_RULE_SETUP
1052#line 226 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1053YY_FATAL_ERROR( "flex scanner jammed" );
1054 YY_BREAK
1055#line 1056 "Lexer.cpp"
1056 case YY_STATE_EOF(INITIAL):
1057 yyterminate();
1058
1059 case YY_END_OF_BUFFER:
1060 {
1061 /* Amount of text matched not including the EOB char. */
1062 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1063
1064 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1065 *yy_cp = yy_hold_char;
1066 YY_RESTORE_YY_MORE_OFFSET
1067
1068 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1069 {
1070 /* We're scanning a new file or input source. It's
1071 * possible that this happened because the user
1072 * just pointed yyin at a new source and called
1073 * yylex(). If so, then we have to assure
1074 * consistency between yy_current_buffer and our
1075 * globals. Here is the right place to do so, because
1076 * this is the first action (other than possibly a
1077 * back-up) that will match for the new input source.
1078 */
1079 yy_n_chars = yy_current_buffer->yy_n_chars;
1080 yy_current_buffer->yy_input_file = yyin;
1081 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1082 }
1083
1084 /* Note that here we test for yy_c_buf_p "<=" to the position
1085 * of the first EOB in the buffer, since yy_c_buf_p will
1086 * already have been incremented past the NUL character
1087 * (since all states make transitions on EOB to the
1088 * end-of-buffer state). Contrast this with the test
1089 * in input().
1090 */
1091 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1092 { /* This was really a NUL. */
1093 yy_state_type yy_next_state;
1094
1095 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1096
1097 yy_current_state = yy_get_previous_state();
1098
1099 /* Okay, we're now positioned to make the NUL
1100 * transition. We couldn't have
1101 * yy_get_previous_state() go ahead and do it
1102 * for us because it doesn't know how to deal
1103 * with the possibility of jamming (and we don't
1104 * want to build jamming into it because then it
1105 * will run more slowly).
1106 */
1107
1108 yy_next_state = yy_try_NUL_trans( yy_current_state );
1109
1110 yy_bp = yytext_ptr + YY_MORE_ADJ;
1111
1112 if ( yy_next_state )
1113 {
1114 /* Consume the NUL. */
1115 yy_cp = ++yy_c_buf_p;
1116 yy_current_state = yy_next_state;
1117 goto yy_match;
1118 }
1119
1120 else
1121 {
1122 yy_cp = yy_c_buf_p;
1123 goto yy_find_action;
1124 }
1125 }
1126
1127 else switch ( yy_get_next_buffer() )
1128 {
1129 case EOB_ACT_END_OF_FILE:
1130 {
1131 yy_did_buffer_switch_on_eof = 0;
1132
1133 if ( yywrap() )
1134 {
1135 /* Note: because we've taken care in
1136 * yy_get_next_buffer() to have set up
1137 * yytext, we can now set up
1138 * yy_c_buf_p so that if some total
1139 * hoser (like flex itself) wants to
1140 * call the scanner after we return the
1141 * YY_NULL, it'll still work - another
1142 * YY_NULL will get returned.
1143 */
1144 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1145
1146 yy_act = YY_STATE_EOF(YY_START);
1147 goto do_action;
1148 }
1149
1150 else
1151 {
1152 if ( ! yy_did_buffer_switch_on_eof )
1153 YY_NEW_FILE;
1154 }
1155 break;
1156 }
1157
1158 case EOB_ACT_CONTINUE_SCAN:
1159 yy_c_buf_p =
1160 yytext_ptr + yy_amount_of_matched_text;
1161
1162 yy_current_state = yy_get_previous_state();
1163
1164 yy_cp = yy_c_buf_p;
1165 yy_bp = yytext_ptr + YY_MORE_ADJ;
1166 goto yy_match;
1167
1168 case EOB_ACT_LAST_MATCH:
1169 yy_c_buf_p =
1170 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1171
1172 yy_current_state = yy_get_previous_state();
1173
1174 yy_cp = yy_c_buf_p;
1175 yy_bp = yytext_ptr + YY_MORE_ADJ;
1176 goto yy_find_action;
1177 }
1178 break;
1179 }
1180
1181 default:
1182 YY_FATAL_ERROR(
1183 "fatal flex scanner internal error--no action found" );
1184 } /* end of action switch */
1185 } /* end of scanning one token */
1186 } /* end of yylex */
1187
1188
1189/* yy_get_next_buffer - try to read in a new buffer
1190 *
1191 * Returns a code representing an action:
1192 * EOB_ACT_LAST_MATCH -
1193 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1194 * EOB_ACT_END_OF_FILE - end of file
1195 */
1196
1197static int yy_get_next_buffer()
1198 {
1199 register char *dest = yy_current_buffer->yy_ch_buf;
1200 register char *source = yytext_ptr;
1201 register int number_to_move, i;
1202 int ret_val;
1203
1204 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1205 YY_FATAL_ERROR(
1206 "fatal flex scanner internal error--end of buffer missed" );
1207
1208 if ( yy_current_buffer->yy_fill_buffer == 0 )
1209 { /* Don't try to fill the buffer, so this is an EOF. */
1210 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1211 {
1212 /* We matched a single character, the EOB, so
1213 * treat this as a final EOF.
1214 */
1215 return EOB_ACT_END_OF_FILE;
1216 }
1217
1218 else
1219 {
1220 /* We matched some text prior to the EOB, first
1221 * process it.
1222 */
1223 return EOB_ACT_LAST_MATCH;
1224 }
1225 }
1226
1227 /* Try to read more data. */
1228
1229 /* First move last chars to start of buffer. */
1230 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1231
1232 for ( i = 0; i < number_to_move; ++i )
1233 *(dest++) = *(source++);
1234
1235 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1236 /* don't do the read, it's not guaranteed to return an EOF,
1237 * just force an EOF
1238 */
1239 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1240
1241 else
1242 {
1243 int num_to_read =
1244 yy_current_buffer->yy_buf_size - number_to_move - 1;
1245
1246 while ( num_to_read <= 0 )
1247 { /* Not enough room in the buffer - grow it. */
1248#ifdef YY_USES_REJECT
1249 YY_FATAL_ERROR(
1250"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1251#else
1252
1253 /* just a shorter name for the current buffer */
1254 YY_BUFFER_STATE b = yy_current_buffer;
1255
1256 int yy_c_buf_p_offset =
1257 (int) (yy_c_buf_p - b->yy_ch_buf);
1258
1259 if ( b->yy_is_our_buffer )
1260 {
1261 int new_size = b->yy_buf_size * 2;
1262
1263 if ( new_size <= 0 )
1264 b->yy_buf_size += b->yy_buf_size / 8;
1265 else
1266 b->yy_buf_size *= 2;
1267
1268 b->yy_ch_buf = (char *)
1269 /* Include room in for 2 EOB chars. */
1270 yy_flex_realloc( (void *) b->yy_ch_buf,
1271 b->yy_buf_size + 2 );
1272 }
1273 else
1274 /* Can't grow it, we don't own it. */
1275 b->yy_ch_buf = 0;
1276
1277 if ( ! b->yy_ch_buf )
1278 YY_FATAL_ERROR(
1279 "fatal error - scanner input buffer overflow" );
1280
1281 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1282
1283 num_to_read = yy_current_buffer->yy_buf_size -
1284 number_to_move - 1;
1285#endif
1286 }
1287
1288 if ( num_to_read > YY_READ_BUF_SIZE )
1289 num_to_read = YY_READ_BUF_SIZE;
1290
1291 /* Read in more data. */
1292 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1293 yy_n_chars, num_to_read );
1294
1295 yy_current_buffer->yy_n_chars = yy_n_chars;
1296 }
1297
1298 if ( yy_n_chars == 0 )
1299 {
1300 if ( number_to_move == YY_MORE_ADJ )
1301 {
1302 ret_val = EOB_ACT_END_OF_FILE;
1303 yyrestart( yyin );
1304 }
1305
1306 else
1307 {
1308 ret_val = EOB_ACT_LAST_MATCH;
1309 yy_current_buffer->yy_buffer_status =
1310 YY_BUFFER_EOF_PENDING;
1311 }
1312 }
1313
1314 else
1315 ret_val = EOB_ACT_CONTINUE_SCAN;
1316
1317 yy_n_chars += number_to_move;
1318 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1319 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1320
1321 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1322
1323 return ret_val;
1324 }
1325
1326
1327/* yy_get_previous_state - get the state just before the EOB char was reached */
1328
1329static yy_state_type yy_get_previous_state()
1330 {
1331 register yy_state_type yy_current_state;
1332 register char *yy_cp;
1333
1334 yy_current_state = yy_start;
1335 yy_state_ptr = yy_state_buf;
1336 *yy_state_ptr++ = yy_current_state;
1337
1338 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1339 {
1340 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1341 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1342 {
1343 yy_current_state = (int) yy_def[yy_current_state];
1344 if ( yy_current_state >= 100 )
1345 yy_c = yy_meta[(unsigned int) yy_c];
1346 }
1347 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1348 *yy_state_ptr++ = yy_current_state;
1349 }
1350
1351 return yy_current_state;
1352 }
1353
1354
1355/* yy_try_NUL_trans - try to make a transition on the NUL character
1356 *
1357 * synopsis
1358 * next_state = yy_try_NUL_trans( current_state );
1359 */
1360
1361#ifdef YY_USE_PROTOS
1362static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1363#else
1364static yy_state_type yy_try_NUL_trans( yy_current_state )
1365yy_state_type yy_current_state;
1366#endif
1367 {
1368 register int yy_is_jam;
1369
1370 register YY_CHAR yy_c = 1;
1371 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1372 {
1373 yy_current_state = (int) yy_def[yy_current_state];
1374 if ( yy_current_state >= 100 )
1375 yy_c = yy_meta[(unsigned int) yy_c];
1376 }
1377 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1378 yy_is_jam = (yy_current_state == 99);
1379 if ( ! yy_is_jam )
1380 *yy_state_ptr++ = yy_current_state;
1381
1382 return yy_is_jam ? 0 : yy_current_state;
1383 }
1384
1385
1386#ifndef YY_NO_UNPUT
1387#ifdef YY_USE_PROTOS
1388static inline void yyunput( int c, register char *yy_bp )
1389#else
1390static inline void yyunput( c, yy_bp )
1391int c;
1392register char *yy_bp;
1393#endif
1394 {
1395 register char *yy_cp = yy_c_buf_p;
1396
1397 /* undo effects of setting up yytext */
1398 *yy_cp = yy_hold_char;
1399
1400 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1401 { /* need to shift things up to make room */
1402 /* +2 for EOB chars. */
1403 register int number_to_move = yy_n_chars + 2;
1404 register char *dest = &yy_current_buffer->yy_ch_buf[
1405 yy_current_buffer->yy_buf_size + 2];
1406 register char *source =
1407 &yy_current_buffer->yy_ch_buf[number_to_move];
1408
1409 while ( source > yy_current_buffer->yy_ch_buf )
1410 *--dest = *--source;
1411
1412 yy_cp += (int) (dest - source);
1413 yy_bp += (int) (dest - source);
1414 yy_current_buffer->yy_n_chars =
1415 yy_n_chars = yy_current_buffer->yy_buf_size;
1416
1417 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1418 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1419 }
1420
1421 *--yy_cp = (char) c;
1422
1423 if ( c == '\n' )
1424 --yylineno;
1425
1426 yytext_ptr = yy_bp;
1427 yy_hold_char = *yy_cp;
1428 yy_c_buf_p = yy_cp;
1429 }
1430#endif /* ifndef YY_NO_UNPUT */
1431
1432
1433#ifndef YY_NO_INPUT
1434#ifdef __cplusplus
1435static int yyinput()
1436#else
1437static int input()
1438#endif
1439 {
1440 int c;
1441
1442 *yy_c_buf_p = yy_hold_char;
1443
1444 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1445 {
1446 /* yy_c_buf_p now points to the character we want to return.
1447 * If this occurs *before* the EOB characters, then it's a
1448 * valid NUL; if not, then we've hit the end of the buffer.
1449 */
1450 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1451 /* This was really a NUL. */
1452 *yy_c_buf_p = '\0';
1453
1454 else
1455 { /* need more input */
1456 int offset = yy_c_buf_p - yytext_ptr;
1457 ++yy_c_buf_p;
1458
1459 switch ( yy_get_next_buffer() )
1460 {
1461 case EOB_ACT_LAST_MATCH:
1462 /* This happens because yy_g_n_b()
1463 * sees that we've accumulated a
1464 * token and flags that we need to
1465 * try matching the token before
1466 * proceeding. But for input(),
1467 * there's no matching to consider.
1468 * So convert the EOB_ACT_LAST_MATCH
1469 * to EOB_ACT_END_OF_FILE.
1470 */
1471
1472 /* Reset buffer status. */
1473 yyrestart( yyin );
1474
1475 /* fall through */
1476
1477 case EOB_ACT_END_OF_FILE:
1478 {
1479 if ( yywrap() )
1480 return EOF;
1481
1482 if ( ! yy_did_buffer_switch_on_eof )
1483 YY_NEW_FILE;
1484#ifdef __cplusplus
1485 return yyinput();
1486#else
1487 return input();
1488#endif
1489 }
1490
1491 case EOB_ACT_CONTINUE_SCAN:
1492 yy_c_buf_p = yytext_ptr + offset;
1493 break;
1494 }
1495 }
1496 }
1497
1498 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1499 *yy_c_buf_p = '\0'; /* preserve yytext */
1500 yy_hold_char = *++yy_c_buf_p;
1501
1502 if ( c == '\n' )
1503 ++yylineno;
1504
1505 return c;
1506 }
1507#endif /* YY_NO_INPUT */
1508
1509#ifdef YY_USE_PROTOS
1510void yyrestart( FILE *input_file )
1511#else
1512void yyrestart( input_file )
1513FILE *input_file;
1514#endif
1515 {
1516 if ( ! yy_current_buffer )
1517 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1518
1519 yy_init_buffer( yy_current_buffer, input_file );
1520 yy_load_buffer_state();
1521 }
1522
1523
1524#ifdef YY_USE_PROTOS
1525void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1526#else
1527void yy_switch_to_buffer( new_buffer )
1528YY_BUFFER_STATE new_buffer;
1529#endif
1530 {
1531 if ( yy_current_buffer == new_buffer )
1532 return;
1533
1534 if ( yy_current_buffer )
1535 {
1536 /* Flush out information for old buffer. */
1537 *yy_c_buf_p = yy_hold_char;
1538 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1539 yy_current_buffer->yy_n_chars = yy_n_chars;
1540 }
1541
1542 yy_current_buffer = new_buffer;
1543 yy_load_buffer_state();
1544
1545 /* We don't actually know whether we did this switch during
1546 * EOF (yywrap()) processing, but the only time this flag
1547 * is looked at is after yywrap() is called, so it's safe
1548 * to go ahead and always set it.
1549 */
1550 yy_did_buffer_switch_on_eof = 1;
1551 }
1552
1553
1554#ifdef YY_USE_PROTOS
1555void yy_load_buffer_state( void )
1556#else
1557void yy_load_buffer_state()
1558#endif
1559 {
1560 yy_n_chars = yy_current_buffer->yy_n_chars;
1561 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1562 yyin = yy_current_buffer->yy_input_file;
1563 yy_hold_char = *yy_c_buf_p;
1564 }
1565
1566
1567#ifdef YY_USE_PROTOS
1568YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1569#else
1570YY_BUFFER_STATE yy_create_buffer( file, size )
1571FILE *file;
1572int size;
1573#endif
1574 {
1575 YY_BUFFER_STATE b;
1576
1577 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1578 if ( ! b )
1579 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1580
1581 b->yy_buf_size = size;
1582
1583 /* yy_ch_buf has to be 2 characters longer than the size given because
1584 * we need to put in 2 end-of-buffer characters.
1585 */
1586 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1587 if ( ! b->yy_ch_buf )
1588 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1589
1590 b->yy_is_our_buffer = 1;
1591
1592 yy_init_buffer( b, file );
1593
1594 return b;
1595 }
1596
1597
1598#ifdef YY_USE_PROTOS
1599void yy_delete_buffer( YY_BUFFER_STATE b )
1600#else
1601void yy_delete_buffer( b )
1602YY_BUFFER_STATE b;
1603#endif
1604 {
1605 if ( ! b )
1606 return;
1607
1608 if ( b == yy_current_buffer )
1609 yy_current_buffer = (YY_BUFFER_STATE) 0;
1610
1611 if ( b->yy_is_our_buffer )
1612 yy_flex_free( (void *) b->yy_ch_buf );
1613
1614 yy_flex_free( (void *) b );
1615 }
1616
1617
1618
1619#ifdef YY_USE_PROTOS
1620void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1621#else
1622void yy_init_buffer( b, file )
1623YY_BUFFER_STATE b;
1624FILE *file;
1625#endif
1626
1627
1628 {
1629 yy_flush_buffer( b );
1630
1631 b->yy_input_file = file;
1632 b->yy_fill_buffer = 1;
1633
1634#if YY_ALWAYS_INTERACTIVE
1635 b->yy_is_interactive = 1;
1636#else
1637#if YY_NEVER_INTERACTIVE
1638 b->yy_is_interactive = 0;
1639#else
1640 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1641#endif
1642#endif
1643 }
1644
1645
1646#ifdef YY_USE_PROTOS
1647void yy_flush_buffer( YY_BUFFER_STATE b )
1648#else
1649void yy_flush_buffer( b )
1650YY_BUFFER_STATE b;
1651#endif
1652
1653 {
1654 if ( ! b )
1655 return;
1656
1657 b->yy_n_chars = 0;
1658
1659 /* We always need two end-of-buffer characters. The first causes
1660 * a transition to the end-of-buffer state. The second causes
1661 * a jam in that state.
1662 */
1663 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1664 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1665
1666 b->yy_buf_pos = &b->yy_ch_buf[0];
1667
1668 b->yy_at_bol = 1;
1669 b->yy_buffer_status = YY_BUFFER_NEW;
1670
1671 if ( b == yy_current_buffer )
1672 yy_load_buffer_state();
1673 }
1674
1675
1676#ifndef YY_NO_SCAN_BUFFER
1677#ifdef YY_USE_PROTOS
1678YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1679#else
1680YY_BUFFER_STATE yy_scan_buffer( base, size )
1681char *base;
1682yy_size_t size;
1683#endif
1684 {
1685 YY_BUFFER_STATE b;
1686
1687 if ( size < 2 ||
1688 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1689 base[size-1] != YY_END_OF_BUFFER_CHAR )
1690 /* They forgot to leave room for the EOB's. */
1691 return 0;
1692
1693 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1694 if ( ! b )
1695 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1696
1697 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1698 b->yy_buf_pos = b->yy_ch_buf = base;
1699 b->yy_is_our_buffer = 0;
1700 b->yy_input_file = 0;
1701 b->yy_n_chars = b->yy_buf_size;
1702 b->yy_is_interactive = 0;
1703 b->yy_at_bol = 1;
1704 b->yy_fill_buffer = 0;
1705 b->yy_buffer_status = YY_BUFFER_NEW;
1706
1707 yy_switch_to_buffer( b );
1708
1709 return b;
1710 }
1711#endif
1712
1713
1714#ifndef YY_NO_SCAN_STRING
1715#ifdef YY_USE_PROTOS
1716YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1717#else
1718YY_BUFFER_STATE yy_scan_string( yy_str )
1719yyconst char *yy_str;
1720#endif
1721 {
1722 int len;
1723 for ( len = 0; yy_str[len]; ++len )
1724 ;
1725
1726 return yy_scan_bytes( yy_str, len );
1727 }
1728#endif
1729
1730
1731#ifndef YY_NO_SCAN_BYTES
1732#ifdef YY_USE_PROTOS
1733YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1734#else
1735YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1736yyconst char *bytes;
1737int len;
1738#endif
1739 {
1740 YY_BUFFER_STATE b;
1741 char *buf;
1742 yy_size_t n;
1743 int i;
1744
1745 /* Get memory for full buffer, including space for trailing EOB's. */
1746 n = len + 2;
1747 buf = (char *) yy_flex_alloc( n );
1748 if ( ! buf )
1749 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1750
1751 for ( i = 0; i < len; ++i )
1752 buf[i] = bytes[i];
1753
1754 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1755
1756 b = yy_scan_buffer( buf, n );
1757 if ( ! b )
1758 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1759
1760 /* It's okay to grow etc. this buffer, and we should throw it
1761 * away when we're done.
1762 */
1763 b->yy_is_our_buffer = 1;
1764
1765 return b;
1766 }
1767#endif
1768
1769
1770#ifndef YY_NO_PUSH_STATE
1771#ifdef YY_USE_PROTOS
1772static void yy_push_state( int new_state )
1773#else
1774static void yy_push_state( new_state )
1775int new_state;
1776#endif
1777 {
1778 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1779 {
1780 yy_size_t new_size;
1781
1782 yy_start_stack_depth += YY_START_STACK_INCR;
1783 new_size = yy_start_stack_depth * sizeof( int );
1784
1785 if ( ! yy_start_stack )
1786 yy_start_stack = (int *) yy_flex_alloc( new_size );
1787
1788 else
1789 yy_start_stack = (int *) yy_flex_realloc(
1790 (void *) yy_start_stack, new_size );
1791
1792 if ( ! yy_start_stack )
1793 YY_FATAL_ERROR(
1794 "out of memory expanding start-condition stack" );
1795 }
1796
1797 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1798
1799 BEGIN(new_state);
1800 }
1801#endif
1802
1803
1804#ifndef YY_NO_POP_STATE
1805static void yy_pop_state()
1806 {
1807 if ( --yy_start_stack_ptr < 0 )
1808 YY_FATAL_ERROR( "start-condition stack underflow" );
1809
1810 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1811 }
1812#endif
1813
1814
1815#ifndef YY_NO_TOP_STATE
1816static int yy_top_state()
1817 {
1818 return yy_start_stack[yy_start_stack_ptr - 1];
1819 }
1820#endif
1821
1822#ifndef YY_EXIT_FAILURE
1823#define YY_EXIT_FAILURE 2
1824#endif
1825
1826#ifdef YY_USE_PROTOS
1827static void yy_fatal_error( yyconst char msg[] )
1828#else
1829static void yy_fatal_error( msg )
1830char msg[];
1831#endif
1832 {
1833 (void) fprintf( stderr, "%s\n", msg );
1834 exit( YY_EXIT_FAILURE );
1835 }
1836
1837
1838
1839/* Redefine yyless() so it works in section 3 code. */
1840
1841#undef yyless
1842#define yyless(n) \
1843 do \
1844 { \
1845 /* Undo effects of setting up yytext. */ \
1846 yytext[yyleng] = yy_hold_char; \
1847 yy_c_buf_p = yytext + n; \
1848 yy_hold_char = *yy_c_buf_p; \
1849 *yy_c_buf_p = '\0'; \
1850 yyleng = n; \
1851 } \
1852 while ( 0 )
1853
1854
1855/* Internal utility routines. */
1856
1857#ifndef yytext_ptr
1858#ifdef YY_USE_PROTOS
1859static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1860#else
1861static void yy_flex_strncpy( s1, s2, n )
1862char *s1;
1863yyconst char *s2;
1864int n;
1865#endif
1866 {
1867 register int i;
1868 for ( i = 0; i < n; ++i )
1869 s1[i] = s2[i];
1870 }
1871#endif
1872
1873#ifdef YY_NEED_STRLEN
1874#ifdef YY_USE_PROTOS
1875static int yy_flex_strlen( yyconst char *s )
1876#else
1877static int yy_flex_strlen( s )
1878yyconst char *s;
1879#endif
1880 {
1881 register int n;
1882 for ( n = 0; s[n]; ++n )
1883 ;
1884
1885 return n;
1886 }
1887#endif
1888
1889
1890#ifdef YY_USE_PROTOS
1891static void *yy_flex_alloc( yy_size_t size )
1892#else
1893static void *yy_flex_alloc( size )
1894yy_size_t size;
1895#endif
1896 {
1897 return (void *) malloc( size );
1898 }
1899
1900#ifdef YY_USE_PROTOS
1901static inline void *yy_flex_realloc( void *ptr, yy_size_t size )
1902#else
1903static inline void *yy_flex_realloc( ptr, size )
1904void *ptr;
1905yy_size_t size;
1906#endif
1907 {
1908 /* The cast to (char *) in the following accommodates both
1909 * implementations that use char* generic pointers, and those
1910 * that use void* generic pointers. It works with the latter
1911 * because both ANSI C and C++ allow castless assignment from
1912 * any pointer type to void*, and deal with argument conversions
1913 * as though doing an assignment.
1914 */
1915 return (void *) realloc( (char *) ptr, size );
1916 }
1917
1918#ifdef YY_USE_PROTOS
1919static void yy_flex_free( void *ptr )
1920#else
1921static void yy_flex_free( ptr )
1922void *ptr;
1923#endif
1924 {
1925 free( ptr );
1926 }
1927
1928#if YY_MAIN
1929int main()
1930 {
1931 yylex();
1932 return 0;
1933 }
1934#endif
1935#line 226 "/proj/llvm/build/../llvm/utils/TableGen/FileLexer.l"
1936