Fix some WARNS6 regression that crept up in the last days.
[dragonfly.git] / contrib / gdb-6 / gdb / ada-lex.c
blob1ec9619a873efb1e16e3e317e0d3a882a527a8f5
1 #line 2 "ada-lex.c"
2 /* A lexical scanner generated by flex */
4 /* Scanner skeleton version:
5 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
6 */
8 #define FLEX_SCANNER
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
12 #include <stdio.h>
13 #include <unistd.h>
16 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
17 #ifdef c_plusplus
18 #ifndef __cplusplus
19 #define __cplusplus
20 #endif
21 #endif
24 #ifdef __cplusplus
26 #include <stdlib.h>
28 /* Use prototypes in function declarations. */
29 #define YY_USE_PROTOS
31 /* The "const" storage-class-modifier is valid. */
32 #define YY_USE_CONST
34 #else /* ! __cplusplus */
36 #if __STDC__
38 #define YY_USE_PROTOS
39 #define YY_USE_CONST
41 #endif /* __STDC__ */
42 #endif /* ! __cplusplus */
44 #ifdef __TURBOC__
45 #pragma warn -rch
46 #pragma warn -use
47 #include <io.h>
48 #include <stdlib.h>
49 #define YY_USE_CONST
50 #define YY_USE_PROTOS
51 #endif
53 #ifdef YY_USE_CONST
54 #define yyconst const
55 #else
56 #define yyconst
57 #endif
60 #ifdef YY_USE_PROTOS
61 #define YY_PROTO(proto) proto
62 #else
63 #define YY_PROTO(proto) ()
64 #endif
66 /* Returned upon end-of-file. */
67 #define YY_NULL 0
69 /* Promotes a possibly negative, possibly signed char to an unsigned
70 * integer for use as an array index. If the signed char is negative,
71 * we want to instead treat it as an 8-bit unsigned char, hence the
72 * double cast.
74 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
76 /* Enter a start condition. This macro really ought to take a parameter,
77 * but we do it the disgusting crufty way forced on us by the ()-less
78 * definition of BEGIN.
80 #define BEGIN yy_start = 1 + 2 *
82 /* Translate the current start state into a value that can be later handed
83 * to BEGIN to return to the state. The YYSTATE alias is for lex
84 * compatibility.
86 #define YY_START ((yy_start - 1) / 2)
87 #define YYSTATE YY_START
89 /* Action number for EOF rule of a given start state. */
90 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
92 /* Special action meaning "start processing a new file". */
93 #define YY_NEW_FILE yyrestart( yyin )
95 #define YY_END_OF_BUFFER_CHAR 0
97 /* Size of default input buffer. */
98 #define YY_BUF_SIZE 16384
100 typedef struct yy_buffer_state *YY_BUFFER_STATE;
102 extern int yyleng;
103 extern FILE *yyin, *yyout;
105 #define EOB_ACT_CONTINUE_SCAN 0
106 #define EOB_ACT_END_OF_FILE 1
107 #define EOB_ACT_LAST_MATCH 2
109 /* The funky do-while in the following #define is used to turn the definition
110 * int a single C statement (which needs a semi-colon terminator). This
111 * avoids problems with code like:
113 * if ( condition_holds )
114 * yyless( 5 );
115 * else
116 * do_something_else();
118 * Prior to using the do-while the compiler would get upset at the
119 * "else" because it interpreted the "if" statement as being all
120 * done when it reached the ';' after the yyless() call.
123 /* Return all but the first 'n' matched characters back to the input stream. */
125 #define yyless(n) \
126 do \
128 /* Undo effects of setting up yytext. */ \
129 *yy_cp = yy_hold_char; \
130 YY_RESTORE_YY_MORE_OFFSET \
131 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
132 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
134 while ( 0 )
136 #define unput(c) yyunput( c, yytext_ptr )
138 /* The following is because we cannot portably get our hands on size_t
139 * (without autoconf's help, which isn't available because we want
140 * flex-generated scanners to compile on their own).
142 typedef unsigned int yy_size_t;
145 struct yy_buffer_state
147 FILE *yy_input_file;
149 char *yy_ch_buf; /* input buffer */
150 char *yy_buf_pos; /* current position in input buffer */
152 /* Size of input buffer in bytes, not including room for EOB
153 * characters.
155 yy_size_t yy_buf_size;
157 /* Number of characters read into yy_ch_buf, not including EOB
158 * characters.
160 int yy_n_chars;
162 /* Whether we "own" the buffer - i.e., we know we created it,
163 * and can xrealloc() it to grow it, and should free() it to
164 * delete it.
166 int yy_is_our_buffer;
168 /* Whether this is an "interactive" input source; if so, and
169 * if we're using stdio for input, then we want to use getc()
170 * instead of fread(), to make sure we stop fetching input after
171 * each newline.
173 int yy_is_interactive;
175 /* Whether we're considered to be at the beginning of a line.
176 * If so, '^' rules will be active on the next match, otherwise
177 * not.
179 int yy_at_bol;
181 /* Whether to try to fill the input buffer when we reach the
182 * end of it.
184 int yy_fill_buffer;
186 int yy_buffer_status;
187 #define YY_BUFFER_NEW 0
188 #define YY_BUFFER_NORMAL 1
189 /* When an EOF's been seen but there's still some text to process
190 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
191 * shouldn't try reading from the input source any more. We might
192 * still have a bunch of tokens to match, though, because of
193 * possible backing-up.
195 * When we actually see the EOF, we change the status to "new"
196 * (via yyrestart()), so that the user can continue scanning by
197 * just pointing yyin at a new input file.
199 #define YY_BUFFER_EOF_PENDING 2
202 static YY_BUFFER_STATE yy_current_buffer = 0;
204 /* We provide macros for accessing buffer states in case in the
205 * future we want to put the buffer states in a more general
206 * "scanner state".
208 #define YY_CURRENT_BUFFER yy_current_buffer
211 /* yy_hold_char holds the character lost when yytext is formed. */
212 static char yy_hold_char;
214 static int yy_n_chars; /* number of characters read into yy_ch_buf */
217 int yyleng;
219 /* Points to current character in buffer. */
220 static char *yy_c_buf_p = (char *) 0;
221 static int yy_init = 1; /* whether we need to initialize */
222 static int yy_start = 0; /* start state number */
224 /* Flag which is used to allow yywrap()'s to do buffer switches
225 * instead of setting up a fresh yyin. A bit of a hack ...
227 static int yy_did_buffer_switch_on_eof;
229 void yyrestart YY_PROTO(( FILE *input_file ));
231 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
232 void yy_load_buffer_state YY_PROTO(( void ));
233 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
234 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
235 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
236 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
237 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
239 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
240 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
241 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
243 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
244 static void *yyxrealloc YY_PROTO(( void *, yy_size_t ));
245 static void yy_flex_free YY_PROTO(( void * ));
247 #define yy_new_buffer yy_create_buffer
249 #define yy_set_interactive(is_interactive) \
251 if ( ! yy_current_buffer ) \
252 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
253 yy_current_buffer->yy_is_interactive = is_interactive; \
256 #define yy_set_bol(at_bol) \
258 if ( ! yy_current_buffer ) \
259 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
260 yy_current_buffer->yy_at_bol = at_bol; \
263 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
265 typedef unsigned char YY_CHAR;
266 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
267 typedef int yy_state_type;
268 extern char *yytext;
269 #define yytext_ptr yytext
271 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
272 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
273 static int yy_get_next_buffer YY_PROTO(( void ));
274 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
276 /* Done after the current pattern has been matched and before the
277 * corresponding action - sets up yytext.
279 #define YY_DO_BEFORE_ACTION \
280 yytext_ptr = yy_bp; \
281 yyleng = (int) (yy_cp - yy_bp); \
282 yy_hold_char = *yy_cp; \
283 *yy_cp = '\0'; \
284 yy_c_buf_p = yy_cp;
286 #define YY_NUM_RULES 51
287 #define YY_END_OF_BUFFER 52
288 static yyconst short int yy_accept[182] =
289 { 0,
290 0, 0, 0, 0, 52, 50, 1, 1, 15, 49,
291 39, 50, 41, 42, 39, 40, 39, 39, 39, 4,
292 4, 39, 39, 39, 39, 48, 45, 45, 45, 45,
293 45, 45, 45, 45, 45, 45, 38, 0, 14, 0,
294 49, 0, 0, 0, 0, 0, 0, 0, 33, 2,
295 0, 32, 0, 44, 44, 35, 0, 0, 4, 0,
296 0, 47, 34, 36, 0, 31, 37, 0, 0, 45,
297 0, 45, 45, 45, 45, 16, 20, 45, 45, 45,
298 45, 25, 45, 45, 45, 45, 0, 14, 0, 12,
299 12, 0, 30, 2, 0, 44, 44, 0, 9, 0,
301 3, 7, 0, 45, 0, 0, 0, 45, 17, 18,
302 45, 21, 22, 23, 45, 45, 27, 45, 29, 0,
303 0, 0, 0, 0, 0, 44, 43, 6, 0, 0,
304 9, 0, 3, 0, 0, 0, 0, 0, 0, 0,
305 0, 0, 0, 0, 0, 45, 19, 24, 45, 28,
306 0, 46, 0, 0, 0, 0, 45, 0, 0, 0,
307 0, 0, 0, 0, 45, 0, 0, 5, 11, 0,
308 8, 26, 0, 5, 0, 8, 13, 0, 10, 10,
312 static yyconst int yy_ec[256] =
313 { 0,
314 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
315 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
316 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
317 1, 4, 5, 6, 7, 8, 5, 9, 10, 11,
318 12, 13, 14, 15, 16, 17, 18, 19, 20, 20,
319 20, 20, 20, 20, 20, 20, 20, 21, 22, 23,
320 24, 25, 5, 26, 30, 31, 32, 33, 34, 35,
321 36, 37, 38, 36, 36, 39, 40, 41, 42, 36,
322 36, 43, 44, 45, 46, 36, 47, 48, 36, 36,
323 27, 5, 28, 5, 29, 5, 30, 31, 32, 33,
325 34, 35, 36, 37, 38, 36, 36, 39, 40, 41,
326 42, 36, 36, 43, 44, 45, 46, 36, 47, 48,
327 36, 36, 26, 22, 26, 5, 1, 1, 1, 1,
328 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
332 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
333 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
334 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
336 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
337 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
338 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
341 1, 1, 1, 1, 1
344 static yyconst int yy_meta[49] =
345 { 0,
346 1, 2, 3, 4, 5, 6, 7, 8, 5, 9,
347 5, 5, 5, 5, 5, 5, 10, 5, 11, 11,
348 5, 5, 12, 13, 14, 5, 5, 5, 15, 16,
349 16, 16, 16, 16, 16, 17, 17, 17, 17, 17,
350 17, 17, 17, 17, 17, 17, 17, 17
353 static yyconst short int yy_base[203] =
354 { 0,
355 0, 0, 575, 568, 573, 712, 712, 712, 43, 0,
356 712, 70, 712, 712, 559, 712, 554, 117, 544, 116,
357 122, 29, 543, 541, 541, 712, 52, 150, 20, 91,
358 26, 124, 118, 96, 107, 131, 191, 119, 712, 151,
359 0, 238, 554, 546, 545, 543, 54, 277, 712, 0,
360 324, 712, 0, 0, 495, 712, 0, 46, 323, 155,
361 0, 712, 712, 712, 508, 712, 712, 184, 241, 712,
362 330, 148, 215, 149, 216, 221, 222, 257, 258, 261,
363 262, 223, 224, 298, 263, 315, 522, 525, 346, 357,
364 712, 360, 511, 0, 485, 0, 469, 328, 343, 157,
366 345, 0, 479, 366, 382, 397, 0, 397, 340, 356,
367 378, 367, 385, 387, 392, 401, 393, 405, 410, 490,
368 0, 445, 450, 448, 431, 712, 0, 418, 0, 436,
369 435, 169, 441, 444, 118, 243, 331, 438, 432, 383,
370 375, 361, 362, 347, 357, 455, 443, 444, 445, 446,
371 338, 712, 345, 475, 337, 276, 488, 287, 267, 258,
372 221, 210, 141, 146, 462, 140, 383, 480, 109, 121,
373 482, 466, 42, 493, 359, 495, 514, 410, 500, 507,
374 712, 533, 543, 559, 564, 580, 597, 600, 607, 47,
375 512, 614, 630, 642, 648, 659, 661, 677, 514, 541,
377 684, 695
380 static yyconst short int yy_def[203] =
381 { 0,
382 181, 1, 1, 1, 181, 181, 181, 181, 182, 183,
383 181, 181, 181, 181, 181, 181, 181, 184, 181, 181,
384 181, 181, 185, 181, 181, 181, 186, 186, 28, 28,
385 28, 28, 28, 28, 28, 28, 181, 182, 181, 182,
386 183, 37, 37, 37, 42, 181, 42, 42, 181, 187,
387 184, 181, 188, 189, 189, 181, 190, 181, 181, 181,
388 191, 181, 181, 181, 192, 181, 181, 181, 181, 181,
389 193, 28, 28, 28, 28, 28, 28, 28, 28, 28,
390 28, 28, 28, 28, 28, 28, 48, 194, 181, 181,
391 181, 42, 48, 187, 195, 189, 189, 196, 181, 181,
393 181, 191, 192, 181, 193, 181, 197, 198, 28, 28,
394 28, 28, 28, 28, 28, 28, 28, 28, 28, 181,
395 199, 181, 181, 42, 195, 181, 189, 181, 200, 196,
396 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
397 181, 181, 181, 181, 201, 198, 28, 28, 28, 28,
398 181, 181, 42, 181, 202, 181, 181, 181, 181, 181,
399 181, 181, 181, 201, 28, 42, 181, 181, 181, 202,
400 181, 28, 42, 181, 181, 181, 181, 181, 181, 181,
401 0, 181, 181, 181, 181, 181, 181, 181, 181, 181,
402 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
404 181, 181
407 static yyconst short int yy_nxt[761] =
408 { 0,
409 6, 7, 8, 7, 6, 9, 6, 10, 11, 12,
410 13, 14, 15, 11, 16, 17, 18, 19, 20, 21,
411 22, 11, 23, 24, 25, 26, 11, 11, 27, 28,
412 27, 27, 27, 29, 27, 27, 27, 30, 27, 31,
413 32, 33, 34, 27, 35, 27, 27, 36, 39, 62,
414 72, 177, 63, 68, 68, 69, 72, 98, 75, 92,
415 72, 70, 98, 90, 99, 99, 72, 78, 71, 40,
416 42, 43, 43, 44, 45, 45, 45, 45, 45, 46,
417 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
418 45, 45, 45, 45, 45, 45, 47, 45, 45, 48,
420 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
421 48, 48, 48, 48, 48, 48, 48, 48, 51, 51,
422 51, 72, 57, 157, 39, 76, 72, 169, 57, 84,
423 134, 77, 58, 52, 59, 59, 72, 72, 58, 53,
424 59, 59, 175, 85, 59, 40, 55, 72, 72, 60,
425 59, 68, 68, 69, 72, 60, 88, 79, 72, 70,
426 82, 72, 83, 61, 72, 80, 71, 173, 100, 81,
427 157, 72, 86, 101, 101, 101, 101, 40, 72, 72,
428 73, 110, 156, 134, 156, 68, 68, 68, 72, 72,
429 74, 42, 43, 43, 43, 42, 42, 42, 42, 42,
431 71, 42, 42, 42, 42, 42, 42, 42, 42, 42,
432 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
433 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
434 87, 87, 87, 87, 87, 87, 87, 87, 87, 42,
435 42, 42, 68, 68, 69, 72, 72, 89, 157, 134,
436 70, 72, 72, 72, 72, 72, 72, 71, 109, 111,
437 116, 72, 72, 72, 72, 134, 134, 42, 42, 42,
438 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
439 42, 42, 42, 42, 42, 42, 90, 72, 72, 112,
440 134, 72, 72, 72, 171, 171, 118, 72, 72, 134,
442 115, 72, 72, 72, 113, 114, 93, 93, 93, 93,
443 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
444 93, 93, 93, 93, 93, 51, 51, 51, 72, 57,
445 134, 105, 105, 105, 128, 106, 157, 117, 72, 58,
446 181, 59, 59, 169, 129, 72, 53, 122, 122, 122,
447 166, 59, 107, 55, 134, 72, 60, 119, 122, 122,
448 122, 131, 131, 133, 133, 38, 123, 68, 68, 69,
449 72, 131, 178, 133, 178, 70, 132, 123, 124, 124,
450 72, 157, 71, 105, 105, 105, 72, 106, 163, 124,
451 124, 124, 124, 124, 124, 162, 72, 72, 68, 68,
453 69, 168, 168, 134, 107, 134, 70, 72, 72, 135,
454 134, 147, 134, 71, 136, 72, 161, 72, 72, 137,
455 134, 138, 72, 72, 160, 72, 139, 72, 179, 179,
456 148, 72, 72, 72, 149, 72, 140, 141, 142, 143,
457 72, 72, 128, 157, 144, 150, 122, 122, 122, 157,
458 72, 154, 129, 131, 131, 126, 68, 68, 69, 133,
459 133, 134, 158, 131, 70, 123, 153, 153, 132, 133,
460 152, 71, 159, 72, 72, 72, 72, 153, 153, 153,
461 153, 153, 153, 72, 72, 72, 72, 165, 167, 68,
462 68, 69, 72, 168, 168, 151, 72, 70, 174, 174,
464 176, 176, 72, 104, 71, 172, 72, 127, 174, 126,
465 176, 174, 174, 176, 176, 122, 122, 122, 180, 180,
466 89, 174, 102, 176, 120, 180, 180, 102, 180, 120,
467 120, 89, 104, 97, 123, 180, 38, 38, 38, 38,
468 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
469 41, 155, 91, 41, 90, 90, 155, 41, 41, 41,
470 54, 54, 54, 89, 67, 66, 64, 56, 54, 50,
471 54, 49, 181, 54, 54, 54, 65, 37, 65, 65,
472 65, 72, 72, 72, 37, 181, 181, 181, 72, 72,
473 72, 181, 181, 181, 72, 72, 72, 94, 94, 181,
475 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
476 94, 94, 94, 94, 95, 95, 95, 96, 181, 181,
477 181, 96, 96, 96, 103, 181, 181, 103, 103, 103,
478 103, 108, 108, 108, 181, 108, 181, 181, 181, 181,
479 181, 108, 181, 181, 108, 108, 108, 121, 181, 181,
480 181, 181, 121, 181, 181, 181, 181, 121, 125, 181,
481 181, 125, 125, 125, 125, 130, 181, 181, 130, 130,
482 181, 181, 181, 130, 130, 145, 145, 145, 146, 146,
483 146, 181, 181, 181, 181, 146, 146, 146, 181, 181,
484 181, 146, 146, 146, 164, 181, 181, 164, 164, 164,
486 164, 170, 181, 181, 181, 170, 181, 181, 181, 170,
487 170, 5, 181, 181, 181, 181, 181, 181, 181, 181,
488 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
489 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
490 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
491 181, 181, 181, 181, 181, 181, 181, 181, 181, 181
494 static yyconst short int yy_chk[761] =
495 { 0,
496 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
497 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
498 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
499 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
500 1, 1, 1, 1, 1, 1, 1, 1, 9, 22,
501 29, 173, 22, 27, 27, 27, 31, 190, 29, 47,
502 29, 27, 190, 47, 58, 58, 31, 31, 27, 9,
503 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
504 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
505 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
507 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
508 12, 12, 12, 12, 12, 12, 12, 12, 18, 18,
509 18, 30, 20, 135, 38, 30, 34, 170, 21, 34,
510 135, 30, 20, 18, 20, 20, 34, 35, 21, 18,
511 21, 21, 169, 35, 20, 38, 18, 35, 33, 20,
512 21, 28, 28, 28, 32, 21, 40, 32, 33, 28,
513 33, 36, 33, 20, 32, 32, 28, 166, 60, 32,
514 164, 36, 36, 60, 60, 100, 100, 40, 72, 74,
515 28, 74, 132, 163, 132, 68, 68, 68, 72, 74,
516 28, 37, 37, 37, 37, 37, 37, 37, 37, 37,
518 68, 37, 37, 37, 37, 37, 37, 37, 37, 37,
519 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
520 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
521 37, 37, 37, 37, 37, 37, 37, 37, 37, 42,
522 42, 42, 69, 69, 69, 73, 75, 42, 136, 162,
523 69, 76, 77, 82, 83, 73, 75, 69, 73, 75,
524 83, 76, 77, 82, 83, 161, 136, 42, 42, 42,
525 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
526 42, 42, 42, 42, 42, 42, 48, 78, 79, 78,
527 160, 80, 81, 85, 156, 156, 85, 78, 79, 159,
529 81, 80, 81, 85, 79, 80, 48, 48, 48, 48,
530 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
531 48, 48, 48, 48, 48, 51, 51, 51, 84, 59,
532 158, 71, 71, 71, 98, 71, 137, 84, 84, 59,
533 51, 59, 59, 155, 98, 86, 51, 89, 89, 89,
534 153, 59, 71, 51, 137, 86, 59, 86, 90, 90,
535 90, 99, 99, 101, 101, 151, 89, 104, 104, 104,
536 109, 99, 175, 101, 175, 104, 99, 90, 92, 92,
537 109, 145, 104, 105, 105, 105, 110, 105, 144, 92,
538 92, 92, 92, 92, 92, 143, 110, 112, 108, 108,
540 108, 167, 167, 142, 105, 106, 108, 112, 111, 106,
541 106, 111, 106, 108, 106, 113, 141, 114, 111, 106,
542 106, 106, 115, 117, 140, 113, 106, 114, 178, 178,
543 115, 116, 115, 117, 116, 118, 106, 106, 106, 106,
544 119, 116, 130, 138, 106, 118, 122, 122, 122, 134,
545 119, 128, 130, 131, 131, 125, 146, 146, 146, 133,
546 133, 138, 139, 131, 146, 122, 124, 124, 131, 133,
547 123, 146, 139, 147, 148, 149, 150, 124, 124, 124,
548 124, 124, 124, 147, 148, 149, 150, 149, 154, 157,
549 157, 157, 165, 154, 154, 120, 172, 157, 168, 168,
551 171, 171, 165, 103, 157, 165, 172, 97, 168, 95,
552 171, 174, 174, 176, 176, 177, 177, 177, 179, 179,
553 93, 174, 191, 176, 199, 180, 180, 191, 179, 199,
554 88, 87, 65, 55, 177, 180, 182, 182, 182, 182,
555 182, 182, 182, 182, 182, 182, 182, 182, 182, 182,
556 183, 200, 46, 183, 45, 44, 200, 183, 183, 183,
557 184, 184, 184, 43, 25, 24, 23, 19, 184, 17,
558 184, 15, 5, 184, 184, 184, 185, 4, 185, 185,
559 185, 186, 186, 186, 3, 0, 0, 0, 186, 186,
560 186, 0, 0, 0, 186, 186, 186, 187, 187, 0,
562 187, 187, 187, 187, 187, 187, 187, 187, 187, 187,
563 187, 187, 187, 187, 188, 188, 188, 189, 0, 0,
564 0, 189, 189, 189, 192, 0, 0, 192, 192, 192,
565 192, 193, 193, 193, 0, 193, 0, 0, 0, 0,
566 0, 193, 0, 0, 193, 193, 193, 194, 0, 0,
567 0, 0, 194, 0, 0, 0, 0, 194, 195, 0,
568 0, 195, 195, 195, 195, 196, 0, 0, 196, 196,
569 0, 0, 0, 196, 196, 197, 197, 197, 198, 198,
570 198, 0, 0, 0, 0, 198, 198, 198, 0, 0,
571 0, 198, 198, 198, 201, 0, 0, 201, 201, 201,
573 201, 202, 0, 0, 0, 202, 0, 0, 0, 202,
574 202, 181, 181, 181, 181, 181, 181, 181, 181, 181,
575 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
576 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
577 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
578 181, 181, 181, 181, 181, 181, 181, 181, 181, 181
581 static yy_state_type yy_last_accepting_state;
582 static char *yy_last_accepting_cpos;
584 /* The intent behind this definition is that it'll catch
585 * any uses of REJECT which flex missed.
587 #define REJECT reject_used_but_not_detected
588 #define yymore() yymore_used_but_not_detected
589 #define YY_MORE_ADJ 0
590 #define YY_RESTORE_YY_MORE_OFFSET
591 char *yytext;
592 #line 1 "ada-lex.l"
593 #define INITIAL 0
594 /* FLEX lexer for Ada expressions, for GDB.
595 Copyright (C) 1994, 1997, 1998, 2000, 2001, 2002, 2003, 2007
596 Free Software Foundation, Inc.
598 This file is part of GDB.
600 This program is free software; you can redistribute it and/or modify
601 it under the terms of the GNU General Public License as published by
602 the Free Software Foundation; either version 2 of the License, or
603 (at your option) any later version.
605 This program is distributed in the hope that it will be useful,
606 but WITHOUT ANY WARRANTY; without even the implied warranty of
607 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
608 GNU General Public License for more details.
610 You should have received a copy of the GNU General Public License
611 along with this program; if not, write to the Free Software
612 Foundation, Inc., 51 Franklin Street, Fifth Floor,
613 Boston, MA 02110-1301, USA. */
614 /*----------------------------------------------------------------------*/
615 /* The converted version of this file is to be included in ada-exp.y, */
616 /* the Ada parser for gdb. The function yylex obtains characters from */
617 /* the global pointer lexptr. It returns a syntactic category for */
618 /* each successive token and places a semantic value into yylval */
619 /* (ada-lval), defined by the parser. */
620 #line 46 "ada-lex.l"
622 #define NUMERAL_WIDTH 256
623 #define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
625 /* Temporary staging for numeric literals. */
626 static char numbuf[NUMERAL_WIDTH];
627 static void canonicalizeNumeral (char *s1, const char *);
628 static struct stoken processString (const char*, int);
629 static int processInt (const char *, const char *, const char *);
630 static int processReal (const char *);
631 static struct stoken processId (const char *, int);
632 static int processAttribute (const char *);
633 static int find_dot_all (const char *);
635 #undef YY_DECL
636 #define YY_DECL static int yylex ( void )
638 #undef YY_INPUT
639 #define YY_INPUT(BUF, RESULT, MAX_SIZE) \
640 if ( *lexptr == '\000' ) \
641 (RESULT) = YY_NULL; \
642 else \
644 *(BUF) = *lexptr; \
645 (RESULT) = 1; \
646 lexptr += 1; \
649 static int find_dot_all (const char *);
651 #define BEFORE_QUAL_QUOTE 1
653 #line 654 "ada-lex.c"
655 /* Macros after this point can all be overridden by user definitions in
656 * section 1.
659 #ifndef YY_SKIP_YYWRAP
660 #ifdef __cplusplus
661 extern "C" int yywrap YY_PROTO(( void ));
662 #else
663 extern int yywrap YY_PROTO(( void ));
664 #endif
665 #endif
667 #ifndef YY_NO_UNPUT
668 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
669 #endif
671 #ifndef yytext_ptr
672 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
673 #endif
675 #ifdef YY_NEED_STRLEN
676 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
677 #endif
679 #ifndef YY_NO_INPUT
680 #ifdef __cplusplus
681 static int yyinput YY_PROTO(( void ));
682 #else
683 static int input YY_PROTO(( void ));
684 #endif
685 #endif
687 #if YY_STACK_USED
688 static int yy_start_stack_ptr = 0;
689 static int yy_start_stack_depth = 0;
690 static int *yy_start_stack = 0;
691 #ifndef YY_NO_PUSH_STATE
692 static void yy_push_state YY_PROTO(( int new_state ));
693 #endif
694 #ifndef YY_NO_POP_STATE
695 static void yy_pop_state YY_PROTO(( void ));
696 #endif
697 #ifndef YY_NO_TOP_STATE
698 static int yy_top_state YY_PROTO(( void ));
699 #endif
701 #else
702 #define YY_NO_PUSH_STATE 1
703 #define YY_NO_POP_STATE 1
704 #define YY_NO_TOP_STATE 1
705 #endif
707 #ifdef YY_MALLOC_DECL
708 YY_MALLOC_DECL
709 #else
710 #if __STDC__
711 #ifndef __cplusplus
712 #include <stdlib.h>
713 #endif
714 #else
715 /* Just try to get by without declaring the routines. This will fail
716 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
717 * or sizeof(void*) != sizeof(int).
719 #endif
720 #endif
722 /* Amount of stuff to slurp up with each read. */
723 #ifndef YY_READ_BUF_SIZE
724 #define YY_READ_BUF_SIZE 8192
725 #endif
727 /* Copy whatever the last rule matched to the standard output. */
729 #ifndef ECHO
730 /* This used to be an fputs(), but since the string might contain NUL's,
731 * we now use fwrite().
733 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
734 #endif
736 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
737 * is returned in "result".
739 #ifndef YY_INPUT
740 #define YY_INPUT(buf,result,max_size) \
741 if ( yy_current_buffer->yy_is_interactive ) \
743 int c = '*', n; \
744 for ( n = 0; n < max_size && \
745 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
746 buf[n] = (char) c; \
747 if ( c == '\n' ) \
748 buf[n++] = (char) c; \
749 if ( c == EOF && ferror( yyin ) ) \
750 YY_FATAL_ERROR( "input in flex scanner failed" ); \
751 result = n; \
753 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
754 && ferror( yyin ) ) \
755 YY_FATAL_ERROR( "input in flex scanner failed" );
756 #endif
758 /* No semi-colon after return; correct usage is to write "yyterminate();" -
759 * we don't want an extra ';' after the "return" because that will cause
760 * some compilers to complain about unreachable statements.
762 #ifndef yyterminate
763 #define yyterminate() return YY_NULL
764 #endif
766 /* Number of entries by which start-condition stack grows. */
767 #ifndef YY_START_STACK_INCR
768 #define YY_START_STACK_INCR 25
769 #endif
771 /* Report a fatal error. */
772 #ifndef YY_FATAL_ERROR
773 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
774 #endif
776 /* Default declaration of generated scanner - a define so the user can
777 * easily add parameters.
779 #ifndef YY_DECL
780 #define YY_DECL int yylex YY_PROTO(( void ))
781 #endif
783 /* Code executed at the beginning of each rule, after yytext and yyleng
784 * have been set up.
786 #ifndef YY_USER_ACTION
787 #define YY_USER_ACTION
788 #endif
790 /* Code executed at the end of each rule. */
791 #ifndef YY_BREAK
792 #define YY_BREAK break;
793 #endif
795 #define YY_RULE_SETUP \
796 YY_USER_ACTION
798 YY_DECL
800 register yy_state_type yy_current_state;
801 register char *yy_cp = NULL, *yy_bp = NULL;
802 register int yy_act;
804 #line 82 "ada-lex.l"
807 #line 808 "ada-lex.c"
809 if ( yy_init )
811 yy_init = 0;
813 #ifdef YY_USER_INIT
814 YY_USER_INIT;
815 #endif
817 if ( ! yy_start )
818 yy_start = 1; /* first start state */
820 if ( ! yyin )
821 yyin = stdin;
823 if ( ! yyout )
824 yyout = stdout;
826 if ( ! yy_current_buffer )
827 yy_current_buffer =
828 yy_create_buffer( yyin, YY_BUF_SIZE );
830 yy_load_buffer_state();
833 while ( 1 ) /* loops until end-of-file is reached */
835 yy_cp = yy_c_buf_p;
837 /* Support of yytext. */
838 *yy_cp = yy_hold_char;
840 /* yy_bp points to the position in yy_ch_buf of the start of
841 * the current run.
843 yy_bp = yy_cp;
845 yy_current_state = yy_start;
846 yy_match:
849 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
850 if ( yy_accept[yy_current_state] )
852 yy_last_accepting_state = yy_current_state;
853 yy_last_accepting_cpos = yy_cp;
855 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
857 yy_current_state = (int) yy_def[yy_current_state];
858 if ( yy_current_state >= 182 )
859 yy_c = yy_meta[(unsigned int) yy_c];
861 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
862 ++yy_cp;
864 while ( yy_base[yy_current_state] != 712 );
866 yy_find_action:
867 yy_act = yy_accept[yy_current_state];
868 if ( yy_act == 0 )
869 { /* have to back up */
870 yy_cp = yy_last_accepting_cpos;
871 yy_current_state = yy_last_accepting_state;
872 yy_act = yy_accept[yy_current_state];
875 YY_DO_BEFORE_ACTION;
878 do_action: /* This label is used only to access EOF actions. */
881 switch ( yy_act )
882 { /* beginning of action switch */
883 case 0: /* must back up */
884 /* undo the effects of YY_DO_BEFORE_ACTION */
885 *yy_cp = yy_hold_char;
886 yy_cp = yy_last_accepting_cpos;
887 yy_current_state = yy_last_accepting_state;
888 goto yy_find_action;
890 case 1:
891 YY_RULE_SETUP
892 #line 84 "ada-lex.l"
894 YY_BREAK
895 case 2:
896 YY_RULE_SETUP
897 #line 86 "ada-lex.l"
898 { yyterminate(); }
899 YY_BREAK
900 case 3:
901 YY_RULE_SETUP
902 #line 88 "ada-lex.l"
904 canonicalizeNumeral (numbuf, yytext);
905 return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1);
907 YY_BREAK
908 case 4:
909 YY_RULE_SETUP
910 #line 93 "ada-lex.l"
912 canonicalizeNumeral (numbuf, yytext);
913 return processInt (NULL, numbuf, NULL);
915 YY_BREAK
916 case 5:
917 YY_RULE_SETUP
918 #line 98 "ada-lex.l"
920 canonicalizeNumeral (numbuf, yytext);
921 return processInt (numbuf,
922 strchr (numbuf, '#') + 1,
923 strrchr(numbuf, '#') + 1);
925 YY_BREAK
926 case 6:
927 YY_RULE_SETUP
928 #line 105 "ada-lex.l"
930 canonicalizeNumeral (numbuf, yytext);
931 return processInt (numbuf, strchr (numbuf, '#') + 1, NULL);
933 YY_BREAK
934 case 7:
935 YY_RULE_SETUP
936 #line 110 "ada-lex.l"
938 canonicalizeNumeral (numbuf, yytext+2);
939 return processInt ("16#", numbuf, NULL);
941 YY_BREAK
942 case 8:
943 YY_RULE_SETUP
944 #line 116 "ada-lex.l"
946 canonicalizeNumeral (numbuf, yytext);
947 return processReal (numbuf);
949 YY_BREAK
950 case 9:
951 YY_RULE_SETUP
952 #line 121 "ada-lex.l"
954 canonicalizeNumeral (numbuf, yytext);
955 return processReal (numbuf);
957 YY_BREAK
958 case 10:
959 YY_RULE_SETUP
960 #line 126 "ada-lex.l"
962 error (_("Based real literals not implemented yet."));
964 YY_BREAK
965 case 11:
966 YY_RULE_SETUP
967 #line 130 "ada-lex.l"
969 error (_("Based real literals not implemented yet."));
971 YY_BREAK
972 case 12:
973 YY_RULE_SETUP
974 #line 134 "ada-lex.l"
976 yylval.typed_val.type = type_char ();
977 yylval.typed_val.val = yytext[1];
978 return CHARLIT;
980 YY_BREAK
981 case 13:
982 YY_RULE_SETUP
983 #line 140 "ada-lex.l"
985 int v;
986 yylval.typed_val.type = type_char ();
987 sscanf (yytext+3, "%2x", &v);
988 yylval.typed_val.val = v;
989 return CHARLIT;
991 YY_BREAK
992 case 14:
993 YY_RULE_SETUP
994 #line 148 "ada-lex.l"
996 yylval.sval = processString (yytext+1, yyleng-2);
997 return STRING;
999 YY_BREAK
1000 case 15:
1001 YY_RULE_SETUP
1002 #line 153 "ada-lex.l"
1004 error (_("ill-formed or non-terminated string literal"));
1006 YY_BREAK
1007 case 16:
1008 YY_RULE_SETUP
1009 #line 158 "ada-lex.l"
1011 while (*lexptr != 'i' && *lexptr != 'I')
1012 lexptr -= 1;
1013 yyrestart(NULL);
1014 return 0;
1016 YY_BREAK
1017 /* ADA KEYWORDS */
1018 case 17:
1019 YY_RULE_SETUP
1020 #line 167 "ada-lex.l"
1021 { return ABS; }
1022 YY_BREAK
1023 case 18:
1024 YY_RULE_SETUP
1025 #line 168 "ada-lex.l"
1026 { return _AND_; }
1027 YY_BREAK
1028 case 19:
1029 YY_RULE_SETUP
1030 #line 169 "ada-lex.l"
1031 { return ELSE; }
1032 YY_BREAK
1033 case 20:
1034 YY_RULE_SETUP
1035 #line 170 "ada-lex.l"
1036 { return IN; }
1037 YY_BREAK
1038 case 21:
1039 YY_RULE_SETUP
1040 #line 171 "ada-lex.l"
1041 { return MOD; }
1042 YY_BREAK
1043 case 22:
1044 YY_RULE_SETUP
1045 #line 172 "ada-lex.l"
1046 { return NEW; }
1047 YY_BREAK
1048 case 23:
1049 YY_RULE_SETUP
1050 #line 173 "ada-lex.l"
1051 { return NOT; }
1052 YY_BREAK
1053 case 24:
1054 YY_RULE_SETUP
1055 #line 174 "ada-lex.l"
1056 { return NULL_PTR; }
1057 YY_BREAK
1058 case 25:
1059 YY_RULE_SETUP
1060 #line 175 "ada-lex.l"
1061 { return OR; }
1062 YY_BREAK
1063 case 26:
1064 YY_RULE_SETUP
1065 #line 176 "ada-lex.l"
1066 { return OTHERS; }
1067 YY_BREAK
1068 case 27:
1069 YY_RULE_SETUP
1070 #line 177 "ada-lex.l"
1071 { return REM; }
1072 YY_BREAK
1073 case 28:
1074 YY_RULE_SETUP
1075 #line 178 "ada-lex.l"
1076 { return THEN; }
1077 YY_BREAK
1078 case 29:
1079 YY_RULE_SETUP
1080 #line 179 "ada-lex.l"
1081 { return XOR; }
1082 YY_BREAK
1083 /* ATTRIBUTES */
1084 case 30:
1085 YY_RULE_SETUP
1086 #line 183 "ada-lex.l"
1087 { return processAttribute (yytext+1); }
1088 YY_BREAK
1089 /* PUNCTUATION */
1090 case 31:
1091 YY_RULE_SETUP
1092 #line 187 "ada-lex.l"
1093 { return ARROW; }
1094 YY_BREAK
1095 case 32:
1096 YY_RULE_SETUP
1097 #line 188 "ada-lex.l"
1098 { return DOTDOT; }
1099 YY_BREAK
1100 case 33:
1101 YY_RULE_SETUP
1102 #line 189 "ada-lex.l"
1103 { return STARSTAR; }
1104 YY_BREAK
1105 case 34:
1106 YY_RULE_SETUP
1107 #line 190 "ada-lex.l"
1108 { return ASSIGN; }
1109 YY_BREAK
1110 case 35:
1111 YY_RULE_SETUP
1112 #line 191 "ada-lex.l"
1113 { return NOTEQUAL; }
1114 YY_BREAK
1115 case 36:
1116 YY_RULE_SETUP
1117 #line 192 "ada-lex.l"
1118 { return LEQ; }
1119 YY_BREAK
1120 case 37:
1121 YY_RULE_SETUP
1122 #line 193 "ada-lex.l"
1123 { return GEQ; }
1124 YY_BREAK
1125 case 38:
1126 YY_RULE_SETUP
1127 #line 195 "ada-lex.l"
1128 { BEGIN INITIAL; return '\''; }
1129 YY_BREAK
1130 case 39:
1131 YY_RULE_SETUP
1132 #line 197 "ada-lex.l"
1133 { return yytext[0]; }
1134 YY_BREAK
1135 case 40:
1136 YY_RULE_SETUP
1137 #line 199 "ada-lex.l"
1138 { if (paren_depth == 0 && comma_terminates)
1140 lexptr -= 1;
1141 yyrestart(NULL);
1142 return 0;
1144 else
1145 return ',';
1147 YY_BREAK
1148 case 41:
1149 YY_RULE_SETUP
1150 #line 209 "ada-lex.l"
1151 { paren_depth += 1; return '('; }
1152 YY_BREAK
1153 case 42:
1154 YY_RULE_SETUP
1155 #line 210 "ada-lex.l"
1156 { if (paren_depth == 0)
1158 lexptr -= 1;
1159 yyrestart(NULL);
1160 return 0;
1162 else
1164 paren_depth -= 1;
1165 return ')';
1168 YY_BREAK
1169 case 43:
1170 YY_RULE_SETUP
1171 #line 223 "ada-lex.l"
1172 { return DOT_ALL; }
1173 YY_BREAK
1174 case 44:
1175 YY_RULE_SETUP
1176 #line 225 "ada-lex.l"
1178 yylval.sval = processId (yytext+1, yyleng-1);
1179 return DOT_ID;
1181 YY_BREAK
1182 case 45:
1183 YY_RULE_SETUP
1184 #line 230 "ada-lex.l"
1186 int all_posn = find_dot_all (yytext);
1188 if (all_posn == -1 && yytext[yyleng-1] == '\'')
1190 BEGIN BEFORE_QUAL_QUOTE;
1191 yyless (yyleng-1);
1193 else if (all_posn >= 0)
1194 yyless (all_posn);
1195 yylval.sval = processId (yytext, yyleng);
1196 return NAME;
1198 YY_BREAK
1199 /* GDB EXPRESSION CONSTRUCTS */
1200 case 46:
1201 YY_RULE_SETUP
1202 #line 247 "ada-lex.l"
1204 yyless (yyleng - 2);
1205 yylval.sval = processId (yytext, yyleng);
1206 return NAME;
1208 YY_BREAK
1209 case 47:
1210 YY_RULE_SETUP
1211 #line 253 "ada-lex.l"
1212 { return COLONCOLON; }
1213 YY_BREAK
1214 case 48:
1215 YY_RULE_SETUP
1216 #line 255 "ada-lex.l"
1217 { return yytext[0]; }
1218 YY_BREAK
1219 /* REGISTERS AND GDB CONVENIENCE VARIABLES */
1220 case 49:
1221 YY_RULE_SETUP
1222 #line 259 "ada-lex.l"
1224 yylval.sval.ptr = yytext;
1225 yylval.sval.length = yyleng;
1226 return SPECIAL_VARIABLE;
1228 YY_BREAK
1229 /* CATCH-ALL ERROR CASE */
1230 case 50:
1231 YY_RULE_SETUP
1232 #line 267 "ada-lex.l"
1233 { error (_("Invalid character '%s' in expression."), yytext); }
1234 YY_BREAK
1235 case 51:
1236 YY_RULE_SETUP
1237 #line 268 "ada-lex.l"
1238 YY_FATAL_ERROR( "flex scanner jammed" );
1239 YY_BREAK
1240 #line 1241 "ada-lex.c"
1241 case YY_STATE_EOF(INITIAL):
1242 case YY_STATE_EOF(BEFORE_QUAL_QUOTE):
1243 yyterminate();
1245 case YY_END_OF_BUFFER:
1247 /* Amount of text matched not including the EOB char. */
1248 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1250 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1251 *yy_cp = yy_hold_char;
1252 YY_RESTORE_YY_MORE_OFFSET
1254 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1256 /* We're scanning a new file or input source. It's
1257 * possible that this happened because the user
1258 * just pointed yyin at a new source and called
1259 * yylex(). If so, then we have to assure
1260 * consistency between yy_current_buffer and our
1261 * globals. Here is the right place to do so, because
1262 * this is the first action (other than possibly a
1263 * back-up) that will match for the new input source.
1265 yy_n_chars = yy_current_buffer->yy_n_chars;
1266 yy_current_buffer->yy_input_file = yyin;
1267 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1270 /* Note that here we test for yy_c_buf_p "<=" to the position
1271 * of the first EOB in the buffer, since yy_c_buf_p will
1272 * already have been incremented past the NUL character
1273 * (since all states make transitions on EOB to the
1274 * end-of-buffer state). Contrast this with the test
1275 * in input().
1277 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1278 { /* This was really a NUL. */
1279 yy_state_type yy_next_state;
1281 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1283 yy_current_state = yy_get_previous_state();
1285 /* Okay, we're now positioned to make the NUL
1286 * transition. We couldn't have
1287 * yy_get_previous_state() go ahead and do it
1288 * for us because it doesn't know how to deal
1289 * with the possibility of jamming (and we don't
1290 * want to build jamming into it because then it
1291 * will run more slowly).
1294 yy_next_state = yy_try_NUL_trans( yy_current_state );
1296 yy_bp = yytext_ptr + YY_MORE_ADJ;
1298 if ( yy_next_state )
1300 /* Consume the NUL. */
1301 yy_cp = ++yy_c_buf_p;
1302 yy_current_state = yy_next_state;
1303 goto yy_match;
1306 else
1308 yy_cp = yy_c_buf_p;
1309 goto yy_find_action;
1313 else switch ( yy_get_next_buffer() )
1315 case EOB_ACT_END_OF_FILE:
1317 yy_did_buffer_switch_on_eof = 0;
1319 if ( yywrap() )
1321 /* Note: because we've taken care in
1322 * yy_get_next_buffer() to have set up
1323 * yytext, we can now set up
1324 * yy_c_buf_p so that if some total
1325 * hoser (like flex itself) wants to
1326 * call the scanner after we return the
1327 * YY_NULL, it'll still work - another
1328 * YY_NULL will get returned.
1330 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1332 yy_act = YY_STATE_EOF(YY_START);
1333 goto do_action;
1336 else
1338 if ( ! yy_did_buffer_switch_on_eof )
1339 YY_NEW_FILE;
1341 break;
1344 case EOB_ACT_CONTINUE_SCAN:
1345 yy_c_buf_p =
1346 yytext_ptr + yy_amount_of_matched_text;
1348 yy_current_state = yy_get_previous_state();
1350 yy_cp = yy_c_buf_p;
1351 yy_bp = yytext_ptr + YY_MORE_ADJ;
1352 goto yy_match;
1354 case EOB_ACT_LAST_MATCH:
1355 yy_c_buf_p =
1356 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1358 yy_current_state = yy_get_previous_state();
1360 yy_cp = yy_c_buf_p;
1361 yy_bp = yytext_ptr + YY_MORE_ADJ;
1362 goto yy_find_action;
1364 break;
1367 default:
1368 YY_FATAL_ERROR(
1369 "fatal flex scanner internal error--no action found" );
1370 } /* end of action switch */
1371 } /* end of scanning one token */
1372 } /* end of yylex */
1375 /* yy_get_next_buffer - try to read in a new buffer
1377 * Returns a code representing an action:
1378 * EOB_ACT_LAST_MATCH -
1379 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1380 * EOB_ACT_END_OF_FILE - end of file
1383 static int yy_get_next_buffer()
1385 register char *dest = yy_current_buffer->yy_ch_buf;
1386 register char *source = yytext_ptr;
1387 register int number_to_move, i;
1388 int ret_val;
1390 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1391 YY_FATAL_ERROR(
1392 "fatal flex scanner internal error--end of buffer missed" );
1394 if ( yy_current_buffer->yy_fill_buffer == 0 )
1395 { /* Don't try to fill the buffer, so this is an EOF. */
1396 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1398 /* We matched a single character, the EOB, so
1399 * treat this as a final EOF.
1401 return EOB_ACT_END_OF_FILE;
1404 else
1406 /* We matched some text prior to the EOB, first
1407 * process it.
1409 return EOB_ACT_LAST_MATCH;
1413 /* Try to read more data. */
1415 /* First move last chars to start of buffer. */
1416 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1418 for ( i = 0; i < number_to_move; ++i )
1419 *(dest++) = *(source++);
1421 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1422 /* don't do the read, it's not guaranteed to return an EOF,
1423 * just force an EOF
1425 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1427 else
1429 int num_to_read =
1430 yy_current_buffer->yy_buf_size - number_to_move - 1;
1432 while ( num_to_read <= 0 )
1433 { /* Not enough room in the buffer - grow it. */
1434 #ifdef YY_USES_REJECT
1435 YY_FATAL_ERROR(
1436 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1437 #else
1439 /* just a shorter name for the current buffer */
1440 YY_BUFFER_STATE b = yy_current_buffer;
1442 int yy_c_buf_p_offset =
1443 (int) (yy_c_buf_p - b->yy_ch_buf);
1445 if ( b->yy_is_our_buffer )
1447 int new_size = b->yy_buf_size * 2;
1449 if ( new_size <= 0 )
1450 b->yy_buf_size += b->yy_buf_size / 8;
1451 else
1452 b->yy_buf_size *= 2;
1454 b->yy_ch_buf = (char *)
1455 /* Include room in for 2 EOB chars. */
1456 yyxrealloc( (void *) b->yy_ch_buf,
1457 b->yy_buf_size + 2 );
1459 else
1460 /* Can't grow it, we don't own it. */
1461 b->yy_ch_buf = 0;
1463 if ( ! b->yy_ch_buf )
1464 YY_FATAL_ERROR(
1465 "fatal error - scanner input buffer overflow" );
1467 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1469 num_to_read = yy_current_buffer->yy_buf_size -
1470 number_to_move - 1;
1471 #endif
1474 if ( num_to_read > YY_READ_BUF_SIZE )
1475 num_to_read = YY_READ_BUF_SIZE;
1477 /* Read in more data. */
1478 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1479 yy_n_chars, num_to_read );
1481 yy_current_buffer->yy_n_chars = yy_n_chars;
1484 if ( yy_n_chars == 0 )
1486 if ( number_to_move == YY_MORE_ADJ )
1488 ret_val = EOB_ACT_END_OF_FILE;
1489 yyrestart( yyin );
1492 else
1494 ret_val = EOB_ACT_LAST_MATCH;
1495 yy_current_buffer->yy_buffer_status =
1496 YY_BUFFER_EOF_PENDING;
1500 else
1501 ret_val = EOB_ACT_CONTINUE_SCAN;
1503 yy_n_chars += number_to_move;
1504 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1505 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1507 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1509 return ret_val;
1513 /* yy_get_previous_state - get the state just before the EOB char was reached */
1515 static yy_state_type yy_get_previous_state()
1517 register yy_state_type yy_current_state;
1518 register char *yy_cp;
1520 yy_current_state = yy_start;
1522 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1524 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1525 if ( yy_accept[yy_current_state] )
1527 yy_last_accepting_state = yy_current_state;
1528 yy_last_accepting_cpos = yy_cp;
1530 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1532 yy_current_state = (int) yy_def[yy_current_state];
1533 if ( yy_current_state >= 182 )
1534 yy_c = yy_meta[(unsigned int) yy_c];
1536 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1539 return yy_current_state;
1543 /* yy_try_NUL_trans - try to make a transition on the NUL character
1545 * synopsis
1546 * next_state = yy_try_NUL_trans( current_state );
1549 #ifdef YY_USE_PROTOS
1550 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1551 #else
1552 static yy_state_type yy_try_NUL_trans( yy_current_state )
1553 yy_state_type yy_current_state;
1554 #endif
1556 register int yy_is_jam;
1557 register char *yy_cp = yy_c_buf_p;
1559 register YY_CHAR yy_c = 1;
1560 if ( yy_accept[yy_current_state] )
1562 yy_last_accepting_state = yy_current_state;
1563 yy_last_accepting_cpos = yy_cp;
1565 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1567 yy_current_state = (int) yy_def[yy_current_state];
1568 if ( yy_current_state >= 182 )
1569 yy_c = yy_meta[(unsigned int) yy_c];
1571 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1572 yy_is_jam = (yy_current_state == 181);
1574 return yy_is_jam ? 0 : yy_current_state;
1578 #ifndef YY_NO_UNPUT
1579 #ifdef YY_USE_PROTOS
1580 static void yyunput( int c, register char *yy_bp )
1581 #else
1582 static void yyunput( c, yy_bp )
1583 int c;
1584 register char *yy_bp;
1585 #endif
1587 register char *yy_cp = yy_c_buf_p;
1589 /* undo effects of setting up yytext */
1590 *yy_cp = yy_hold_char;
1592 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1593 { /* need to shift things up to make room */
1594 /* +2 for EOB chars. */
1595 register int number_to_move = yy_n_chars + 2;
1596 register char *dest = &yy_current_buffer->yy_ch_buf[
1597 yy_current_buffer->yy_buf_size + 2];
1598 register char *source =
1599 &yy_current_buffer->yy_ch_buf[number_to_move];
1601 while ( source > yy_current_buffer->yy_ch_buf )
1602 *--dest = *--source;
1604 yy_cp += (int) (dest - source);
1605 yy_bp += (int) (dest - source);
1606 yy_current_buffer->yy_n_chars =
1607 yy_n_chars = yy_current_buffer->yy_buf_size;
1609 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1610 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1613 *--yy_cp = (char) c;
1616 yytext_ptr = yy_bp;
1617 yy_hold_char = *yy_cp;
1618 yy_c_buf_p = yy_cp;
1620 #endif /* ifndef YY_NO_UNPUT */
1623 #ifndef YY_NO_INPUT
1624 #ifdef __cplusplus
1625 static int yyinput()
1626 #else
1627 static int input()
1628 #endif
1630 int c;
1632 *yy_c_buf_p = yy_hold_char;
1634 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1636 /* yy_c_buf_p now points to the character we want to return.
1637 * If this occurs *before* the EOB characters, then it's a
1638 * valid NUL; if not, then we've hit the end of the buffer.
1640 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1641 /* This was really a NUL. */
1642 *yy_c_buf_p = '\0';
1644 else
1645 { /* need more input */
1646 int offset = yy_c_buf_p - yytext_ptr;
1647 ++yy_c_buf_p;
1649 switch ( yy_get_next_buffer() )
1651 case EOB_ACT_LAST_MATCH:
1652 /* This happens because yy_g_n_b()
1653 * sees that we've accumulated a
1654 * token and flags that we need to
1655 * try matching the token before
1656 * proceeding. But for input(),
1657 * there's no matching to consider.
1658 * So convert the EOB_ACT_LAST_MATCH
1659 * to EOB_ACT_END_OF_FILE.
1662 /* Reset buffer status. */
1663 yyrestart( yyin );
1665 /* fall through */
1667 case EOB_ACT_END_OF_FILE:
1669 if ( yywrap() )
1670 return EOF;
1672 if ( ! yy_did_buffer_switch_on_eof )
1673 YY_NEW_FILE;
1674 #ifdef __cplusplus
1675 return yyinput();
1676 #else
1677 return input();
1678 #endif
1681 case EOB_ACT_CONTINUE_SCAN:
1682 yy_c_buf_p = yytext_ptr + offset;
1683 break;
1688 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1689 *yy_c_buf_p = '\0'; /* preserve yytext */
1690 yy_hold_char = *++yy_c_buf_p;
1693 return c;
1695 #endif /* YY_NO_INPUT */
1697 #ifdef YY_USE_PROTOS
1698 void yyrestart( FILE *input_file )
1699 #else
1700 void yyrestart( input_file )
1701 FILE *input_file;
1702 #endif
1704 if ( ! yy_current_buffer )
1705 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1707 yy_init_buffer( yy_current_buffer, input_file );
1708 yy_load_buffer_state();
1712 #ifdef YY_USE_PROTOS
1713 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1714 #else
1715 void yy_switch_to_buffer( new_buffer )
1716 YY_BUFFER_STATE new_buffer;
1717 #endif
1719 if ( yy_current_buffer == new_buffer )
1720 return;
1722 if ( yy_current_buffer )
1724 /* Flush out information for old buffer. */
1725 *yy_c_buf_p = yy_hold_char;
1726 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1727 yy_current_buffer->yy_n_chars = yy_n_chars;
1730 yy_current_buffer = new_buffer;
1731 yy_load_buffer_state();
1733 /* We don't actually know whether we did this switch during
1734 * EOF (yywrap()) processing, but the only time this flag
1735 * is looked at is after yywrap() is called, so it's safe
1736 * to go ahead and always set it.
1738 yy_did_buffer_switch_on_eof = 1;
1742 #ifdef YY_USE_PROTOS
1743 void yy_load_buffer_state( void )
1744 #else
1745 void yy_load_buffer_state()
1746 #endif
1748 yy_n_chars = yy_current_buffer->yy_n_chars;
1749 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1750 yyin = yy_current_buffer->yy_input_file;
1751 yy_hold_char = *yy_c_buf_p;
1755 #ifdef YY_USE_PROTOS
1756 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1757 #else
1758 YY_BUFFER_STATE yy_create_buffer( file, size )
1759 FILE *file;
1760 int size;
1761 #endif
1763 YY_BUFFER_STATE b;
1765 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1766 if ( ! b )
1767 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1769 b->yy_buf_size = size;
1771 /* yy_ch_buf has to be 2 characters longer than the size given because
1772 * we need to put in 2 end-of-buffer characters.
1774 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1775 if ( ! b->yy_ch_buf )
1776 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1778 b->yy_is_our_buffer = 1;
1780 yy_init_buffer( b, file );
1782 return b;
1786 #ifdef YY_USE_PROTOS
1787 void yy_delete_buffer( YY_BUFFER_STATE b )
1788 #else
1789 void yy_delete_buffer( b )
1790 YY_BUFFER_STATE b;
1791 #endif
1793 if ( ! b )
1794 return;
1796 if ( b == yy_current_buffer )
1797 yy_current_buffer = (YY_BUFFER_STATE) 0;
1799 if ( b->yy_is_our_buffer )
1800 yy_flex_free( (void *) b->yy_ch_buf );
1802 yy_flex_free( (void *) b );
1807 #ifdef YY_USE_PROTOS
1808 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1809 #else
1810 void yy_init_buffer( b, file )
1811 YY_BUFFER_STATE b;
1812 FILE *file;
1813 #endif
1817 yy_flush_buffer( b );
1819 b->yy_input_file = file;
1820 b->yy_fill_buffer = 1;
1822 #if YY_ALWAYS_INTERACTIVE
1823 b->yy_is_interactive = 1;
1824 #else
1825 #if YY_NEVER_INTERACTIVE
1826 b->yy_is_interactive = 0;
1827 #else
1828 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1829 #endif
1830 #endif
1834 #ifdef YY_USE_PROTOS
1835 void yy_flush_buffer( YY_BUFFER_STATE b )
1836 #else
1837 void yy_flush_buffer( b )
1838 YY_BUFFER_STATE b;
1839 #endif
1842 if ( ! b )
1843 return;
1845 b->yy_n_chars = 0;
1847 /* We always need two end-of-buffer characters. The first causes
1848 * a transition to the end-of-buffer state. The second causes
1849 * a jam in that state.
1851 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1852 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1854 b->yy_buf_pos = &b->yy_ch_buf[0];
1856 b->yy_at_bol = 1;
1857 b->yy_buffer_status = YY_BUFFER_NEW;
1859 if ( b == yy_current_buffer )
1860 yy_load_buffer_state();
1864 #ifndef YY_NO_SCAN_BUFFER
1865 #ifdef YY_USE_PROTOS
1866 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1867 #else
1868 YY_BUFFER_STATE yy_scan_buffer( base, size )
1869 char *base;
1870 yy_size_t size;
1871 #endif
1873 YY_BUFFER_STATE b;
1875 if ( size < 2 ||
1876 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1877 base[size-1] != YY_END_OF_BUFFER_CHAR )
1878 /* They forgot to leave room for the EOB's. */
1879 return 0;
1881 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1882 if ( ! b )
1883 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1885 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1886 b->yy_buf_pos = b->yy_ch_buf = base;
1887 b->yy_is_our_buffer = 0;
1888 b->yy_input_file = 0;
1889 b->yy_n_chars = b->yy_buf_size;
1890 b->yy_is_interactive = 0;
1891 b->yy_at_bol = 1;
1892 b->yy_fill_buffer = 0;
1893 b->yy_buffer_status = YY_BUFFER_NEW;
1895 yy_switch_to_buffer( b );
1897 return b;
1899 #endif
1902 #ifndef YY_NO_SCAN_STRING
1903 #ifdef YY_USE_PROTOS
1904 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1905 #else
1906 YY_BUFFER_STATE yy_scan_string( yy_str )
1907 yyconst char *yy_str;
1908 #endif
1910 int len;
1911 for ( len = 0; yy_str[len]; ++len )
1914 return yy_scan_bytes( yy_str, len );
1916 #endif
1919 #ifndef YY_NO_SCAN_BYTES
1920 #ifdef YY_USE_PROTOS
1921 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1922 #else
1923 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1924 yyconst char *bytes;
1925 int len;
1926 #endif
1928 YY_BUFFER_STATE b;
1929 char *buf;
1930 yy_size_t n;
1931 int i;
1933 /* Get memory for full buffer, including space for trailing EOB's. */
1934 n = len + 2;
1935 buf = (char *) yy_flex_alloc( n );
1936 if ( ! buf )
1937 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1939 for ( i = 0; i < len; ++i )
1940 buf[i] = bytes[i];
1942 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1944 b = yy_scan_buffer( buf, n );
1945 if ( ! b )
1946 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1948 /* It's okay to grow etc. this buffer, and we should throw it
1949 * away when we're done.
1951 b->yy_is_our_buffer = 1;
1953 return b;
1955 #endif
1958 #ifndef YY_NO_PUSH_STATE
1959 #ifdef YY_USE_PROTOS
1960 static void yy_push_state( int new_state )
1961 #else
1962 static void yy_push_state( new_state )
1963 int new_state;
1964 #endif
1966 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1968 yy_size_t new_size;
1970 yy_start_stack_depth += YY_START_STACK_INCR;
1971 new_size = yy_start_stack_depth * sizeof( int );
1973 if ( ! yy_start_stack )
1974 yy_start_stack = (int *) yy_flex_alloc( new_size );
1976 else
1977 yy_start_stack = (int *) yyxrealloc(
1978 (void *) yy_start_stack, new_size );
1980 if ( ! yy_start_stack )
1981 YY_FATAL_ERROR(
1982 "out of memory expanding start-condition stack" );
1985 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1987 BEGIN(new_state);
1989 #endif
1992 #ifndef YY_NO_POP_STATE
1993 static void yy_pop_state()
1995 if ( --yy_start_stack_ptr < 0 )
1996 YY_FATAL_ERROR( "start-condition stack underflow" );
1998 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2000 #endif
2003 #ifndef YY_NO_TOP_STATE
2004 static int yy_top_state()
2006 return yy_start_stack[yy_start_stack_ptr - 1];
2008 #endif
2010 #ifndef YY_EXIT_FAILURE
2011 #define YY_EXIT_FAILURE 2
2012 #endif
2014 #ifdef YY_USE_PROTOS
2015 static void yy_fatal_error( yyconst char msg[] )
2016 #else
2017 static void yy_fatal_error( msg )
2018 char msg[];
2019 #endif
2021 (void) fprintf( stderr, "%s\n", msg );
2022 exit( YY_EXIT_FAILURE );
2027 /* Redefine yyless() so it works in section 3 code. */
2029 #undef yyless
2030 #define yyless(n) \
2031 do \
2033 /* Undo effects of setting up yytext. */ \
2034 yytext[yyleng] = yy_hold_char; \
2035 yy_c_buf_p = yytext + n; \
2036 yy_hold_char = *yy_c_buf_p; \
2037 *yy_c_buf_p = '\0'; \
2038 yyleng = n; \
2040 while ( 0 )
2043 /* Internal utility routines. */
2045 #ifndef yytext_ptr
2046 #ifdef YY_USE_PROTOS
2047 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2048 #else
2049 static void yy_flex_strncpy( s1, s2, n )
2050 char *s1;
2051 yyconst char *s2;
2052 int n;
2053 #endif
2055 register int i;
2056 for ( i = 0; i < n; ++i )
2057 s1[i] = s2[i];
2059 #endif
2061 #ifdef YY_NEED_STRLEN
2062 #ifdef YY_USE_PROTOS
2063 static int yy_flex_strlen( yyconst char *s )
2064 #else
2065 static int yy_flex_strlen( s )
2066 yyconst char *s;
2067 #endif
2069 register int n;
2070 for ( n = 0; s[n]; ++n )
2073 return n;
2075 #endif
2078 #ifdef YY_USE_PROTOS
2079 static void *yy_flex_alloc( yy_size_t size )
2080 #else
2081 static void *yy_flex_alloc( size )
2082 yy_size_t size;
2083 #endif
2085 return (void *) xmalloc( size );
2088 #ifdef YY_USE_PROTOS
2089 static void *yyxrealloc( void *ptr, yy_size_t size )
2090 #else
2091 static void *yyxrealloc( ptr, size )
2092 void *ptr;
2093 yy_size_t size;
2094 #endif
2096 /* The cast to (char *) in the following accommodates both
2097 * implementations that use char* generic pointers, and those
2098 * that use void* generic pointers. It works with the latter
2099 * because both ANSI C and C++ allow castless assignment from
2100 * any pointer type to void*, and deal with argument conversions
2101 * as though doing an assignment.
2103 return (void *) xrealloc( (char *) ptr, size );
2106 #ifdef YY_USE_PROTOS
2107 static void yy_flex_free( void *ptr )
2108 #else
2109 static void yy_flex_free( ptr )
2110 void *ptr;
2111 #endif
2113 free( ptr );
2116 #if YY_MAIN
2117 int main()
2119 yylex();
2120 return 0;
2122 #endif
2123 #line 268 "ada-lex.l"
2126 #include <ctype.h>
2127 #include "gdb_string.h"
2129 /* Initialize the lexer for processing new expression. */
2131 void
2132 lexer_init (FILE *inp)
2134 BEGIN INITIAL;
2135 yyrestart (inp);
2139 /* Copy S2 to S1, removing all underscores, and downcasing all letters. */
2141 static void
2142 canonicalizeNumeral (char *s1, const char *s2)
2144 for (; *s2 != '\000'; s2 += 1)
2146 if (*s2 != '_')
2148 *s1 = tolower(*s2);
2149 s1 += 1;
2152 s1[0] = '\000';
2155 /* Interprets the prefix of NUM that consists of digits of the given BASE
2156 as an integer of that BASE, with the string EXP as an exponent.
2157 Puts value in yylval, and returns INT, if the string is valid. Causes
2158 an error if the number is improperly formated. BASE, if NULL, defaults
2159 to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'.
2162 static int
2163 processInt (const char *base0, const char *num0, const char *exp0)
2165 ULONGEST result;
2166 long exp;
2167 int base;
2169 char *trailer;
2171 if (base0 == NULL)
2172 base = 10;
2173 else
2175 base = strtol (base0, (char **) NULL, 10);
2176 if (base < 2 || base > 16)
2177 error (_("Invalid base: %d."), base);
2180 if (exp0 == NULL)
2181 exp = 0;
2182 else
2183 exp = strtol(exp0, (char **) NULL, 10);
2185 errno = 0;
2186 result = strtoulst (num0, (const char **) &trailer, base);
2187 if (errno == ERANGE)
2188 error (_("Integer literal out of range"));
2189 if (isxdigit(*trailer))
2190 error (_("Invalid digit `%c' in based literal"), *trailer);
2192 while (exp > 0)
2194 if (result > (ULONG_MAX / base))
2195 error (_("Integer literal out of range"));
2196 result *= base;
2197 exp -= 1;
2200 if ((result >> (gdbarch_int_bit (current_gdbarch)-1)) == 0)
2201 yylval.typed_val.type = type_int ();
2202 else if ((result >> (gdbarch_long_bit (current_gdbarch)-1)) == 0)
2203 yylval.typed_val.type = type_long ();
2204 else if (((result >> (gdbarch_long_bit (current_gdbarch)-1)) >> 1) == 0)
2206 /* We have a number representable as an unsigned integer quantity.
2207 For consistency with the C treatment, we will treat it as an
2208 anonymous modular (unsigned) quantity. Alas, the types are such
2209 that we need to store .val as a signed quantity. Sorry
2210 for the mess, but C doesn't officially guarantee that a simple
2211 assignment does the trick (no, it doesn't; read the reference manual).
2213 yylval.typed_val.type = builtin_type_unsigned_long;
2214 if (result & LONGEST_SIGN)
2215 yylval.typed_val.val =
2216 (LONGEST) (result & ~LONGEST_SIGN)
2217 - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1);
2218 else
2219 yylval.typed_val.val = (LONGEST) result;
2220 return INT;
2222 else
2223 yylval.typed_val.type = type_long_long ();
2225 yylval.typed_val.val = (LONGEST) result;
2226 return INT;
2229 static int
2230 processReal (const char *num0)
2232 sscanf (num0, DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
2234 yylval.typed_val_float.type = type_float ();
2235 if (sizeof(DOUBLEST) >= gdbarch_double_bit (current_gdbarch)
2236 / TARGET_CHAR_BIT)
2237 yylval.typed_val_float.type = type_double ();
2238 if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (current_gdbarch)
2239 / TARGET_CHAR_BIT)
2240 yylval.typed_val_float.type = type_long_double ();
2242 return FLOAT;
2246 /* Store a canonicalized version of NAME0[0..LEN-1] in yylval.ssym. The
2247 resulting string is valid until the next call to ada_parse. It differs
2248 from NAME0 in that:
2249 + Characters between '...' or <...> are transfered verbatim to
2250 yylval.ssym.
2251 + <, >, and trailing "'" characters in quoted sequences are removed
2252 (a leading quote is preserved to indicate that the name is not to be
2253 GNAT-encoded).
2254 + Unquoted whitespace is removed.
2255 + Unquoted alphabetic characters are mapped to lower case.
2256 Result is returned as a struct stoken, but for convenience, the string
2257 is also null-terminated. Result string valid until the next call of
2258 ada_parse.
2260 static struct stoken
2261 processId (const char *name0, int len)
2263 char *name = obstack_alloc (&temp_parse_space, len + 11);
2264 int i0, i;
2265 struct stoken result;
2267 while (len > 0 && isspace (name0[len-1]))
2268 len -= 1;
2269 i = i0 = 0;
2270 while (i0 < len)
2272 if (isalnum (name0[i0]))
2274 name[i] = tolower (name0[i0]);
2275 i += 1; i0 += 1;
2277 else switch (name0[i0])
2279 default:
2280 name[i] = name0[i0];
2281 i += 1; i0 += 1;
2282 break;
2283 case ' ': case '\t':
2284 i0 += 1;
2285 break;
2286 case '\'':
2289 name[i] = name0[i0];
2290 i += 1; i0 += 1;
2292 while (i0 < len && name0[i0] != '\'');
2293 i0 += 1;
2294 break;
2295 case '<':
2296 i0 += 1;
2297 while (i0 < len && name0[i0] != '>')
2299 name[i] = name0[i0];
2300 i += 1; i0 += 1;
2302 i0 += 1;
2303 break;
2306 name[i] = '\000';
2308 result.ptr = name;
2309 result.length = i;
2310 return result;
2313 /* Return TEXT[0..LEN-1], a string literal without surrounding quotes,
2314 with special hex character notations replaced with characters.
2315 Result valid until the next call to ada_parse. */
2317 static struct stoken
2318 processString (const char *text, int len)
2320 const char *p;
2321 char *q;
2322 const char *lim = text + len;
2323 struct stoken result;
2325 q = result.ptr = obstack_alloc (&temp_parse_space, len);
2326 p = text;
2327 while (p < lim)
2329 if (p[0] == '[' && p[1] == '"' && p+2 < lim)
2331 if (p[2] == '"') /* "...["""]... */
2333 *q = '"';
2334 p += 4;
2336 else
2338 int chr;
2339 sscanf (p+2, "%2x", &chr);
2340 *q = (char) chr;
2341 p += 5;
2344 else
2345 *q = *p;
2346 q += 1;
2347 p += 1;
2349 result.length = q - result.ptr;
2350 return result;
2353 /* Returns the position within STR of the '.' in a
2354 '.{WHITE}*all' component of a dotted name, or -1 if there is none.
2355 Note: we actually don't need this routine, since 'all' can never be an
2356 Ada identifier. Thus, looking up foo.all or foo.all.x as a name
2357 must fail, and will eventually be interpreted as (foo).all or
2358 (foo).all.x. However, this does avoid an extraneous lookup. */
2360 static int
2361 find_dot_all (const char *str)
2363 int i;
2364 for (i = 0; str[i] != '\000'; i += 1)
2366 if (str[i] == '.')
2368 int i0 = i;
2370 i += 1;
2371 while (isspace (str[i]));
2372 if (strncmp (str+i, "all", 3) == 0
2373 && ! isalnum (str[i+3]) && str[i+3] != '_')
2374 return i0;
2377 return -1;
2380 /* Returns non-zero iff string SUBSEQ matches a subsequence of STR, ignoring
2381 case. */
2383 static int
2384 subseqMatch (const char *subseq, const char *str)
2386 if (subseq[0] == '\0')
2387 return 1;
2388 else if (str[0] == '\0')
2389 return 0;
2390 else if (tolower (subseq[0]) == tolower (str[0]))
2391 return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1);
2392 else
2393 return subseqMatch (subseq, str+1);
2397 static struct { const char *name; int code; }
2398 attributes[] = {
2399 { "address", TICK_ADDRESS },
2400 { "unchecked_access", TICK_ACCESS },
2401 { "unrestricted_access", TICK_ACCESS },
2402 { "access", TICK_ACCESS },
2403 { "first", TICK_FIRST },
2404 { "last", TICK_LAST },
2405 { "length", TICK_LENGTH },
2406 { "max", TICK_MAX },
2407 { "min", TICK_MIN },
2408 { "modulus", TICK_MODULUS },
2409 { "pos", TICK_POS },
2410 { "range", TICK_RANGE },
2411 { "size", TICK_SIZE },
2412 { "tag", TICK_TAG },
2413 { "val", TICK_VAL },
2414 { NULL, -1 }
2417 /* Return the syntactic code corresponding to the attribute name or
2418 abbreviation STR. */
2420 static int
2421 processAttribute (const char *str)
2423 int i, k;
2425 for (i = 0; attributes[i].code != -1; i += 1)
2426 if (strcasecmp (str, attributes[i].name) == 0)
2427 return attributes[i].code;
2429 for (i = 0, k = -1; attributes[i].code != -1; i += 1)
2430 if (subseqMatch (str, attributes[i].name))
2432 if (k == -1)
2433 k = i;
2434 else
2435 error (_("ambiguous attribute name: `%s'"), str);
2437 if (k == -1)
2438 error (_("unrecognized attribute: `%s'"), str);
2440 return attributes[k].code;
2444 yywrap(void)
2446 return 1;
2449 /* Dummy definition to suppress warnings about unused static definitions. */
2450 typedef void (*dummy_function) ();
2451 dummy_function ada_flex_use[] =
2453 (dummy_function) yyunput