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