blob: aaa5237ce43516463a54b13d716d60740bc2e8e8 [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>
Reid Spencer68a24bd2005-08-27 18:50:39 +000032
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>
Chris Lattnere8242b12006-02-14 05:13:13 +000045#include <unistd.h>
Reid Spencer68a24bd2005-08-27 18:50:39 +000046
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,
Chris Lattner46a78002005-09-06 21:23:27 +0000386 0, 0, 29, 30, 199, 200, 39, 42, 167, 191,
387 0, 36, 42, 42, 45, 0, 161, 169, 33, 41,
388 168, 165, 42, 160, 0, 57, 61, 70, 45, 185,
389 200, 0, 66, 200, 0, 69, 0, 0, 154, 157,
390 170, 166, 162, 162, 162, 62, 151, 151, 151, 0,
391 75, 76, 200, 79, 200, 80, 153, 73, 0, 0,
392 81, 0, 143, 161, 146, 145, 153, 0, 0, 147,
393 146, 0, 0, 140, 145, 200, 200, 200, 134, 200,
394 0, 138, 0, 147, 134, 0, 138, 0, 0, 120,
395 97, 77, 0, 93, 95, 60, 45, 200, 200, 101,
Reid Spencer68a24bd2005-08-27 18:50:39 +0000396
Chris Lattner46a78002005-09-06 21:23:27 +0000397 107, 109, 112, 118, 124, 130, 133, 139, 142, 147,
398 153, 159
Reid Spencer68a24bd2005-08-27 18:50:39 +0000399 } ;
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
Chris Lattner46a78002005-09-06 21:23:27 +0000418static yyconst short int yy_nxt[237] =
Reid Spencer68a24bd2005-08-27 18:50:39 +0000419 { 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,
Chris Lattner46a78002005-09-06 21:23:27 +0000428 61, 71, 99, 52, 99, 53, 99, 99, 99, 56,
429 77, 61, 61, 72, 95, 95, 95, 95, 94, 78,
Reid Spencer68a24bd2005-08-27 18:50:39 +0000430
Chris Lattner46a78002005-09-06 21:23:27 +0000431 96, 25, 25, 25, 25, 25, 25, 30, 30, 30,
432 30, 30, 30, 32, 32, 38, 38, 38, 50, 50,
433 93, 50, 50, 50, 51, 51, 51, 51, 51, 51,
434 54, 54, 54, 54, 54, 54, 59, 59, 59, 60,
435 92, 60, 60, 60, 60, 62, 62, 63, 63, 63,
436 63, 63, 63, 79, 79, 79, 79, 79, 79, 97,
437 97, 97, 97, 97, 97, 91, 90, 89, 88, 64,
438 87, 86, 85, 84, 83, 82, 81, 80, 64, 76,
439 75, 74, 73, 70, 69, 68, 67, 66, 65, 64,
440 31, 49, 46, 45, 40, 39, 31, 29, 99, 5,
Reid Spencer68a24bd2005-08-27 18:50:39 +0000441
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,
Chris Lattner46a78002005-09-06 21:23:27 +0000445 99, 99, 99, 99, 99, 99
Reid Spencer68a24bd2005-08-27 18:50:39 +0000446 } ;
447
Chris Lattner46a78002005-09-06 21:23:27 +0000448static yyconst short int yy_chk[237] =
Reid Spencer68a24bd2005-08-27 18:50:39 +0000449 { 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,
Chris Lattner46a78002005-09-06 21:23:27 +0000458 36, 46, 51, 52, 51, 52, 54, 56, 54, 56,
459 58, 61, 61, 46, 94, 94, 95, 95, 92, 58,
Reid Spencer68a24bd2005-08-27 18:50:39 +0000460
Chris Lattner46a78002005-09-06 21:23:27 +0000461 95, 100, 100, 100, 100, 100, 100, 101, 101, 101,
462 101, 101, 101, 102, 102, 103, 103, 103, 104, 104,
463 91, 104, 104, 104, 105, 105, 105, 105, 105, 105,
464 106, 106, 106, 106, 106, 106, 107, 107, 107, 108,
465 90, 108, 108, 108, 108, 109, 109, 110, 110, 110,
466 110, 110, 110, 111, 111, 111, 111, 111, 111, 112,
467 112, 112, 112, 112, 112, 87, 85, 84, 82, 79,
468 75, 74, 71, 70, 67, 66, 65, 64, 63, 57,
469 49, 48, 47, 45, 44, 43, 42, 41, 40, 39,
470 30, 24, 22, 21, 18, 17, 10, 9, 5, 99,
Reid Spencer68a24bd2005-08-27 18:50:39 +0000471
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,
Chris Lattner46a78002005-09-06 21:23:27 +0000475 99, 99, 99, 99, 99, 99
Reid Spencer68a24bd2005-08-27 18:50:39 +0000476 } ;
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;
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000492#line 1 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000493#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
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000510#line 30 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000511#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
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000520std::vector<std::string> IncludeDirectories;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000521
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///
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000558void ParseFile(const std::string &Filename,
559 const std::vector<std::string> &IncludeDirs) {
Reid Spencer68a24bd2005-08-27 18:50:39 +0000560 FILE *F = stdin;
561 if (Filename != "-") {
562 F = fopen(Filename.c_str(), "r");
563
564 if (F == 0) {
565 std::cerr << "Could not open input file '" + Filename + "'!\n";
566 exit (1);
567 }
568 IncludeStack.push_back(IncludeRec(Filename, F));
569 } else {
570 IncludeStack.push_back(IncludeRec("<stdin>", stdin));
571 }
572
573 // Record the location of the include directory so that the lexer can find
574 // it later.
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000575 IncludeDirectories = IncludeDirs;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000576
577 Filein = F;
578 Filelineno = 1;
579 Fileparse();
580 Filein = stdin;
581}
582
583/// HandleInclude - This function is called when an include directive is
584/// encountered in the input stream...
585///
586static void HandleInclude(const char *Buffer) {
587 unsigned Length = yyleng;
588 assert(Buffer[Length-1] == '"');
589 Buffer += strlen("include ");
590 Length -= strlen("include ");
591 while (*Buffer != '"') {
592 ++Buffer;
593 --Length;
594 }
595 assert(Length >= 2 && "Double quotes not found?");
596 std::string Filename(Buffer+1, Buffer+Length-1);
597 //std::cerr << "Filename = '" << Filename << "'\n";
598
599 // Save the line number and lex buffer of the includer...
600 IncludeStack.back().LineNo = Filelineno;
601 IncludeStack.back().Buffer = YY_CURRENT_BUFFER;
602
603 // Open the new input file...
604 yyin = fopen(Filename.c_str(), "r");
605 if (yyin == 0) {
606 // If we couldn't find the file in the current directory, look for it in
607 // the include directories.
608 //
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000609 std::string NextFilename;
610 for (unsigned i = 0, e = IncludeDirectories.size(); i != e; ++i) {
611 NextFilename = IncludeDirectories[i] + "/" + Filename;
Chris Lattner56879b22006-03-03 19:34:28 +0000612 if ((yyin = fopen(NextFilename.c_str(), "r")))
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000613 break;
614 }
615
Reid Spencer68a24bd2005-08-27 18:50:39 +0000616 if (yyin == 0) {
617 err() << "Could not find include file '" << Filename << "'!\n";
618 exit(1);
619 }
620 Filename = NextFilename;
621 }
622
623 // Add the file to our include stack...
624 IncludeStack.push_back(IncludeRec(Filename, yyin));
625 Filelineno = 1; // Reset line numbering...
626 //yyrestart(yyin); // Start lexing the new file...
627
628 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
629}
630
631/// yywrap - This is called when the lexer runs out of input in one of the
632/// files. Switch back to an includer if an includee has run out of input.
633///
634extern "C"
635int yywrap(void) {
636 if (IncludeStack.back().File != stdin)
637 fclose(IncludeStack.back().File);
638 IncludeStack.pop_back();
639 if (IncludeStack.empty()) return 1; // Top-level file is done.
640
641 // Otherwise, we need to switch back to a file which included the current one.
642 Filelineno = IncludeStack.back().LineNo; // Restore current line number
643 yy_switch_to_buffer(IncludeStack.back().Buffer);
644 return 0;
645}
646
647} // End llvm namespace
648
649using namespace llvm;
650
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000651#line 652 "Lexer.cpp"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000652
653/* Macros after this point can all be overridden by user definitions in
654 * section 1.
655 */
656
657#ifndef YY_SKIP_YYWRAP
658#ifdef __cplusplus
659extern "C" int yywrap YY_PROTO(( void ));
660#else
661extern int yywrap YY_PROTO(( void ));
662#endif
663#endif
664
665#ifndef YY_NO_UNPUT
666static inline void yyunput YY_PROTO(( int c, char *buf_ptr ));
667#endif
668
669#ifndef yytext_ptr
670static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
671#endif
672
673#ifdef YY_NEED_STRLEN
674static int yy_flex_strlen YY_PROTO(( yyconst char * ));
675#endif
676
677#ifndef YY_NO_INPUT
678#ifdef __cplusplus
679static int yyinput YY_PROTO(( void ));
680#else
681static int input YY_PROTO(( void ));
682#endif
683#endif
684
685#if YY_STACK_USED
686static int yy_start_stack_ptr = 0;
687static int yy_start_stack_depth = 0;
688static int *yy_start_stack = 0;
689#ifndef YY_NO_PUSH_STATE
690static void yy_push_state YY_PROTO(( int new_state ));
691#endif
692#ifndef YY_NO_POP_STATE
693static void yy_pop_state YY_PROTO(( void ));
694#endif
695#ifndef YY_NO_TOP_STATE
696static int yy_top_state YY_PROTO(( void ));
697#endif
698
699#else
700#define YY_NO_PUSH_STATE 1
701#define YY_NO_POP_STATE 1
702#define YY_NO_TOP_STATE 1
703#endif
704
705#ifdef YY_MALLOC_DECL
706YY_MALLOC_DECL
707#else
708#if __STDC__
709#ifndef __cplusplus
710#include <stdlib.h>
711#endif
712#else
713/* Just try to get by without declaring the routines. This will fail
714 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
715 * or sizeof(void*) != sizeof(int).
716 */
717#endif
718#endif
719
720/* Amount of stuff to slurp up with each read. */
721#ifndef YY_READ_BUF_SIZE
722#define YY_READ_BUF_SIZE 8192
723#endif
724
725/* Copy whatever the last rule matched to the standard output. */
726
727#ifndef ECHO
728/* This used to be an fputs(), but since the string might contain NUL's,
729 * we now use fwrite().
730 */
731#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
732#endif
733
734/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
735 * is returned in "result".
736 */
737#ifndef YY_INPUT
738#define YY_INPUT(buf,result,max_size) \
739 if ( yy_current_buffer->yy_is_interactive ) \
740 { \
741 int c = '*', n; \
742 for ( n = 0; n < max_size && \
743 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
744 buf[n] = (char) c; \
745 if ( c == '\n' ) \
746 buf[n++] = (char) c; \
747 if ( c == EOF && ferror( yyin ) ) \
748 YY_FATAL_ERROR( "input in flex scanner failed" ); \
749 result = n; \
750 } \
751 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
752 && ferror( yyin ) ) \
753 YY_FATAL_ERROR( "input in flex scanner failed" );
754#endif
755
756/* No semi-colon after return; correct usage is to write "yyterminate();" -
757 * we don't want an extra ';' after the "return" because that will cause
758 * some compilers to complain about unreachable statements.
759 */
760#ifndef yyterminate
761#define yyterminate() return YY_NULL
762#endif
763
764/* Number of entries by which start-condition stack grows. */
765#ifndef YY_START_STACK_INCR
766#define YY_START_STACK_INCR 25
767#endif
768
769/* Report a fatal error. */
770#ifndef YY_FATAL_ERROR
771#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
772#endif
773
774/* Default declaration of generated scanner - a define so the user can
775 * easily add parameters.
776 */
777#ifndef YY_DECL
778#define YY_DECL int yylex YY_PROTO(( void ))
779#endif
780
781/* Code executed at the beginning of each rule, after yytext and yyleng
782 * have been set up.
783 */
784#ifndef YY_USER_ACTION
785#define YY_USER_ACTION
786#endif
787
788/* Code executed at the end of each rule. */
789#ifndef YY_BREAK
790#define YY_BREAK break;
791#endif
792
793#define YY_RULE_SETUP \
794 YY_USER_ACTION
795
796YY_DECL
797 {
798 register yy_state_type yy_current_state;
Chris Lattnere8242b12006-02-14 05:13:13 +0000799 register char *yy_cp, *yy_bp;
Reid Spencer68a24bd2005-08-27 18:50:39 +0000800 register int yy_act;
801
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000802#line 180 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000803
804
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000805#line 806 "Lexer.cpp"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000806
807 if ( yy_init )
808 {
809 yy_init = 0;
810
811#ifdef YY_USER_INIT
812 YY_USER_INIT;
813#endif
814
815 if ( ! yy_start )
816 yy_start = 1; /* first start state */
817
818 if ( ! yyin )
819 yyin = stdin;
820
821 if ( ! yyout )
822 yyout = stdout;
823
824 if ( ! yy_current_buffer )
825 yy_current_buffer =
826 yy_create_buffer( yyin, YY_BUF_SIZE );
827
828 yy_load_buffer_state();
829 }
830
831 while ( 1 ) /* loops until end-of-file is reached */
832 {
833 yy_cp = yy_c_buf_p;
834
835 /* Support of yytext. */
836 *yy_cp = yy_hold_char;
837
838 /* yy_bp points to the position in yy_ch_buf of the start of
839 * the current run.
840 */
841 yy_bp = yy_cp;
842
843 yy_current_state = yy_start;
844 yy_state_ptr = yy_state_buf;
845 *yy_state_ptr++ = yy_current_state;
846yy_match:
847 do
848 {
849 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
850 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
851 {
852 yy_current_state = (int) yy_def[yy_current_state];
853 if ( yy_current_state >= 100 )
854 yy_c = yy_meta[(unsigned int) yy_c];
855 }
856 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
857 *yy_state_ptr++ = yy_current_state;
858 ++yy_cp;
859 }
860 while ( yy_current_state != 99 );
861
862yy_find_action:
863 yy_current_state = *--yy_state_ptr;
864 yy_lp = yy_accept[yy_current_state];
865find_rule: /* we branch to this label when backing up */
866 for ( ; ; ) /* until we find what rule we matched */
867 {
868 if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] )
869 {
870 yy_act = yy_acclist[yy_lp];
871 {
872 yy_full_match = yy_cp;
873 break;
874 }
875 }
876 --yy_cp;
877 yy_current_state = *--yy_state_ptr;
878 yy_lp = yy_accept[yy_current_state];
879 }
880
881 YY_DO_BEFORE_ACTION;
882
883 if ( yy_act != YY_END_OF_BUFFER )
884 {
885 int yyl;
886 for ( yyl = 0; yyl < yyleng; ++yyl )
887 if ( yytext[yyl] == '\n' )
888 ++yylineno;
889 }
890
891do_action: /* This label is used only to access EOF actions. */
892
893
894 switch ( yy_act )
895 { /* beginning of action switch */
896case 1:
897YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000898#line 182 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000899{ /* Ignore comments */ }
900 YY_BREAK
901case 2:
902YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000903#line 184 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000904{ HandleInclude(yytext); }
905 YY_BREAK
906case 3:
907YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000908#line 185 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000909{ Filelval.StrVal = new std::string(yytext+2, yytext+yyleng-2);
910 return CODEFRAGMENT; }
911 YY_BREAK
912case 4:
913YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000914#line 188 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000915{ return INT; }
916 YY_BREAK
917case 5:
918YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000919#line 189 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000920{ return BIT; }
921 YY_BREAK
922case 6:
923YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000924#line 190 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000925{ return BITS; }
926 YY_BREAK
927case 7:
928YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000929#line 191 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000930{ return STRING; }
931 YY_BREAK
932case 8:
933YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000934#line 192 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000935{ return LIST; }
936 YY_BREAK
937case 9:
938YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000939#line 193 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000940{ return CODE; }
941 YY_BREAK
942case 10:
943YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000944#line 194 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000945{ return DAG; }
946 YY_BREAK
947case 11:
948YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000949#line 196 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000950{ return CLASS; }
951 YY_BREAK
952case 12:
953YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000954#line 197 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000955{ return DEF; }
956 YY_BREAK
957case 13:
958YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000959#line 198 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000960{ return FIELD; }
961 YY_BREAK
962case 14:
963YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000964#line 199 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000965{ return LET; }
966 YY_BREAK
967case 15:
968YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000969#line 200 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000970{ return IN; }
971 YY_BREAK
972case 16:
973YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000974#line 202 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000975{ return SRATOK; }
976 YY_BREAK
977case 17:
978YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000979#line 203 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000980{ return SRLTOK; }
981 YY_BREAK
982case 18:
983YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000984#line 204 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000985{ return SHLTOK; }
986 YY_BREAK
987case 19:
988YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000989#line 207 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000990{ Filelval.StrVal = new std::string(yytext, yytext+yyleng);
991 return ID; }
992 YY_BREAK
993case 20:
994YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +0000995#line 209 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +0000996{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng);
997 return VARNAME; }
998 YY_BREAK
999case 21:
1000YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001001#line 212 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001002{ Filelval.StrVal = new std::string(yytext+1, yytext+yyleng-1);
1003 return STRVAL; }
1004 YY_BREAK
1005case 22:
1006YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001007#line 215 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001008{ Filelval.IntVal = ParseInt(Filetext); return INTVAL; }
1009 YY_BREAK
1010case 23:
1011YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001012#line 217 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001013{ /* Ignore whitespace */ }
1014 YY_BREAK
1015case 24:
1016YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001017#line 220 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001018{ BEGIN(comment); CommentDepth++; }
1019 YY_BREAK
1020case 25:
1021YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001022#line 221 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Chris Lattner46a78002005-09-06 21:23:27 +00001023{} /* eat anything that's not a '*' or '/' */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001024 YY_BREAK
1025case 26:
1026YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001027#line 222 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Chris Lattner46a78002005-09-06 21:23:27 +00001028{} /* eat up '*'s not followed by '/'s */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001029 YY_BREAK
1030case 27:
1031YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001032#line 223 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001033{ ++CommentDepth; }
1034 YY_BREAK
1035case 28:
1036YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001037#line 224 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Chris Lattner46a78002005-09-06 21:23:27 +00001038{} /* eat up /'s not followed by *'s */
Reid Spencer68a24bd2005-08-27 18:50:39 +00001039 YY_BREAK
1040case 29:
1041YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001042#line 225 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001043{ if (!--CommentDepth) { BEGIN(INITIAL); } }
1044 YY_BREAK
1045case YY_STATE_EOF(comment):
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001046#line 226 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001047{ err() << "Unterminated comment!\n"; exit(1); }
1048 YY_BREAK
1049case 30:
1050YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001051#line 228 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001052{ return Filetext[0]; }
1053 YY_BREAK
1054case 31:
1055YY_RULE_SETUP
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001056#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001057YY_FATAL_ERROR( "flex scanner jammed" );
1058 YY_BREAK
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001059#line 1060 "Lexer.cpp"
Reid Spencer68a24bd2005-08-27 18:50:39 +00001060 case YY_STATE_EOF(INITIAL):
1061 yyterminate();
1062
1063 case YY_END_OF_BUFFER:
1064 {
1065 /* Amount of text matched not including the EOB char. */
1066 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1067
1068 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1069 *yy_cp = yy_hold_char;
1070 YY_RESTORE_YY_MORE_OFFSET
1071
1072 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1073 {
1074 /* We're scanning a new file or input source. It's
1075 * possible that this happened because the user
1076 * just pointed yyin at a new source and called
1077 * yylex(). If so, then we have to assure
1078 * consistency between yy_current_buffer and our
1079 * globals. Here is the right place to do so, because
1080 * this is the first action (other than possibly a
1081 * back-up) that will match for the new input source.
1082 */
1083 yy_n_chars = yy_current_buffer->yy_n_chars;
1084 yy_current_buffer->yy_input_file = yyin;
1085 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1086 }
1087
1088 /* Note that here we test for yy_c_buf_p "<=" to the position
1089 * of the first EOB in the buffer, since yy_c_buf_p will
1090 * already have been incremented past the NUL character
1091 * (since all states make transitions on EOB to the
1092 * end-of-buffer state). Contrast this with the test
1093 * in input().
1094 */
1095 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1096 { /* This was really a NUL. */
1097 yy_state_type yy_next_state;
1098
1099 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1100
1101 yy_current_state = yy_get_previous_state();
1102
1103 /* Okay, we're now positioned to make the NUL
1104 * transition. We couldn't have
1105 * yy_get_previous_state() go ahead and do it
1106 * for us because it doesn't know how to deal
1107 * with the possibility of jamming (and we don't
1108 * want to build jamming into it because then it
1109 * will run more slowly).
1110 */
1111
1112 yy_next_state = yy_try_NUL_trans( yy_current_state );
1113
1114 yy_bp = yytext_ptr + YY_MORE_ADJ;
1115
1116 if ( yy_next_state )
1117 {
1118 /* Consume the NUL. */
1119 yy_cp = ++yy_c_buf_p;
1120 yy_current_state = yy_next_state;
1121 goto yy_match;
1122 }
1123
1124 else
1125 {
1126 yy_cp = yy_c_buf_p;
1127 goto yy_find_action;
1128 }
1129 }
1130
1131 else switch ( yy_get_next_buffer() )
1132 {
1133 case EOB_ACT_END_OF_FILE:
1134 {
1135 yy_did_buffer_switch_on_eof = 0;
1136
1137 if ( yywrap() )
1138 {
1139 /* Note: because we've taken care in
1140 * yy_get_next_buffer() to have set up
1141 * yytext, we can now set up
1142 * yy_c_buf_p so that if some total
1143 * hoser (like flex itself) wants to
1144 * call the scanner after we return the
1145 * YY_NULL, it'll still work - another
1146 * YY_NULL will get returned.
1147 */
1148 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1149
1150 yy_act = YY_STATE_EOF(YY_START);
1151 goto do_action;
1152 }
1153
1154 else
1155 {
1156 if ( ! yy_did_buffer_switch_on_eof )
1157 YY_NEW_FILE;
1158 }
1159 break;
1160 }
1161
1162 case EOB_ACT_CONTINUE_SCAN:
1163 yy_c_buf_p =
1164 yytext_ptr + yy_amount_of_matched_text;
1165
1166 yy_current_state = yy_get_previous_state();
1167
1168 yy_cp = yy_c_buf_p;
1169 yy_bp = yytext_ptr + YY_MORE_ADJ;
1170 goto yy_match;
1171
1172 case EOB_ACT_LAST_MATCH:
1173 yy_c_buf_p =
1174 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1175
1176 yy_current_state = yy_get_previous_state();
1177
1178 yy_cp = yy_c_buf_p;
1179 yy_bp = yytext_ptr + YY_MORE_ADJ;
1180 goto yy_find_action;
1181 }
1182 break;
1183 }
1184
1185 default:
1186 YY_FATAL_ERROR(
1187 "fatal flex scanner internal error--no action found" );
1188 } /* end of action switch */
1189 } /* end of scanning one token */
1190 } /* end of yylex */
1191
1192
1193/* yy_get_next_buffer - try to read in a new buffer
1194 *
1195 * Returns a code representing an action:
1196 * EOB_ACT_LAST_MATCH -
1197 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1198 * EOB_ACT_END_OF_FILE - end of file
1199 */
1200
1201static int yy_get_next_buffer()
1202 {
1203 register char *dest = yy_current_buffer->yy_ch_buf;
1204 register char *source = yytext_ptr;
1205 register int number_to_move, i;
1206 int ret_val;
1207
1208 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1209 YY_FATAL_ERROR(
1210 "fatal flex scanner internal error--end of buffer missed" );
1211
1212 if ( yy_current_buffer->yy_fill_buffer == 0 )
1213 { /* Don't try to fill the buffer, so this is an EOF. */
1214 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1215 {
1216 /* We matched a single character, the EOB, so
1217 * treat this as a final EOF.
1218 */
1219 return EOB_ACT_END_OF_FILE;
1220 }
1221
1222 else
1223 {
1224 /* We matched some text prior to the EOB, first
1225 * process it.
1226 */
1227 return EOB_ACT_LAST_MATCH;
1228 }
1229 }
1230
1231 /* Try to read more data. */
1232
1233 /* First move last chars to start of buffer. */
1234 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1235
1236 for ( i = 0; i < number_to_move; ++i )
1237 *(dest++) = *(source++);
1238
1239 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1240 /* don't do the read, it's not guaranteed to return an EOF,
1241 * just force an EOF
1242 */
1243 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1244
1245 else
1246 {
1247 int num_to_read =
1248 yy_current_buffer->yy_buf_size - number_to_move - 1;
1249
1250 while ( num_to_read <= 0 )
1251 { /* Not enough room in the buffer - grow it. */
1252#ifdef YY_USES_REJECT
1253 YY_FATAL_ERROR(
1254"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1255#else
1256
1257 /* just a shorter name for the current buffer */
1258 YY_BUFFER_STATE b = yy_current_buffer;
1259
1260 int yy_c_buf_p_offset =
1261 (int) (yy_c_buf_p - b->yy_ch_buf);
1262
1263 if ( b->yy_is_our_buffer )
1264 {
1265 int new_size = b->yy_buf_size * 2;
1266
1267 if ( new_size <= 0 )
1268 b->yy_buf_size += b->yy_buf_size / 8;
1269 else
1270 b->yy_buf_size *= 2;
1271
1272 b->yy_ch_buf = (char *)
1273 /* Include room in for 2 EOB chars. */
1274 yy_flex_realloc( (void *) b->yy_ch_buf,
1275 b->yy_buf_size + 2 );
1276 }
1277 else
1278 /* Can't grow it, we don't own it. */
1279 b->yy_ch_buf = 0;
1280
1281 if ( ! b->yy_ch_buf )
1282 YY_FATAL_ERROR(
1283 "fatal error - scanner input buffer overflow" );
1284
1285 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1286
1287 num_to_read = yy_current_buffer->yy_buf_size -
1288 number_to_move - 1;
1289#endif
1290 }
1291
1292 if ( num_to_read > YY_READ_BUF_SIZE )
1293 num_to_read = YY_READ_BUF_SIZE;
1294
1295 /* Read in more data. */
1296 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1297 yy_n_chars, num_to_read );
1298
1299 yy_current_buffer->yy_n_chars = yy_n_chars;
1300 }
1301
1302 if ( yy_n_chars == 0 )
1303 {
1304 if ( number_to_move == YY_MORE_ADJ )
1305 {
1306 ret_val = EOB_ACT_END_OF_FILE;
1307 yyrestart( yyin );
1308 }
1309
1310 else
1311 {
1312 ret_val = EOB_ACT_LAST_MATCH;
1313 yy_current_buffer->yy_buffer_status =
1314 YY_BUFFER_EOF_PENDING;
1315 }
1316 }
1317
1318 else
1319 ret_val = EOB_ACT_CONTINUE_SCAN;
1320
1321 yy_n_chars += number_to_move;
1322 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1323 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1324
1325 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1326
1327 return ret_val;
1328 }
1329
1330
1331/* yy_get_previous_state - get the state just before the EOB char was reached */
1332
1333static yy_state_type yy_get_previous_state()
1334 {
1335 register yy_state_type yy_current_state;
1336 register char *yy_cp;
1337
1338 yy_current_state = yy_start;
1339 yy_state_ptr = yy_state_buf;
1340 *yy_state_ptr++ = yy_current_state;
1341
1342 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1343 {
1344 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1345 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1346 {
1347 yy_current_state = (int) yy_def[yy_current_state];
1348 if ( yy_current_state >= 100 )
1349 yy_c = yy_meta[(unsigned int) yy_c];
1350 }
1351 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1352 *yy_state_ptr++ = yy_current_state;
1353 }
1354
1355 return yy_current_state;
1356 }
1357
1358
1359/* yy_try_NUL_trans - try to make a transition on the NUL character
1360 *
1361 * synopsis
1362 * next_state = yy_try_NUL_trans( current_state );
1363 */
1364
1365#ifdef YY_USE_PROTOS
1366static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1367#else
1368static yy_state_type yy_try_NUL_trans( yy_current_state )
1369yy_state_type yy_current_state;
1370#endif
1371 {
1372 register int yy_is_jam;
1373
1374 register YY_CHAR yy_c = 1;
1375 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1376 {
1377 yy_current_state = (int) yy_def[yy_current_state];
1378 if ( yy_current_state >= 100 )
1379 yy_c = yy_meta[(unsigned int) yy_c];
1380 }
1381 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1382 yy_is_jam = (yy_current_state == 99);
1383 if ( ! yy_is_jam )
1384 *yy_state_ptr++ = yy_current_state;
1385
1386 return yy_is_jam ? 0 : yy_current_state;
1387 }
1388
1389
1390#ifndef YY_NO_UNPUT
1391#ifdef YY_USE_PROTOS
1392static inline void yyunput( int c, register char *yy_bp )
1393#else
1394static inline void yyunput( c, yy_bp )
1395int c;
1396register char *yy_bp;
1397#endif
1398 {
1399 register char *yy_cp = yy_c_buf_p;
1400
1401 /* undo effects of setting up yytext */
1402 *yy_cp = yy_hold_char;
1403
1404 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1405 { /* need to shift things up to make room */
1406 /* +2 for EOB chars. */
1407 register int number_to_move = yy_n_chars + 2;
1408 register char *dest = &yy_current_buffer->yy_ch_buf[
1409 yy_current_buffer->yy_buf_size + 2];
1410 register char *source =
1411 &yy_current_buffer->yy_ch_buf[number_to_move];
1412
1413 while ( source > yy_current_buffer->yy_ch_buf )
1414 *--dest = *--source;
1415
1416 yy_cp += (int) (dest - source);
1417 yy_bp += (int) (dest - source);
1418 yy_current_buffer->yy_n_chars =
1419 yy_n_chars = yy_current_buffer->yy_buf_size;
1420
1421 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1422 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1423 }
1424
1425 *--yy_cp = (char) c;
1426
1427 if ( c == '\n' )
1428 --yylineno;
1429
1430 yytext_ptr = yy_bp;
1431 yy_hold_char = *yy_cp;
1432 yy_c_buf_p = yy_cp;
1433 }
1434#endif /* ifndef YY_NO_UNPUT */
1435
1436
Reid Spencer68a24bd2005-08-27 18:50:39 +00001437#ifdef __cplusplus
1438static int yyinput()
1439#else
1440static int input()
1441#endif
1442 {
1443 int c;
1444
1445 *yy_c_buf_p = yy_hold_char;
1446
1447 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1448 {
1449 /* yy_c_buf_p now points to the character we want to return.
1450 * If this occurs *before* the EOB characters, then it's a
1451 * valid NUL; if not, then we've hit the end of the buffer.
1452 */
1453 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1454 /* This was really a NUL. */
1455 *yy_c_buf_p = '\0';
1456
1457 else
1458 { /* need more input */
1459 int offset = yy_c_buf_p - yytext_ptr;
1460 ++yy_c_buf_p;
1461
1462 switch ( yy_get_next_buffer() )
1463 {
1464 case EOB_ACT_LAST_MATCH:
1465 /* This happens because yy_g_n_b()
1466 * sees that we've accumulated a
1467 * token and flags that we need to
1468 * try matching the token before
1469 * proceeding. But for input(),
1470 * there's no matching to consider.
1471 * So convert the EOB_ACT_LAST_MATCH
1472 * to EOB_ACT_END_OF_FILE.
1473 */
1474
1475 /* Reset buffer status. */
1476 yyrestart( yyin );
1477
1478 /* fall through */
1479
1480 case EOB_ACT_END_OF_FILE:
1481 {
1482 if ( yywrap() )
1483 return EOF;
1484
1485 if ( ! yy_did_buffer_switch_on_eof )
1486 YY_NEW_FILE;
1487#ifdef __cplusplus
1488 return yyinput();
1489#else
1490 return input();
1491#endif
1492 }
1493
1494 case EOB_ACT_CONTINUE_SCAN:
1495 yy_c_buf_p = yytext_ptr + offset;
1496 break;
1497 }
1498 }
1499 }
1500
1501 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1502 *yy_c_buf_p = '\0'; /* preserve yytext */
1503 yy_hold_char = *++yy_c_buf_p;
1504
1505 if ( c == '\n' )
1506 ++yylineno;
1507
1508 return c;
1509 }
Chris Lattnere8242b12006-02-14 05:13:13 +00001510
Reid Spencer68a24bd2005-08-27 18:50:39 +00001511
1512#ifdef YY_USE_PROTOS
1513void yyrestart( FILE *input_file )
1514#else
1515void yyrestart( input_file )
1516FILE *input_file;
1517#endif
1518 {
1519 if ( ! yy_current_buffer )
1520 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1521
1522 yy_init_buffer( yy_current_buffer, input_file );
1523 yy_load_buffer_state();
1524 }
1525
1526
1527#ifdef YY_USE_PROTOS
1528void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1529#else
1530void yy_switch_to_buffer( new_buffer )
1531YY_BUFFER_STATE new_buffer;
1532#endif
1533 {
1534 if ( yy_current_buffer == new_buffer )
1535 return;
1536
1537 if ( yy_current_buffer )
1538 {
1539 /* Flush out information for old buffer. */
1540 *yy_c_buf_p = yy_hold_char;
1541 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1542 yy_current_buffer->yy_n_chars = yy_n_chars;
1543 }
1544
1545 yy_current_buffer = new_buffer;
1546 yy_load_buffer_state();
1547
1548 /* We don't actually know whether we did this switch during
1549 * EOF (yywrap()) processing, but the only time this flag
1550 * is looked at is after yywrap() is called, so it's safe
1551 * to go ahead and always set it.
1552 */
1553 yy_did_buffer_switch_on_eof = 1;
1554 }
1555
1556
1557#ifdef YY_USE_PROTOS
1558void yy_load_buffer_state( void )
1559#else
1560void yy_load_buffer_state()
1561#endif
1562 {
1563 yy_n_chars = yy_current_buffer->yy_n_chars;
1564 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1565 yyin = yy_current_buffer->yy_input_file;
1566 yy_hold_char = *yy_c_buf_p;
1567 }
1568
1569
1570#ifdef YY_USE_PROTOS
1571YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1572#else
1573YY_BUFFER_STATE yy_create_buffer( file, size )
1574FILE *file;
1575int size;
1576#endif
1577 {
1578 YY_BUFFER_STATE b;
1579
1580 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1581 if ( ! b )
1582 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1583
1584 b->yy_buf_size = size;
1585
1586 /* yy_ch_buf has to be 2 characters longer than the size given because
1587 * we need to put in 2 end-of-buffer characters.
1588 */
1589 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1590 if ( ! b->yy_ch_buf )
1591 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1592
1593 b->yy_is_our_buffer = 1;
1594
1595 yy_init_buffer( b, file );
1596
1597 return b;
1598 }
1599
1600
1601#ifdef YY_USE_PROTOS
1602void yy_delete_buffer( YY_BUFFER_STATE b )
1603#else
1604void yy_delete_buffer( b )
1605YY_BUFFER_STATE b;
1606#endif
1607 {
1608 if ( ! b )
1609 return;
1610
1611 if ( b == yy_current_buffer )
1612 yy_current_buffer = (YY_BUFFER_STATE) 0;
1613
1614 if ( b->yy_is_our_buffer )
1615 yy_flex_free( (void *) b->yy_ch_buf );
1616
1617 yy_flex_free( (void *) b );
1618 }
1619
1620
Chris Lattnere8242b12006-02-14 05:13:13 +00001621#ifndef YY_ALWAYS_INTERACTIVE
1622#ifndef YY_NEVER_INTERACTIVE
1623extern int isatty YY_PROTO(( int ));
1624#endif
1625#endif
Reid Spencer68a24bd2005-08-27 18:50:39 +00001626
1627#ifdef YY_USE_PROTOS
1628void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1629#else
1630void yy_init_buffer( b, file )
1631YY_BUFFER_STATE b;
1632FILE *file;
1633#endif
1634
1635
1636 {
1637 yy_flush_buffer( b );
1638
1639 b->yy_input_file = file;
1640 b->yy_fill_buffer = 1;
1641
1642#if YY_ALWAYS_INTERACTIVE
1643 b->yy_is_interactive = 1;
1644#else
1645#if YY_NEVER_INTERACTIVE
1646 b->yy_is_interactive = 0;
1647#else
1648 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1649#endif
1650#endif
1651 }
1652
1653
1654#ifdef YY_USE_PROTOS
1655void yy_flush_buffer( YY_BUFFER_STATE b )
1656#else
1657void yy_flush_buffer( b )
1658YY_BUFFER_STATE b;
1659#endif
1660
1661 {
1662 if ( ! b )
1663 return;
1664
1665 b->yy_n_chars = 0;
1666
1667 /* We always need two end-of-buffer characters. The first causes
1668 * a transition to the end-of-buffer state. The second causes
1669 * a jam in that state.
1670 */
1671 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1672 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1673
1674 b->yy_buf_pos = &b->yy_ch_buf[0];
1675
1676 b->yy_at_bol = 1;
1677 b->yy_buffer_status = YY_BUFFER_NEW;
1678
1679 if ( b == yy_current_buffer )
1680 yy_load_buffer_state();
1681 }
1682
1683
1684#ifndef YY_NO_SCAN_BUFFER
1685#ifdef YY_USE_PROTOS
1686YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1687#else
1688YY_BUFFER_STATE yy_scan_buffer( base, size )
1689char *base;
1690yy_size_t size;
1691#endif
1692 {
1693 YY_BUFFER_STATE b;
1694
1695 if ( size < 2 ||
1696 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1697 base[size-1] != YY_END_OF_BUFFER_CHAR )
1698 /* They forgot to leave room for the EOB's. */
1699 return 0;
1700
1701 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1702 if ( ! b )
1703 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1704
1705 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1706 b->yy_buf_pos = b->yy_ch_buf = base;
1707 b->yy_is_our_buffer = 0;
1708 b->yy_input_file = 0;
1709 b->yy_n_chars = b->yy_buf_size;
1710 b->yy_is_interactive = 0;
1711 b->yy_at_bol = 1;
1712 b->yy_fill_buffer = 0;
1713 b->yy_buffer_status = YY_BUFFER_NEW;
1714
1715 yy_switch_to_buffer( b );
1716
1717 return b;
1718 }
1719#endif
1720
1721
1722#ifndef YY_NO_SCAN_STRING
1723#ifdef YY_USE_PROTOS
1724YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1725#else
1726YY_BUFFER_STATE yy_scan_string( yy_str )
1727yyconst char *yy_str;
1728#endif
1729 {
1730 int len;
1731 for ( len = 0; yy_str[len]; ++len )
1732 ;
1733
1734 return yy_scan_bytes( yy_str, len );
1735 }
1736#endif
1737
1738
1739#ifndef YY_NO_SCAN_BYTES
1740#ifdef YY_USE_PROTOS
1741YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1742#else
1743YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1744yyconst char *bytes;
1745int len;
1746#endif
1747 {
1748 YY_BUFFER_STATE b;
1749 char *buf;
1750 yy_size_t n;
1751 int i;
1752
1753 /* Get memory for full buffer, including space for trailing EOB's. */
1754 n = len + 2;
1755 buf = (char *) yy_flex_alloc( n );
1756 if ( ! buf )
1757 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1758
1759 for ( i = 0; i < len; ++i )
1760 buf[i] = bytes[i];
1761
1762 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1763
1764 b = yy_scan_buffer( buf, n );
1765 if ( ! b )
1766 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1767
1768 /* It's okay to grow etc. this buffer, and we should throw it
1769 * away when we're done.
1770 */
1771 b->yy_is_our_buffer = 1;
1772
1773 return b;
1774 }
1775#endif
1776
1777
1778#ifndef YY_NO_PUSH_STATE
1779#ifdef YY_USE_PROTOS
1780static void yy_push_state( int new_state )
1781#else
1782static void yy_push_state( new_state )
1783int new_state;
1784#endif
1785 {
1786 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1787 {
1788 yy_size_t new_size;
1789
1790 yy_start_stack_depth += YY_START_STACK_INCR;
1791 new_size = yy_start_stack_depth * sizeof( int );
1792
1793 if ( ! yy_start_stack )
1794 yy_start_stack = (int *) yy_flex_alloc( new_size );
1795
1796 else
1797 yy_start_stack = (int *) yy_flex_realloc(
1798 (void *) yy_start_stack, new_size );
1799
1800 if ( ! yy_start_stack )
1801 YY_FATAL_ERROR(
1802 "out of memory expanding start-condition stack" );
1803 }
1804
1805 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1806
1807 BEGIN(new_state);
1808 }
1809#endif
1810
1811
1812#ifndef YY_NO_POP_STATE
1813static void yy_pop_state()
1814 {
1815 if ( --yy_start_stack_ptr < 0 )
1816 YY_FATAL_ERROR( "start-condition stack underflow" );
1817
1818 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1819 }
1820#endif
1821
1822
1823#ifndef YY_NO_TOP_STATE
1824static int yy_top_state()
1825 {
1826 return yy_start_stack[yy_start_stack_ptr - 1];
1827 }
1828#endif
1829
1830#ifndef YY_EXIT_FAILURE
1831#define YY_EXIT_FAILURE 2
1832#endif
1833
1834#ifdef YY_USE_PROTOS
1835static void yy_fatal_error( yyconst char msg[] )
1836#else
1837static void yy_fatal_error( msg )
1838char msg[];
1839#endif
1840 {
1841 (void) fprintf( stderr, "%s\n", msg );
1842 exit( YY_EXIT_FAILURE );
1843 }
1844
1845
1846
1847/* Redefine yyless() so it works in section 3 code. */
1848
1849#undef yyless
1850#define yyless(n) \
1851 do \
1852 { \
1853 /* Undo effects of setting up yytext. */ \
1854 yytext[yyleng] = yy_hold_char; \
1855 yy_c_buf_p = yytext + n; \
1856 yy_hold_char = *yy_c_buf_p; \
1857 *yy_c_buf_p = '\0'; \
1858 yyleng = n; \
1859 } \
1860 while ( 0 )
1861
1862
1863/* Internal utility routines. */
1864
1865#ifndef yytext_ptr
1866#ifdef YY_USE_PROTOS
1867static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1868#else
1869static void yy_flex_strncpy( s1, s2, n )
1870char *s1;
1871yyconst char *s2;
1872int n;
1873#endif
1874 {
1875 register int i;
1876 for ( i = 0; i < n; ++i )
1877 s1[i] = s2[i];
1878 }
1879#endif
1880
1881#ifdef YY_NEED_STRLEN
1882#ifdef YY_USE_PROTOS
1883static int yy_flex_strlen( yyconst char *s )
1884#else
1885static int yy_flex_strlen( s )
1886yyconst char *s;
1887#endif
1888 {
1889 register int n;
1890 for ( n = 0; s[n]; ++n )
1891 ;
1892
1893 return n;
1894 }
1895#endif
1896
1897
1898#ifdef YY_USE_PROTOS
1899static void *yy_flex_alloc( yy_size_t size )
1900#else
1901static void *yy_flex_alloc( size )
1902yy_size_t size;
1903#endif
1904 {
1905 return (void *) malloc( size );
1906 }
1907
1908#ifdef YY_USE_PROTOS
1909static inline void *yy_flex_realloc( void *ptr, yy_size_t size )
1910#else
1911static inline void *yy_flex_realloc( ptr, size )
1912void *ptr;
1913yy_size_t size;
1914#endif
1915 {
1916 /* The cast to (char *) in the following accommodates both
1917 * implementations that use char* generic pointers, and those
1918 * that use void* generic pointers. It works with the latter
1919 * because both ANSI C and C++ allow castless assignment from
1920 * any pointer type to void*, and deal with argument conversions
1921 * as though doing an assignment.
1922 */
1923 return (void *) realloc( (char *) ptr, size );
1924 }
1925
1926#ifdef YY_USE_PROTOS
1927static void yy_flex_free( void *ptr )
1928#else
1929static void yy_flex_free( ptr )
1930void *ptr;
1931#endif
1932 {
1933 free( ptr );
1934 }
1935
1936#if YY_MAIN
1937int main()
1938 {
1939 yylex();
1940 return 0;
1941 }
1942#endif
Chris Lattnerc1d6e4e2006-03-03 01:47:37 +00001943#line 230 "/Volumes/ProjectsDisk/cvs/llvm/utils/TableGen/FileLexer.l"
Chris Lattnere8242b12006-02-14 05:13:13 +00001944
Reid Spencer68a24bd2005-08-27 18:50:39 +00001945