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 $
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
16 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
28 /* Use prototypes in function declarations. */
31 /* The "const" storage-class-modifier is valid. */
34 #else /* ! __cplusplus */
42 #endif /* ! __cplusplus */
61 #define YY_PROTO(proto) proto
63 #define YY_PROTO(proto) ()
66 /* Returned upon end-of-file. */
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
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
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;
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 )
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. */
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 */ \
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
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
155 yy_size_t yy_buf_size;
157 /* Number of characters read into yy_ch_buf, not including EOB
162 /* Whether we "own" the buffer - i.e., we know we created it,
163 * and can xrealloc() it to grow it, and should xfree() it to
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
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
181 /* Whether to try to fill the input buffer when we reach the
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
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 */
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;
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; \
286 #define YY_NUM_RULES 54
287 #define YY_END_OF_BUFFER 55
288 static yyconst short int yy_accept[196] =
290 0, 0, 0, 0, 55, 53, 1, 1, 15, 52,
291 42, 53, 44, 45, 42, 43, 42, 42, 42, 4,
292 4, 42, 42, 42, 42, 51, 48, 48, 48, 48,
293 48, 48, 48, 48, 48, 48, 48, 41, 0, 14,
294 0, 52, 0, 0, 0, 0, 0, 0, 0, 36,
295 2, 0, 35, 0, 47, 47, 38, 0, 0, 4,
296 0, 0, 50, 37, 39, 0, 34, 40, 0, 0,
297 48, 0, 48, 48, 48, 48, 48, 16, 21, 48,
298 48, 48, 48, 26, 48, 48, 48, 48, 48, 48,
299 0, 14, 0, 12, 12, 0, 33, 2, 0, 47,
301 47, 0, 9, 0, 3, 7, 0, 48, 0, 0,
302 0, 48, 18, 19, 48, 48, 22, 23, 24, 48,
303 48, 28, 48, 48, 48, 48, 30, 0, 0, 0,
304 0, 0, 0, 47, 46, 6, 0, 0, 9, 0,
305 3, 0, 0, 0, 0, 0, 0, 0, 0, 0,
306 0, 0, 0, 48, 20, 48, 25, 48, 17, 29,
307 48, 31, 0, 49, 0, 0, 0, 0, 48, 0,
308 0, 0, 0, 0, 0, 0, 32, 48, 48, 0,
309 0, 5, 11, 0, 8, 27, 0, 5, 0, 8,
314 static yyconst int yy_ec[256] =
316 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
317 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
318 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
319 1, 4, 5, 6, 7, 8, 5, 9, 10, 11,
320 12, 13, 14, 15, 16, 17, 18, 19, 20, 20,
321 20, 20, 20, 20, 20, 20, 20, 21, 22, 23,
322 24, 25, 5, 26, 30, 31, 32, 33, 34, 35,
323 36, 37, 38, 36, 39, 40, 41, 42, 43, 36,
324 36, 44, 45, 46, 47, 36, 48, 49, 36, 36,
325 27, 5, 28, 5, 29, 5, 30, 31, 32, 33,
327 34, 35, 36, 37, 38, 36, 39, 40, 41, 42,
328 43, 36, 36, 44, 45, 46, 47, 36, 48, 49,
329 36, 36, 26, 22, 26, 5, 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,
335 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
336 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, 1, 1, 1, 1, 1,
342 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 static yyconst int yy_meta[50] =
348 1, 2, 3, 4, 5, 6, 7, 8, 5, 9,
349 5, 5, 5, 5, 5, 5, 10, 5, 11, 11,
350 5, 5, 12, 13, 14, 5, 5, 5, 15, 16,
351 16, 16, 16, 16, 16, 17, 17, 17, 17, 17,
352 17, 17, 17, 17, 17, 17, 17, 17, 17
355 static yyconst short int yy_base[217] =
357 0, 0, 622, 615, 620, 759, 759, 759, 44, 0,
358 759, 71, 759, 759, 606, 759, 601, 119, 591, 118,
359 124, 30, 590, 588, 588, 759, 53, 152, 22, 97,
360 98, 103, 117, 119, 27, 140, 137, 194, 151, 759,
361 160, 0, 242, 601, 594, 593, 592, 120, 282, 759,
362 0, 330, 759, 0, 0, 560, 759, 0, 40, 329,
363 171, 0, 759, 759, 759, 574, 759, 759, 171, 245,
364 759, 336, 150, 219, 223, 226, 227, 162, 228, 262,
365 263, 310, 266, 265, 313, 268, 312, 330, 320, 334,
366 572, 569, 366, 377, 759, 380, 547, 0, 530, 0,
368 501, 169, 363, 46, 365, 0, 503, 386, 402, 417,
369 0, 417, 335, 344, 412, 387, 360, 386, 406, 413,
370 431, 407, 425, 408, 437, 438, 421, 518, 0, 472,
371 497, 475, 474, 759, 0, 456, 0, 246, 458, 284,
372 462, 451, 403, 464, 477, 478, 454, 408, 402, 392,
373 390, 364, 376, 509, 455, 483, 458, 485, 473, 489,
374 491, 492, 367, 759, 387, 516, 366, 48, 535, 326,
375 312, 270, 220, 219, 207, 164, 501, 509, 511, 144,
376 282, 527, 98, 117, 529, 519, 42, 540, 321, 543,
377 562, 403, 548, 551, 759, 580, 590, 606, 611, 627,
379 644, 647, 654, 487, 562, 661, 677, 689, 695, 706,
380 708, 724, 563, 565, 731, 742
383 static yyconst short int yy_def[217] =
385 195, 1, 1, 1, 195, 195, 195, 195, 196, 197,
386 195, 195, 195, 195, 195, 195, 195, 198, 195, 195,
387 195, 195, 199, 195, 195, 195, 200, 200, 28, 28,
388 28, 28, 28, 28, 28, 28, 28, 195, 196, 195,
389 196, 197, 38, 38, 38, 43, 195, 43, 43, 195,
390 201, 198, 195, 202, 203, 203, 195, 204, 195, 195,
391 195, 205, 195, 195, 195, 206, 195, 195, 195, 195,
392 195, 207, 28, 28, 28, 28, 28, 28, 28, 28,
393 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
394 49, 208, 195, 195, 195, 43, 49, 201, 209, 203,
396 203, 210, 195, 195, 195, 205, 206, 195, 207, 195,
397 211, 212, 28, 28, 28, 28, 28, 28, 28, 28,
398 28, 28, 28, 28, 28, 28, 28, 195, 213, 195,
399 195, 43, 209, 195, 203, 195, 214, 210, 195, 195,
400 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
401 195, 195, 215, 212, 28, 28, 28, 28, 28, 28,
402 28, 28, 195, 195, 43, 195, 216, 195, 195, 195,
403 195, 195, 195, 195, 195, 215, 28, 28, 28, 43,
404 195, 195, 195, 216, 195, 28, 43, 195, 195, 195,
405 195, 195, 195, 195, 0, 195, 195, 195, 195, 195,
407 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
408 195, 195, 195, 195, 195, 195
411 static yyconst short int yy_nxt[809] =
413 6, 7, 8, 7, 6, 9, 6, 10, 11, 12,
414 13, 14, 15, 11, 16, 17, 18, 19, 20, 21,
415 22, 11, 23, 24, 25, 26, 11, 11, 27, 28,
416 27, 27, 27, 29, 30, 27, 27, 31, 27, 27,
417 32, 33, 34, 35, 27, 36, 27, 27, 37, 40,
418 63, 191, 73, 64, 69, 69, 70, 73, 103, 103,
419 86, 76, 71, 73, 105, 105, 185, 185, 73, 72,
420 41, 43, 44, 44, 45, 46, 46, 46, 46, 46,
421 47, 46, 46, 46, 46, 46, 46, 46, 46, 46,
422 46, 46, 46, 46, 46, 46, 46, 48, 46, 46,
424 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
425 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
426 52, 52, 52, 183, 58, 96, 77, 73, 73, 94,
427 58, 189, 78, 73, 59, 53, 60, 60, 73, 79,
428 59, 54, 60, 60, 73, 80, 60, 73, 56, 73,
429 81, 61, 60, 69, 69, 70, 40, 61, 73, 82,
430 73, 71, 84, 83, 85, 92, 62, 73, 72, 87,
431 73, 187, 69, 69, 69, 136, 88, 41, 73, 90,
432 73, 73, 74, 89, 104, 137, 41, 72, 169, 105,
433 105, 73, 73, 75, 43, 44, 44, 44, 43, 43,
435 43, 43, 43, 73, 43, 43, 43, 43, 43, 43,
436 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
437 43, 43, 43, 91, 91, 91, 91, 91, 91, 91,
438 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
439 91, 91, 91, 43, 43, 43, 69, 69, 70, 73,
440 142, 93, 136, 73, 71, 114, 73, 73, 73, 142,
441 73, 72, 137, 113, 73, 142, 116, 73, 73, 73,
442 115, 43, 43, 43, 43, 43, 43, 43, 43, 43,
443 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
444 43, 94, 73, 73, 117, 73, 73, 168, 73, 168,
446 182, 182, 142, 73, 73, 120, 73, 73, 122, 73,
447 118, 97, 97, 97, 97, 97, 97, 97, 97, 97,
448 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
449 97, 52, 52, 52, 192, 58, 192, 109, 109, 109,
450 73, 110, 73, 73, 142, 59, 195, 60, 60, 121,
451 73, 73, 54, 73, 73, 119, 123, 60, 111, 56,
452 73, 73, 61, 124, 73, 73, 126, 130, 130, 130,
453 142, 73, 183, 125, 73, 73, 73, 127, 130, 130,
454 130, 139, 139, 141, 141, 73, 131, 69, 69, 70,
455 73, 139, 180, 141, 39, 71, 140, 131, 132, 132,
457 169, 73, 72, 109, 109, 109, 175, 110, 169, 132,
458 132, 132, 132, 132, 132, 142, 73, 73, 69, 69,
459 70, 193, 193, 174, 111, 142, 71, 73, 73, 143,
460 142, 156, 142, 72, 144, 142, 73, 73, 73, 145,
461 142, 146, 73, 73, 173, 155, 147, 73, 73, 160,
462 172, 73, 157, 73, 73, 73, 169, 148, 149, 150,
463 151, 73, 73, 159, 158, 152, 73, 73, 73, 169,
464 161, 162, 73, 130, 130, 130, 139, 139, 73, 73,
465 141, 141, 169, 169, 170, 73, 139, 142, 73, 166,
466 141, 140, 131, 165, 165, 171, 73, 102, 134, 73,
468 142, 142, 102, 73, 165, 165, 165, 165, 165, 165,
469 69, 69, 70, 73, 73, 73, 177, 164, 71, 73,
470 179, 73, 73, 163, 73, 72, 73, 108, 178, 181,
471 73, 73, 73, 73, 182, 182, 69, 69, 70, 73,
472 135, 73, 73, 159, 71, 188, 188, 190, 190, 73,
473 73, 72, 73, 186, 134, 188, 93, 190, 188, 188,
474 73, 190, 190, 130, 130, 130, 194, 194, 188, 194,
475 194, 190, 106, 128, 128, 167, 194, 106, 128, 194,
476 167, 93, 131, 39, 39, 39, 39, 39, 39, 39,
477 39, 39, 39, 39, 39, 39, 39, 42, 108, 101,
479 42, 95, 94, 94, 42, 42, 42, 55, 55, 55,
480 93, 68, 67, 65, 57, 55, 51, 55, 50, 195,
481 55, 55, 55, 66, 38, 66, 66, 66, 73, 73,
482 73, 38, 195, 195, 195, 73, 73, 73, 195, 195,
483 195, 73, 73, 73, 98, 98, 195, 98, 98, 98,
484 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
485 98, 99, 99, 99, 100, 195, 195, 195, 100, 100,
486 100, 107, 195, 195, 107, 107, 107, 107, 112, 112,
487 112, 195, 112, 195, 195, 195, 195, 195, 112, 195,
488 195, 112, 112, 112, 129, 195, 195, 195, 195, 129,
490 195, 195, 195, 195, 129, 133, 195, 195, 133, 133,
491 133, 133, 138, 195, 195, 138, 138, 195, 195, 195,
492 138, 138, 153, 153, 153, 154, 154, 154, 195, 195,
493 195, 195, 154, 154, 154, 195, 195, 195, 154, 154,
494 154, 176, 195, 195, 176, 176, 176, 176, 184, 195,
495 195, 195, 184, 195, 195, 195, 184, 184, 5, 195,
496 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
497 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
498 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
499 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
501 195, 195, 195, 195, 195, 195, 195, 195
504 static yyconst short int yy_chk[809] =
506 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
507 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
508 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
509 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
510 1, 1, 1, 1, 1, 1, 1, 1, 1, 9,
511 22, 187, 29, 22, 27, 27, 27, 35, 59, 59,
512 35, 29, 27, 29, 104, 104, 168, 168, 35, 27,
513 9, 12, 12, 12, 12, 12, 12, 12, 12, 12,
514 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
515 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
517 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
518 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
519 18, 18, 18, 184, 20, 48, 30, 30, 31, 48,
520 21, 183, 31, 32, 20, 18, 20, 20, 30, 31,
521 21, 18, 21, 21, 32, 32, 20, 33, 18, 34,
522 33, 20, 21, 28, 28, 28, 39, 21, 33, 33,
523 34, 28, 34, 33, 34, 41, 20, 37, 28, 36,
524 36, 180, 69, 69, 69, 102, 36, 39, 37, 37,
525 73, 36, 28, 36, 61, 102, 41, 69, 176, 61,
526 61, 73, 78, 28, 38, 38, 38, 38, 38, 38,
528 38, 38, 38, 78, 38, 38, 38, 38, 38, 38,
529 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
530 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
531 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
532 38, 38, 38, 43, 43, 43, 70, 70, 70, 74,
533 175, 43, 138, 75, 70, 75, 76, 77, 79, 174,
534 74, 70, 138, 74, 75, 173, 77, 76, 77, 79,
535 76, 43, 43, 43, 43, 43, 43, 43, 43, 43,
536 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
537 43, 49, 80, 81, 80, 84, 83, 140, 86, 140,
539 181, 181, 172, 80, 81, 83, 84, 83, 86, 86,
540 81, 49, 49, 49, 49, 49, 49, 49, 49, 49,
541 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
542 49, 52, 52, 52, 189, 60, 189, 72, 72, 72,
543 82, 72, 87, 85, 171, 60, 52, 60, 60, 85,
544 89, 82, 52, 87, 85, 82, 87, 60, 72, 52,
545 88, 89, 60, 88, 90, 113, 89, 93, 93, 93,
546 170, 88, 167, 88, 114, 90, 113, 90, 94, 94,
547 94, 103, 103, 105, 105, 114, 93, 108, 108, 108,
548 117, 103, 165, 105, 163, 108, 103, 94, 96, 96,
550 153, 117, 108, 109, 109, 109, 152, 109, 143, 96,
551 96, 96, 96, 96, 96, 143, 118, 116, 112, 112,
552 112, 192, 192, 151, 109, 110, 112, 118, 116, 110,
553 110, 116, 110, 112, 110, 150, 119, 122, 124, 110,
554 110, 110, 115, 120, 149, 115, 110, 119, 122, 124,
555 148, 127, 120, 115, 120, 123, 142, 110, 110, 110,
556 110, 121, 127, 123, 121, 110, 123, 125, 126, 144,
557 125, 126, 121, 130, 130, 130, 139, 139, 125, 126,
558 141, 141, 145, 146, 147, 155, 139, 144, 157, 136,
559 141, 139, 130, 132, 132, 147, 155, 204, 133, 157,
561 145, 146, 204, 159, 132, 132, 132, 132, 132, 132,
562 154, 154, 154, 156, 159, 158, 156, 131, 154, 160,
563 161, 161, 162, 128, 156, 154, 158, 107, 158, 166,
564 160, 177, 161, 162, 166, 166, 169, 169, 169, 178,
565 101, 179, 177, 179, 169, 182, 182, 185, 185, 186,
566 178, 169, 179, 178, 99, 182, 97, 185, 188, 188,
567 186, 190, 190, 191, 191, 191, 193, 193, 188, 194,
568 194, 190, 205, 213, 92, 214, 193, 205, 213, 194,
569 214, 91, 191, 196, 196, 196, 196, 196, 196, 196,
570 196, 196, 196, 196, 196, 196, 196, 197, 66, 56,
572 197, 47, 46, 45, 197, 197, 197, 198, 198, 198,
573 44, 25, 24, 23, 19, 198, 17, 198, 15, 5,
574 198, 198, 198, 199, 4, 199, 199, 199, 200, 200,
575 200, 3, 0, 0, 0, 200, 200, 200, 0, 0,
576 0, 200, 200, 200, 201, 201, 0, 201, 201, 201,
577 201, 201, 201, 201, 201, 201, 201, 201, 201, 201,
578 201, 202, 202, 202, 203, 0, 0, 0, 203, 203,
579 203, 206, 0, 0, 206, 206, 206, 206, 207, 207,
580 207, 0, 207, 0, 0, 0, 0, 0, 207, 0,
581 0, 207, 207, 207, 208, 0, 0, 0, 0, 208,
583 0, 0, 0, 0, 208, 209, 0, 0, 209, 209,
584 209, 209, 210, 0, 0, 210, 210, 0, 0, 0,
585 210, 210, 211, 211, 211, 212, 212, 212, 0, 0,
586 0, 0, 212, 212, 212, 0, 0, 0, 212, 212,
587 212, 215, 0, 0, 215, 215, 215, 215, 216, 0,
588 0, 0, 216, 0, 0, 0, 216, 216, 195, 195,
589 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
590 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
591 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
592 195, 195, 195, 195, 195, 195, 195, 195, 195, 195,
594 195, 195, 195, 195, 195, 195, 195, 195
597 static yy_state_type yy_last_accepting_state;
598 static char *yy_last_accepting_cpos;
600 /* The intent behind this definition is that it'll catch
601 * any uses of REJECT which flex missed.
603 #define REJECT reject_used_but_not_detected
604 #define yymore() yymore_used_but_not_detected
605 #define YY_MORE_ADJ 0
606 #define YY_RESTORE_YY_MORE_OFFSET
610 /* FLEX lexer for Ada expressions, for GDB.
611 Copyright (C) 1994, 1997, 1998, 2000, 2001, 2002, 2003, 2007, 2008, 2009,
612 2010 Free Software Foundation, Inc.
614 This file is part of GDB.
616 This program is free software; you can redistribute it and/or modify
617 it under the terms of the GNU General Public License as published by
618 the Free Software Foundation; either version 3 of the License, or
619 (at your option) any later version.
621 This program is distributed in the hope that it will be useful,
622 but WITHOUT ANY WARRANTY; without even the implied warranty of
623 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
624 GNU General Public License for more details.
626 You should have received a copy of the GNU General Public License
627 along with this program. If not, see <http://www.gnu.org/licenses/>. */
628 /*----------------------------------------------------------------------*/
629 /* The converted version of this file is to be included in ada-exp.y, */
630 /* the Ada parser for gdb. The function yylex obtains characters from */
631 /* the global pointer lexptr. It returns a syntactic category for */
632 /* each successive token and places a semantic value into yylval */
633 /* (ada-lval), defined by the parser. */
636 #define NUMERAL_WIDTH 256
637 #define LONGEST_SIGN ((ULONGEST) 1 << (sizeof(LONGEST) * HOST_CHAR_BIT - 1))
639 /* Temporary staging for numeric literals. */
640 static char numbuf[NUMERAL_WIDTH];
641 static void canonicalizeNumeral (char *s1, const char *);
642 static struct stoken processString (const char*, int);
643 static int processInt (const char *, const char *, const char *);
644 static int processReal (const char *);
645 static struct stoken processId (const char *, int);
646 static int processAttribute (const char *);
647 static int find_dot_all (const char *);
650 #define YY_DECL static int yylex ( void )
652 /* Flex generates a static function "input" which is not used.
653 Defining YY_NO_INPUT comments it out. */
657 #define YY_INPUT(BUF, RESULT, MAX_SIZE) \
658 if ( *lexptr == '\000' ) \
659 (RESULT) = YY_NULL; \
667 static int find_dot_all (const char *);
669 #define BEFORE_QUAL_QUOTE 1
671 #line 672 "ada-lex.c"
673 /* Macros after this point can all be overridden by user definitions in
677 #ifndef YY_SKIP_YYWRAP
679 extern "C" int yywrap YY_PROTO(( void ));
681 extern int yywrap YY_PROTO(( void ));
686 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
690 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
693 #ifdef YY_NEED_STRLEN
694 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
699 static int yyinput YY_PROTO(( void ));
701 static int input YY_PROTO(( void ));
706 static int yy_start_stack_ptr = 0;
707 static int yy_start_stack_depth = 0;
708 static int *yy_start_stack = 0;
709 #ifndef YY_NO_PUSH_STATE
710 static void yy_push_state YY_PROTO(( int new_state ));
712 #ifndef YY_NO_POP_STATE
713 static void yy_pop_state YY_PROTO(( void ));
715 #ifndef YY_NO_TOP_STATE
716 static int yy_top_state YY_PROTO(( void ));
720 #define YY_NO_PUSH_STATE 1
721 #define YY_NO_POP_STATE 1
722 #define YY_NO_TOP_STATE 1
725 #ifdef YY_MALLOC_DECL
733 /* Just try to get by without declaring the routines. This will fail
734 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
735 * or sizeof(void*) != sizeof(int).
740 /* Amount of stuff to slurp up with each read. */
741 #ifndef YY_READ_BUF_SIZE
742 #define YY_READ_BUF_SIZE 8192
745 /* Copy whatever the last rule matched to the standard output. */
748 /* This used to be an fputs(), but since the string might contain NUL's,
749 * we now use fwrite().
751 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
754 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
755 * is returned in "result".
758 #define YY_INPUT(buf,result,max_size) \
759 if ( yy_current_buffer->yy_is_interactive ) \
762 for ( n = 0; n < max_size && \
763 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
766 buf[n++] = (char) c; \
767 if ( c == EOF && ferror( yyin ) ) \
768 YY_FATAL_ERROR( "input in flex scanner failed" ); \
771 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
772 && ferror( yyin ) ) \
773 YY_FATAL_ERROR( "input in flex scanner failed" );
776 /* No semi-colon after return; correct usage is to write "yyterminate();" -
777 * we don't want an extra ';' after the "return" because that will cause
778 * some compilers to complain about unreachable statements.
781 #define yyterminate() return YY_NULL
784 /* Number of entries by which start-condition stack grows. */
785 #ifndef YY_START_STACK_INCR
786 #define YY_START_STACK_INCR 25
789 /* Report a fatal error. */
790 #ifndef YY_FATAL_ERROR
791 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
794 /* Default declaration of generated scanner - a define so the user can
795 * easily add parameters.
798 #define YY_DECL int yylex YY_PROTO(( void ))
801 /* Code executed at the beginning of each rule, after yytext and yyleng
804 #ifndef YY_USER_ACTION
805 #define YY_USER_ACTION
808 /* Code executed at the end of each rule. */
810 #define YY_BREAK break;
813 #define YY_RULE_SETUP \
818 register yy_state_type yy_current_state;
819 register char *yy_cp = NULL, *yy_bp = NULL;
825 #line 826 "ada-lex.c"
836 yy_start = 1; /* first start state */
844 if ( ! yy_current_buffer )
846 yy_create_buffer( yyin, YY_BUF_SIZE );
848 yy_load_buffer_state();
851 while ( 1 ) /* loops until end-of-file is reached */
855 /* Support of yytext. */
856 *yy_cp = yy_hold_char;
858 /* yy_bp points to the position in yy_ch_buf of the start of
863 yy_current_state = yy_start;
867 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
868 if ( yy_accept[yy_current_state] )
870 yy_last_accepting_state = yy_current_state;
871 yy_last_accepting_cpos = yy_cp;
873 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
875 yy_current_state = (int) yy_def[yy_current_state];
876 if ( yy_current_state >= 196 )
877 yy_c = yy_meta[(unsigned int) yy_c];
879 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
882 while ( yy_base[yy_current_state] != 759 );
885 yy_act = yy_accept[yy_current_state];
887 { /* have to back up */
888 yy_cp = yy_last_accepting_cpos;
889 yy_current_state = yy_last_accepting_state;
890 yy_act = yy_accept[yy_current_state];
896 do_action: /* This label is used only to access EOF actions. */
900 { /* beginning of action switch */
901 case 0: /* must back up */
902 /* undo the effects of YY_DO_BEFORE_ACTION */
903 *yy_cp = yy_hold_char;
904 yy_cp = yy_last_accepting_cpos;
905 yy_current_state = yy_last_accepting_state;
922 canonicalizeNumeral (numbuf, yytext);
923 return processInt (NULL, numbuf, strrchr(numbuf, 'e')+1);
930 canonicalizeNumeral (numbuf, yytext);
931 return processInt (NULL, numbuf, NULL);
936 #line 100 "ada-lex.l"
938 canonicalizeNumeral (numbuf, yytext);
939 return processInt (numbuf,
940 strchr (numbuf, '#') + 1,
941 strrchr(numbuf, '#') + 1);
946 #line 107 "ada-lex.l"
948 canonicalizeNumeral (numbuf, yytext);
949 return processInt (numbuf, strchr (numbuf, '#') + 1, NULL);
954 #line 112 "ada-lex.l"
956 canonicalizeNumeral (numbuf, yytext+2);
957 return processInt ("16#", numbuf, NULL);
962 #line 118 "ada-lex.l"
964 canonicalizeNumeral (numbuf, yytext);
965 return processReal (numbuf);
970 #line 123 "ada-lex.l"
972 canonicalizeNumeral (numbuf, yytext);
973 return processReal (numbuf);
978 #line 128 "ada-lex.l"
980 error (_("Based real literals not implemented yet."));
985 #line 132 "ada-lex.l"
987 error (_("Based real literals not implemented yet."));
992 #line 136 "ada-lex.l"
994 yylval.typed_val.type = type_char ();
995 yylval.typed_val.val = yytext[1];
1001 #line 142 "ada-lex.l"
1004 yylval.typed_val.type = type_char ();
1005 sscanf (yytext+3, "%2x", &v);
1006 yylval.typed_val.val = v;
1012 #line 150 "ada-lex.l"
1014 yylval.sval = processString (yytext+1, yyleng-2);
1020 #line 155 "ada-lex.l"
1022 error (_("ill-formed or non-terminated string literal"));
1027 #line 160 "ada-lex.l"
1029 while (*lexptr != 'i' && *lexptr != 'I')
1037 #line 167 "ada-lex.l"
1039 /* This keyword signals the end of the expression and
1040 will be processed separately. */
1041 while (*lexptr != 't' && *lexptr != 'T')
1050 #line 178 "ada-lex.l"
1055 #line 179 "ada-lex.l"
1060 #line 180 "ada-lex.l"
1065 #line 181 "ada-lex.l"
1070 #line 182 "ada-lex.l"
1075 #line 183 "ada-lex.l"
1080 #line 184 "ada-lex.l"
1085 #line 185 "ada-lex.l"
1086 { return NULL_PTR; }
1090 #line 186 "ada-lex.l"
1095 #line 187 "ada-lex.l"
1100 #line 188 "ada-lex.l"
1105 #line 189 "ada-lex.l"
1110 #line 190 "ada-lex.l"
1113 /* BOOLEAN "KEYWORDS" */
1114 /* True and False are not keywords in Ada, but rather enumeration constants.
1115 However, the boolean type is no longer represented as an enum, so True
1116 and False are no longer defined in symbol tables. We compromise by
1117 making them keywords (when bare). */
1120 #line 199 "ada-lex.l"
1121 { return TRUEKEYWORD; }
1125 #line 200 "ada-lex.l"
1126 { return FALSEKEYWORD; }
1131 #line 204 "ada-lex.l"
1132 { return processAttribute (yytext+1); }
1137 #line 208 "ada-lex.l"
1142 #line 209 "ada-lex.l"
1147 #line 210 "ada-lex.l"
1148 { return STARSTAR; }
1152 #line 211 "ada-lex.l"
1157 #line 212 "ada-lex.l"
1158 { return NOTEQUAL; }
1162 #line 213 "ada-lex.l"
1167 #line 214 "ada-lex.l"
1172 #line 216 "ada-lex.l"
1173 { BEGIN INITIAL; return '\''; }
1177 #line 218 "ada-lex.l"
1178 { return yytext[0]; }
1182 #line 220 "ada-lex.l"
1183 { if (paren_depth == 0 && comma_terminates)
1195 #line 230 "ada-lex.l"
1196 { paren_depth += 1; return '('; }
1200 #line 231 "ada-lex.l"
1201 { if (paren_depth == 0)
1216 #line 244 "ada-lex.l"
1221 #line 246 "ada-lex.l"
1223 yylval.sval = processId (yytext+1, yyleng-1);
1229 #line 251 "ada-lex.l"
1231 int all_posn = find_dot_all (yytext);
1233 if (all_posn == -1 && yytext[yyleng-1] == '\'')
1235 BEGIN BEFORE_QUAL_QUOTE;
1238 else if (all_posn >= 0)
1240 yylval.sval = processId (yytext, yyleng);
1244 /* GDB EXPRESSION CONSTRUCTS */
1247 #line 268 "ada-lex.l"
1249 yyless (yyleng - 2);
1250 yylval.sval = processId (yytext, yyleng);
1256 #line 274 "ada-lex.l"
1257 { return COLONCOLON; }
1261 #line 276 "ada-lex.l"
1262 { return yytext[0]; }
1264 /* REGISTERS AND GDB CONVENIENCE VARIABLES */
1267 #line 280 "ada-lex.l"
1269 yylval.sval.ptr = yytext;
1270 yylval.sval.length = yyleng;
1271 return SPECIAL_VARIABLE;
1274 /* CATCH-ALL ERROR CASE */
1277 #line 288 "ada-lex.l"
1278 { error (_("Invalid character '%s' in expression."), yytext); }
1282 #line 289 "ada-lex.l"
1283 YY_FATAL_ERROR( "flex scanner jammed" );
1285 #line 1286 "ada-lex.c"
1286 case YY_STATE_EOF(INITIAL):
1287 case YY_STATE_EOF(BEFORE_QUAL_QUOTE):
1290 case YY_END_OF_BUFFER:
1292 /* Amount of text matched not including the EOB char. */
1293 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
1295 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1296 *yy_cp = yy_hold_char;
1297 YY_RESTORE_YY_MORE_OFFSET
1299 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
1301 /* We're scanning a new file or input source. It's
1302 * possible that this happened because the user
1303 * just pointed yyin at a new source and called
1304 * yylex(). If so, then we have to assure
1305 * consistency between yy_current_buffer and our
1306 * globals. Here is the right place to do so, because
1307 * this is the first action (other than possibly a
1308 * back-up) that will match for the new input source.
1310 yy_n_chars = yy_current_buffer->yy_n_chars;
1311 yy_current_buffer->yy_input_file = yyin;
1312 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
1315 /* Note that here we test for yy_c_buf_p "<=" to the position
1316 * of the first EOB in the buffer, since yy_c_buf_p will
1317 * already have been incremented past the NUL character
1318 * (since all states make transitions on EOB to the
1319 * end-of-buffer state). Contrast this with the test
1322 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1323 { /* This was really a NUL. */
1324 yy_state_type yy_next_state;
1326 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1328 yy_current_state = yy_get_previous_state();
1330 /* Okay, we're now positioned to make the NUL
1331 * transition. We couldn't have
1332 * yy_get_previous_state() go ahead and do it
1333 * for us because it doesn't know how to deal
1334 * with the possibility of jamming (and we don't
1335 * want to build jamming into it because then it
1336 * will run more slowly).
1339 yy_next_state = yy_try_NUL_trans( yy_current_state );
1341 yy_bp = yytext_ptr + YY_MORE_ADJ;
1343 if ( yy_next_state )
1345 /* Consume the NUL. */
1346 yy_cp = ++yy_c_buf_p;
1347 yy_current_state = yy_next_state;
1354 goto yy_find_action;
1358 else switch ( yy_get_next_buffer() )
1360 case EOB_ACT_END_OF_FILE:
1362 yy_did_buffer_switch_on_eof = 0;
1366 /* Note: because we've taken care in
1367 * yy_get_next_buffer() to have set up
1368 * yytext, we can now set up
1369 * yy_c_buf_p so that if some total
1370 * hoser (like flex itself) wants to
1371 * call the scanner after we return the
1372 * YY_NULL, it'll still work - another
1373 * YY_NULL will get returned.
1375 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1377 yy_act = YY_STATE_EOF(YY_START);
1383 if ( ! yy_did_buffer_switch_on_eof )
1389 case EOB_ACT_CONTINUE_SCAN:
1391 yytext_ptr + yy_amount_of_matched_text;
1393 yy_current_state = yy_get_previous_state();
1396 yy_bp = yytext_ptr + YY_MORE_ADJ;
1399 case EOB_ACT_LAST_MATCH:
1401 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1403 yy_current_state = yy_get_previous_state();
1406 yy_bp = yytext_ptr + YY_MORE_ADJ;
1407 goto yy_find_action;
1414 "fatal flex scanner internal error--no action found" );
1415 } /* end of action switch */
1416 } /* end of scanning one token */
1417 } /* end of yylex */
1420 /* yy_get_next_buffer - try to read in a new buffer
1422 * Returns a code representing an action:
1423 * EOB_ACT_LAST_MATCH -
1424 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1425 * EOB_ACT_END_OF_FILE - end of file
1428 static int yy_get_next_buffer()
1430 register char *dest = yy_current_buffer->yy_ch_buf;
1431 register char *source = yytext_ptr;
1432 register int number_to_move, i;
1435 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1437 "fatal flex scanner internal error--end of buffer missed" );
1439 if ( yy_current_buffer->yy_fill_buffer == 0 )
1440 { /* Don't try to fill the buffer, so this is an EOF. */
1441 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1443 /* We matched a single character, the EOB, so
1444 * treat this as a final EOF.
1446 return EOB_ACT_END_OF_FILE;
1451 /* We matched some text prior to the EOB, first
1454 return EOB_ACT_LAST_MATCH;
1458 /* Try to read more data. */
1460 /* First move last chars to start of buffer. */
1461 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1463 for ( i = 0; i < number_to_move; ++i )
1464 *(dest++) = *(source++);
1466 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1467 /* don't do the read, it's not guaranteed to return an EOF,
1470 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1475 yy_current_buffer->yy_buf_size - number_to_move - 1;
1477 while ( num_to_read <= 0 )
1478 { /* Not enough room in the buffer - grow it. */
1479 #ifdef YY_USES_REJECT
1481 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1484 /* just a shorter name for the current buffer */
1485 YY_BUFFER_STATE b = yy_current_buffer;
1487 int yy_c_buf_p_offset =
1488 (int) (yy_c_buf_p - b->yy_ch_buf);
1490 if ( b->yy_is_our_buffer )
1492 int new_size = b->yy_buf_size * 2;
1494 if ( new_size <= 0 )
1495 b->yy_buf_size += b->yy_buf_size / 8;
1497 b->yy_buf_size *= 2;
1499 b->yy_ch_buf = (char *)
1500 /* Include room in for 2 EOB chars. */
1501 yyxrealloc( (void *) b->yy_ch_buf,
1502 b->yy_buf_size + 2 );
1505 /* Can't grow it, we don't own it. */
1508 if ( ! b->yy_ch_buf )
1510 "fatal error - scanner input buffer overflow" );
1512 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1514 num_to_read = yy_current_buffer->yy_buf_size -
1519 if ( num_to_read > YY_READ_BUF_SIZE )
1520 num_to_read = YY_READ_BUF_SIZE;
1522 /* Read in more data. */
1523 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1524 yy_n_chars, num_to_read );
1526 yy_current_buffer->yy_n_chars = yy_n_chars;
1529 if ( yy_n_chars == 0 )
1531 if ( number_to_move == YY_MORE_ADJ )
1533 ret_val = EOB_ACT_END_OF_FILE;
1539 ret_val = EOB_ACT_LAST_MATCH;
1540 yy_current_buffer->yy_buffer_status =
1541 YY_BUFFER_EOF_PENDING;
1546 ret_val = EOB_ACT_CONTINUE_SCAN;
1548 yy_n_chars += number_to_move;
1549 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1550 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1552 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1558 /* yy_get_previous_state - get the state just before the EOB char was reached */
1560 static yy_state_type yy_get_previous_state()
1562 register yy_state_type yy_current_state;
1563 register char *yy_cp;
1565 yy_current_state = yy_start;
1567 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1569 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1570 if ( yy_accept[yy_current_state] )
1572 yy_last_accepting_state = yy_current_state;
1573 yy_last_accepting_cpos = yy_cp;
1575 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1577 yy_current_state = (int) yy_def[yy_current_state];
1578 if ( yy_current_state >= 196 )
1579 yy_c = yy_meta[(unsigned int) yy_c];
1581 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1584 return yy_current_state;
1588 /* yy_try_NUL_trans - try to make a transition on the NUL character
1591 * next_state = yy_try_NUL_trans( current_state );
1594 #ifdef YY_USE_PROTOS
1595 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1597 static yy_state_type yy_try_NUL_trans( yy_current_state )
1598 yy_state_type yy_current_state;
1601 register int yy_is_jam;
1602 register char *yy_cp = yy_c_buf_p;
1604 register YY_CHAR yy_c = 1;
1605 if ( yy_accept[yy_current_state] )
1607 yy_last_accepting_state = yy_current_state;
1608 yy_last_accepting_cpos = yy_cp;
1610 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1612 yy_current_state = (int) yy_def[yy_current_state];
1613 if ( yy_current_state >= 196 )
1614 yy_c = yy_meta[(unsigned int) yy_c];
1616 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1617 yy_is_jam = (yy_current_state == 195);
1619 return yy_is_jam ? 0 : yy_current_state;
1624 #ifdef YY_USE_PROTOS
1625 static void yyunput( int c, register char *yy_bp )
1627 static void yyunput( c, yy_bp )
1629 register char *yy_bp;
1632 register char *yy_cp = yy_c_buf_p;
1634 /* undo effects of setting up yytext */
1635 *yy_cp = yy_hold_char;
1637 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1638 { /* need to shift things up to make room */
1639 /* +2 for EOB chars. */
1640 register int number_to_move = yy_n_chars + 2;
1641 register char *dest = &yy_current_buffer->yy_ch_buf[
1642 yy_current_buffer->yy_buf_size + 2];
1643 register char *source =
1644 &yy_current_buffer->yy_ch_buf[number_to_move];
1646 while ( source > yy_current_buffer->yy_ch_buf )
1647 *--dest = *--source;
1649 yy_cp += (int) (dest - source);
1650 yy_bp += (int) (dest - source);
1651 yy_current_buffer->yy_n_chars =
1652 yy_n_chars = yy_current_buffer->yy_buf_size;
1654 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1655 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1658 *--yy_cp = (char) c;
1662 yy_hold_char = *yy_cp;
1665 #endif /* ifndef YY_NO_UNPUT */
1670 static int yyinput()
1677 *yy_c_buf_p = yy_hold_char;
1679 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1681 /* yy_c_buf_p now points to the character we want to return.
1682 * If this occurs *before* the EOB characters, then it's a
1683 * valid NUL; if not, then we've hit the end of the buffer.
1685 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1686 /* This was really a NUL. */
1690 { /* need more input */
1691 int offset = yy_c_buf_p - yytext_ptr;
1694 switch ( yy_get_next_buffer() )
1696 case EOB_ACT_LAST_MATCH:
1697 /* This happens because yy_g_n_b()
1698 * sees that we've accumulated a
1699 * token and flags that we need to
1700 * try matching the token before
1701 * proceeding. But for input(),
1702 * there's no matching to consider.
1703 * So convert the EOB_ACT_LAST_MATCH
1704 * to EOB_ACT_END_OF_FILE.
1707 /* Reset buffer status. */
1712 case EOB_ACT_END_OF_FILE:
1717 if ( ! yy_did_buffer_switch_on_eof )
1726 case EOB_ACT_CONTINUE_SCAN:
1727 yy_c_buf_p = yytext_ptr + offset;
1733 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1734 *yy_c_buf_p = '\0'; /* preserve yytext */
1735 yy_hold_char = *++yy_c_buf_p;
1740 #endif /* YY_NO_INPUT */
1742 #ifdef YY_USE_PROTOS
1743 void yyrestart( FILE *input_file )
1745 void yyrestart( input_file )
1749 if ( ! yy_current_buffer )
1750 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1752 yy_init_buffer( yy_current_buffer, input_file );
1753 yy_load_buffer_state();
1757 #ifdef YY_USE_PROTOS
1758 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1760 void yy_switch_to_buffer( new_buffer )
1761 YY_BUFFER_STATE new_buffer;
1764 if ( yy_current_buffer == new_buffer )
1767 if ( yy_current_buffer )
1769 /* Flush out information for old buffer. */
1770 *yy_c_buf_p = yy_hold_char;
1771 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1772 yy_current_buffer->yy_n_chars = yy_n_chars;
1775 yy_current_buffer = new_buffer;
1776 yy_load_buffer_state();
1778 /* We don't actually know whether we did this switch during
1779 * EOF (yywrap()) processing, but the only time this flag
1780 * is looked at is after yywrap() is called, so it's safe
1781 * to go ahead and always set it.
1783 yy_did_buffer_switch_on_eof = 1;
1787 #ifdef YY_USE_PROTOS
1788 void yy_load_buffer_state( void )
1790 void yy_load_buffer_state()
1793 yy_n_chars = yy_current_buffer->yy_n_chars;
1794 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1795 yyin = yy_current_buffer->yy_input_file;
1796 yy_hold_char = *yy_c_buf_p;
1800 #ifdef YY_USE_PROTOS
1801 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1803 YY_BUFFER_STATE yy_create_buffer( file, size )
1810 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1812 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1814 b->yy_buf_size = size;
1816 /* yy_ch_buf has to be 2 characters longer than the size given because
1817 * we need to put in 2 end-of-buffer characters.
1819 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1820 if ( ! b->yy_ch_buf )
1821 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1823 b->yy_is_our_buffer = 1;
1825 yy_init_buffer( b, file );
1831 #ifdef YY_USE_PROTOS
1832 void yy_delete_buffer( YY_BUFFER_STATE b )
1834 void yy_delete_buffer( b )
1841 if ( b == yy_current_buffer )
1842 yy_current_buffer = (YY_BUFFER_STATE) 0;
1844 if ( b->yy_is_our_buffer )
1845 yy_flex_free( (void *) b->yy_ch_buf );
1847 yy_flex_free( (void *) b );
1852 #ifdef YY_USE_PROTOS
1853 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1855 void yy_init_buffer( b, file )
1862 yy_flush_buffer( b );
1864 b->yy_input_file = file;
1865 b->yy_fill_buffer = 1;
1867 #if YY_ALWAYS_INTERACTIVE
1868 b->yy_is_interactive = 1;
1870 #if YY_NEVER_INTERACTIVE
1871 b->yy_is_interactive = 0;
1873 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1879 #ifdef YY_USE_PROTOS
1880 void yy_flush_buffer( YY_BUFFER_STATE b )
1882 void yy_flush_buffer( b )
1892 /* We always need two end-of-buffer characters. The first causes
1893 * a transition to the end-of-buffer state. The second causes
1894 * a jam in that state.
1896 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1897 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1899 b->yy_buf_pos = &b->yy_ch_buf[0];
1902 b->yy_buffer_status = YY_BUFFER_NEW;
1904 if ( b == yy_current_buffer )
1905 yy_load_buffer_state();
1909 #ifndef YY_NO_SCAN_BUFFER
1910 #ifdef YY_USE_PROTOS
1911 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1913 YY_BUFFER_STATE yy_scan_buffer( base, size )
1921 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1922 base[size-1] != YY_END_OF_BUFFER_CHAR )
1923 /* They forgot to leave room for the EOB's. */
1926 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1928 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1930 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1931 b->yy_buf_pos = b->yy_ch_buf = base;
1932 b->yy_is_our_buffer = 0;
1933 b->yy_input_file = 0;
1934 b->yy_n_chars = b->yy_buf_size;
1935 b->yy_is_interactive = 0;
1937 b->yy_fill_buffer = 0;
1938 b->yy_buffer_status = YY_BUFFER_NEW;
1940 yy_switch_to_buffer( b );
1947 #ifndef YY_NO_SCAN_STRING
1948 #ifdef YY_USE_PROTOS
1949 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1951 YY_BUFFER_STATE yy_scan_string( yy_str )
1952 yyconst char *yy_str;
1956 for ( len = 0; yy_str[len]; ++len )
1959 return yy_scan_bytes( yy_str, len );
1964 #ifndef YY_NO_SCAN_BYTES
1965 #ifdef YY_USE_PROTOS
1966 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1968 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1969 yyconst char *bytes;
1978 /* Get memory for full buffer, including space for trailing EOB's. */
1980 buf = (char *) yy_flex_alloc( n );
1982 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1984 for ( i = 0; i < len; ++i )
1987 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1989 b = yy_scan_buffer( buf, n );
1991 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1993 /* It's okay to grow etc. this buffer, and we should throw it
1994 * away when we're done.
1996 b->yy_is_our_buffer = 1;
2003 #ifndef YY_NO_PUSH_STATE
2004 #ifdef YY_USE_PROTOS
2005 static void yy_push_state( int new_state )
2007 static void yy_push_state( new_state )
2011 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2015 yy_start_stack_depth += YY_START_STACK_INCR;
2016 new_size = yy_start_stack_depth * sizeof( int );
2018 if ( ! yy_start_stack )
2019 yy_start_stack = (int *) yy_flex_alloc( new_size );
2022 yy_start_stack = (int *) yyxrealloc(
2023 (void *) yy_start_stack, new_size );
2025 if ( ! yy_start_stack )
2027 "out of memory expanding start-condition stack" );
2030 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2037 #ifndef YY_NO_POP_STATE
2038 static void yy_pop_state()
2040 if ( --yy_start_stack_ptr < 0 )
2041 YY_FATAL_ERROR( "start-condition stack underflow" );
2043 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2048 #ifndef YY_NO_TOP_STATE
2049 static int yy_top_state()
2051 return yy_start_stack[yy_start_stack_ptr - 1];
2055 #ifndef YY_EXIT_FAILURE
2056 #define YY_EXIT_FAILURE 2
2059 #ifdef YY_USE_PROTOS
2060 static void yy_fatal_error( yyconst char msg[] )
2062 static void yy_fatal_error( msg )
2066 (void) fprintf( stderr, "%s\n", msg );
2067 exit( YY_EXIT_FAILURE );
2072 /* Redefine yyless() so it works in section 3 code. */
2078 /* Undo effects of setting up yytext. */ \
2079 yytext[yyleng] = yy_hold_char; \
2080 yy_c_buf_p = yytext + n; \
2081 yy_hold_char = *yy_c_buf_p; \
2082 *yy_c_buf_p = '\0'; \
2088 /* Internal utility routines. */
2091 #ifdef YY_USE_PROTOS
2092 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2094 static void yy_flex_strncpy( s1, s2, n )
2101 for ( i = 0; i < n; ++i )
2106 #ifdef YY_NEED_STRLEN
2107 #ifdef YY_USE_PROTOS
2108 static int yy_flex_strlen( yyconst char *s )
2110 static int yy_flex_strlen( s )
2115 for ( n = 0; s[n]; ++n )
2123 #ifdef YY_USE_PROTOS
2124 static void *yy_flex_alloc( yy_size_t size )
2126 static void *yy_flex_alloc( size )
2130 return (void *) xmalloc( size );
2133 #ifdef YY_USE_PROTOS
2134 static void *yyxrealloc( void *ptr, yy_size_t size )
2136 static void *yyxrealloc( ptr, size )
2141 /* The cast to (char *) in the following accommodates both
2142 * implementations that use char* generic pointers, and those
2143 * that use void* generic pointers. It works with the latter
2144 * because both ANSI C and C++ allow castless assignment from
2145 * any pointer type to void*, and deal with argument conversions
2146 * as though doing an assignment.
2148 return (void *) xrealloc( (char *) ptr, size );
2151 #ifdef YY_USE_PROTOS
2152 static void yy_flex_free( void *ptr )
2154 static void yy_flex_free( ptr )
2168 #line 289 "ada-lex.l"
2172 #include "gdb_string.h"
2174 /* Initialize the lexer for processing new expression. */
2177 lexer_init (FILE *inp)
2184 /* Copy S2 to S1, removing all underscores, and downcasing all letters. */
2187 canonicalizeNumeral (char *s1, const char *s2)
2189 for (; *s2 != '\000'; s2 += 1)
2200 /* Interprets the prefix of NUM that consists of digits of the given BASE
2201 as an integer of that BASE, with the string EXP as an exponent.
2202 Puts value in yylval, and returns INT, if the string is valid. Causes
2203 an error if the number is improperly formated. BASE, if NULL, defaults
2204 to "10", and EXP to "1". The EXP does not contain a leading 'e' or 'E'.
2208 processInt (const char *base0, const char *num0, const char *exp0)
2220 base = strtol (base0, (char **) NULL, 10);
2221 if (base < 2 || base > 16)
2222 error (_("Invalid base: %d."), base);
2228 exp = strtol(exp0, (char **) NULL, 10);
2231 result = strtoulst (num0, (const char **) &trailer, base);
2232 if (errno == ERANGE)
2233 error (_("Integer literal out of range"));
2234 if (isxdigit(*trailer))
2235 error (_("Invalid digit `%c' in based literal"), *trailer);
2239 if (result > (ULONG_MAX / base))
2240 error (_("Integer literal out of range"));
2245 if ((result >> (gdbarch_int_bit (parse_gdbarch)-1)) == 0)
2246 yylval.typed_val.type = type_int ();
2247 else if ((result >> (gdbarch_long_bit (parse_gdbarch)-1)) == 0)
2248 yylval.typed_val.type = type_long ();
2249 else if (((result >> (gdbarch_long_bit (parse_gdbarch)-1)) >> 1) == 0)
2251 /* We have a number representable as an unsigned integer quantity.
2252 For consistency with the C treatment, we will treat it as an
2253 anonymous modular (unsigned) quantity. Alas, the types are such
2254 that we need to store .val as a signed quantity. Sorry
2255 for the mess, but C doesn't officially guarantee that a simple
2256 assignment does the trick (no, it doesn't; read the reference manual).
2258 yylval.typed_val.type
2259 = builtin_type (parse_gdbarch)->builtin_unsigned_long;
2260 if (result & LONGEST_SIGN)
2261 yylval.typed_val.val =
2262 (LONGEST) (result & ~LONGEST_SIGN)
2263 - (LONGEST_SIGN>>1) - (LONGEST_SIGN>>1);
2265 yylval.typed_val.val = (LONGEST) result;
2269 yylval.typed_val.type = type_long_long ();
2271 yylval.typed_val.val = (LONGEST) result;
2276 processReal (const char *num0)
2278 sscanf (num0, "%" DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
2280 yylval.typed_val_float.type = type_float ();
2281 if (sizeof(DOUBLEST) >= gdbarch_double_bit (parse_gdbarch)
2283 yylval.typed_val_float.type = type_double ();
2284 if (sizeof(DOUBLEST) >= gdbarch_long_double_bit (parse_gdbarch)
2286 yylval.typed_val_float.type = type_long_double ();
2292 /* Store a canonicalized version of NAME0[0..LEN-1] in yylval.ssym. The
2293 resulting string is valid until the next call to ada_parse. It differs
2295 + Characters between '...' or <...> are transfered verbatim to
2297 + <, >, and trailing "'" characters in quoted sequences are removed
2298 (a leading quote is preserved to indicate that the name is not to be
2300 + Unquoted whitespace is removed.
2301 + Unquoted alphabetic characters are mapped to lower case.
2302 Result is returned as a struct stoken, but for convenience, the string
2303 is also null-terminated. Result string valid until the next call of
2306 static struct stoken
2307 processId (const char *name0, int len)
2309 char *name = obstack_alloc (&temp_parse_space, len + 11);
2311 struct stoken result;
2313 while (len > 0 && isspace (name0[len-1]))
2318 if (isalnum (name0[i0]))
2320 name[i] = tolower (name0[i0]);
2323 else switch (name0[i0])
2326 name[i] = name0[i0];
2329 case ' ': case '\t':
2335 name[i] = name0[i0];
2338 while (i0 < len && name0[i0] != '\'');
2343 while (i0 < len && name0[i0] != '>')
2345 name[i] = name0[i0];
2359 /* Return TEXT[0..LEN-1], a string literal without surrounding quotes,
2360 with special hex character notations replaced with characters.
2361 Result valid until the next call to ada_parse. */
2363 static struct stoken
2364 processString (const char *text, int len)
2368 const char *lim = text + len;
2369 struct stoken result;
2371 q = result.ptr = obstack_alloc (&temp_parse_space, len);
2375 if (p[0] == '[' && p[1] == '"' && p+2 < lim)
2377 if (p[2] == '"') /* "...["""]... */
2385 sscanf (p+2, "%2x", &chr);
2395 result.length = q - result.ptr;
2399 /* Returns the position within STR of the '.' in a
2400 '.{WHITE}*all' component of a dotted name, or -1 if there is none.
2401 Note: we actually don't need this routine, since 'all' can never be an
2402 Ada identifier. Thus, looking up foo.all or foo.all.x as a name
2403 must fail, and will eventually be interpreted as (foo).all or
2404 (foo).all.x. However, this does avoid an extraneous lookup. */
2407 find_dot_all (const char *str)
2410 for (i = 0; str[i] != '\000'; i += 1)
2417 while (isspace (str[i]));
2418 if (strncmp (str+i, "all", 3) == 0
2419 && ! isalnum (str[i+3]) && str[i+3] != '_')
2426 /* Returns non-zero iff string SUBSEQ matches a subsequence of STR, ignoring
2430 subseqMatch (const char *subseq, const char *str)
2432 if (subseq[0] == '\0')
2434 else if (str[0] == '\0')
2436 else if (tolower (subseq[0]) == tolower (str[0]))
2437 return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1);
2439 return subseqMatch (subseq, str+1);
2443 static struct { const char *name; int code; }
2445 { "address", TICK_ADDRESS },
2446 { "unchecked_access", TICK_ACCESS },
2447 { "unrestricted_access", TICK_ACCESS },
2448 { "access", TICK_ACCESS },
2449 { "first", TICK_FIRST },
2450 { "last", TICK_LAST },
2451 { "length", TICK_LENGTH },
2452 { "max", TICK_MAX },
2453 { "min", TICK_MIN },
2454 { "modulus", TICK_MODULUS },
2455 { "pos", TICK_POS },
2456 { "range", TICK_RANGE },
2457 { "size", TICK_SIZE },
2458 { "tag", TICK_TAG },
2459 { "val", TICK_VAL },
2463 /* Return the syntactic code corresponding to the attribute name or
2464 abbreviation STR. */
2467 processAttribute (const char *str)
2471 for (i = 0; attributes[i].code != -1; i += 1)
2472 if (strcasecmp (str, attributes[i].name) == 0)
2473 return attributes[i].code;
2475 for (i = 0, k = -1; attributes[i].code != -1; i += 1)
2476 if (subseqMatch (str, attributes[i].name))
2481 error (_("ambiguous attribute name: `%s'"), str);
2484 error (_("unrecognized attribute: `%s'"), str);
2486 return attributes[k].code;
2495 /* Dummy definition to suppress warnings about unused static definitions. */
2496 typedef void (*dummy_function) ();
2497 dummy_function ada_flex_use[] =
2499 (dummy_function) yyunput