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