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