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