]> git.saurik.com Git - bison.git/blame_incremental - src/scan-gram.c
Regen.
[bison.git] / src / scan-gram.c
... / ...
CommitLineData
1#define yy_create_buffer gram__create_buffer
2#define yy_delete_buffer gram__delete_buffer
3#define yy_scan_buffer gram__scan_buffer
4#define yy_scan_string gram__scan_string
5#define yy_scan_bytes gram__scan_bytes
6#define yy_flex_debug gram__flex_debug
7#define yy_init_buffer gram__init_buffer
8#define yy_flush_buffer gram__flush_buffer
9#define yy_load_buffer_state gram__load_buffer_state
10#define yy_switch_to_buffer gram__switch_to_buffer
11#define yyin gram_in
12#define yyleng gram_leng
13#define yylex gram_lex
14#define yyout gram_out
15#define yyrestart gram_restart
16#define yytext gram_text
17
18#line 19 "scan-gram.c"
19/* A lexical scanner generated by flex */
20
21/* Scanner skeleton version:
22 * $Header$
23 */
24
25#define FLEX_SCANNER
26#define YY_FLEX_MAJOR_VERSION 2
27#define YY_FLEX_MINOR_VERSION 5
28
29#include <stdio.h>
30
31
32/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
33#ifdef c_plusplus
34#ifndef __cplusplus
35#define __cplusplus
36#endif
37#endif
38
39
40#ifdef __cplusplus
41
42#include <stdlib.h>
43#include <unistd.h>
44
45/* Use prototypes in function declarations. */
46#define YY_USE_PROTOS
47
48/* The "const" storage-class-modifier is valid. */
49#define YY_USE_CONST
50
51#else /* ! __cplusplus */
52
53#if __STDC__
54
55#define YY_USE_PROTOS
56#define YY_USE_CONST
57
58#endif /* __STDC__ */
59#endif /* ! __cplusplus */
60
61#ifdef __TURBOC__
62 #pragma warn -rch
63 #pragma warn -use
64#include <io.h>
65#include <stdlib.h>
66#define YY_USE_CONST
67#define YY_USE_PROTOS
68#endif
69
70#ifdef YY_USE_CONST
71#define yyconst const
72#else
73#define yyconst
74#endif
75
76
77#ifdef YY_USE_PROTOS
78#define YY_PROTO(proto) proto
79#else
80#define YY_PROTO(proto) ()
81#endif
82
83/* Returned upon end-of-file. */
84#define YY_NULL 0
85
86/* Promotes a possibly negative, possibly signed char to an unsigned
87 * integer for use as an array index. If the signed char is negative,
88 * we want to instead treat it as an 8-bit unsigned char, hence the
89 * double cast.
90 */
91#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
92
93/* Enter a start condition. This macro really ought to take a parameter,
94 * but we do it the disgusting crufty way forced on us by the ()-less
95 * definition of BEGIN.
96 */
97#define BEGIN yy_start = 1 + 2 *
98
99/* Translate the current start state into a value that can be later handed
100 * to BEGIN to return to the state. The YYSTATE alias is for lex
101 * compatibility.
102 */
103#define YY_START ((yy_start - 1) / 2)
104#define YYSTATE YY_START
105
106/* Action number for EOF rule of a given start state. */
107#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
108
109/* Special action meaning "start processing a new file". */
110#define YY_NEW_FILE yyrestart( yyin )
111
112#define YY_END_OF_BUFFER_CHAR 0
113
114/* Size of default input buffer. */
115#define YY_BUF_SIZE 16384
116
117typedef struct yy_buffer_state *YY_BUFFER_STATE;
118
119extern int yyleng;
120extern FILE *yyin, *yyout;
121
122#define EOB_ACT_CONTINUE_SCAN 0
123#define EOB_ACT_END_OF_FILE 1
124#define EOB_ACT_LAST_MATCH 2
125
126/* The funky do-while in the following #define is used to turn the definition
127 * int a single C statement (which needs a semi-colon terminator). This
128 * avoids problems with code like:
129 *
130 * if ( condition_holds )
131 * yyless( 5 );
132 * else
133 * do_something_else();
134 *
135 * Prior to using the do-while the compiler would get upset at the
136 * "else" because it interpreted the "if" statement as being all
137 * done when it reached the ';' after the yyless() call.
138 */
139
140/* Return all but the first 'n' matched characters back to the input stream. */
141
142#define yyless(n) \
143 do \
144 { \
145 /* Undo effects of setting up yytext. */ \
146 *yy_cp = yy_hold_char; \
147 YY_RESTORE_YY_MORE_OFFSET \
148 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
149 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
150 } \
151 while ( 0 )
152
153#define unput(c) yyunput( c, yytext_ptr )
154
155/* The following is because we cannot portably get our hands on size_t
156 * (without autoconf's help, which isn't available because we want
157 * flex-generated scanners to compile on their own).
158 */
159typedef unsigned int yy_size_t;
160
161
162struct yy_buffer_state
163 {
164 FILE *yy_input_file;
165
166 char *yy_ch_buf; /* input buffer */
167 char *yy_buf_pos; /* current position in input buffer */
168
169 /* Size of input buffer in bytes, not including room for EOB
170 * characters.
171 */
172 yy_size_t yy_buf_size;
173
174 /* Number of characters read into yy_ch_buf, not including EOB
175 * characters.
176 */
177 int yy_n_chars;
178
179 /* Whether we "own" the buffer - i.e., we know we created it,
180 * and can realloc() it to grow it, and should free() it to
181 * delete it.
182 */
183 int yy_is_our_buffer;
184
185 /* Whether this is an "interactive" input source; if so, and
186 * if we're using stdio for input, then we want to use getc()
187 * instead of fread(), to make sure we stop fetching input after
188 * each newline.
189 */
190 int yy_is_interactive;
191
192 /* Whether we're considered to be at the beginning of a line.
193 * If so, '^' rules will be active on the next match, otherwise
194 * not.
195 */
196 int yy_at_bol;
197
198 /* Whether to try to fill the input buffer when we reach the
199 * end of it.
200 */
201 int yy_fill_buffer;
202
203 int yy_buffer_status;
204#define YY_BUFFER_NEW 0
205#define YY_BUFFER_NORMAL 1
206 /* When an EOF's been seen but there's still some text to process
207 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
208 * shouldn't try reading from the input source any more. We might
209 * still have a bunch of tokens to match, though, because of
210 * possible backing-up.
211 *
212 * When we actually see the EOF, we change the status to "new"
213 * (via yyrestart()), so that the user can continue scanning by
214 * just pointing yyin at a new input file.
215 */
216#define YY_BUFFER_EOF_PENDING 2
217 };
218
219static YY_BUFFER_STATE yy_current_buffer = 0;
220
221/* We provide macros for accessing buffer states in case in the
222 * future we want to put the buffer states in a more general
223 * "scanner state".
224 */
225#define YY_CURRENT_BUFFER yy_current_buffer
226
227
228/* yy_hold_char holds the character lost when yytext is formed. */
229static char yy_hold_char;
230
231static int yy_n_chars; /* number of characters read into yy_ch_buf */
232
233
234int yyleng;
235
236/* Points to current character in buffer. */
237static char *yy_c_buf_p = (char *) 0;
238static int yy_init = 1; /* whether we need to initialize */
239static int yy_start = 0; /* start state number */
240
241/* Flag which is used to allow yywrap()'s to do buffer switches
242 * instead of setting up a fresh yyin. A bit of a hack ...
243 */
244static int yy_did_buffer_switch_on_eof;
245
246void yyrestart YY_PROTO(( FILE *input_file ));
247
248void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
249void yy_load_buffer_state YY_PROTO(( void ));
250YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
251void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
252void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
253void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
254#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
255
256YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
257YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
258YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
259
260static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
261static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
262static void yy_flex_free YY_PROTO(( void * ));
263
264#define yy_new_buffer yy_create_buffer
265
266#define yy_set_interactive(is_interactive) \
267 { \
268 if ( ! yy_current_buffer ) \
269 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
270 yy_current_buffer->yy_is_interactive = is_interactive; \
271 }
272
273#define yy_set_bol(at_bol) \
274 { \
275 if ( ! yy_current_buffer ) \
276 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
277 yy_current_buffer->yy_at_bol = at_bol; \
278 }
279
280#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
281
282
283#define yywrap() 1
284#define YY_SKIP_YYWRAP
285
286#define FLEX_DEBUG
287typedef unsigned char YY_CHAR;
288FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
289typedef int yy_state_type;
290
291#define FLEX_DEBUG
292extern char *yytext;
293#define yytext_ptr yytext
294
295static yy_state_type yy_get_previous_state YY_PROTO(( void ));
296static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
297static int yy_get_next_buffer YY_PROTO(( void ));
298static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
299
300/* Done after the current pattern has been matched and before the
301 * corresponding action - sets up yytext.
302 */
303#define YY_DO_BEFORE_ACTION \
304 yytext_ptr = yy_bp; \
305 yyleng = (int) (yy_cp - yy_bp); \
306 yy_hold_char = *yy_cp; \
307 *yy_cp = '\0'; \
308 yy_c_buf_p = yy_cp;
309
310#define YY_NUM_RULES 102
311#define YY_END_OF_BUFFER 103
312static yyconst short int yy_accept[391] =
313 { 0,
314 0, 0, 0, 0, 59, 59, 0, 0, 85, 85,
315 80, 80, 0, 0, 0, 0, 0, 0, 0, 0,
316 0, 0, 103, 51, 40, 40, 44, 51, 43, 38,
317 41, 51, 42, 36, 39, 51, 35, 48, 37, 57,
318 57, 52, 53, 59, 58, 59, 55, 55, 83, 82,
319 86, 78, 77, 81, 61, 60, 76, 63, 62, 96,
320 96, 88, 97, 87, 91, 97, 52, 53, 93, 92,
321 99, 88, 100, 87, 91, 101, 88, 87, 91, 40,
322 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
323 0, 0, 0, 0, 0, 0, 0, 47, 41, 45,
324
325 46, 42, 0, 57, 56, 0, 59, 59, 59, 59,
326 55, 54, 83, 84, 84, 84, 84, 78, 79, 79,
327 79, 79, 61, 75, 73, 64, 75, 66, 67, 68,
328 69, 70, 71, 75, 72, 75, 63, 96, 94, 0,
329 94, 0, 89, 90, 0, 95, 0, 95, 99, 98,
330 101, 89, 90, 101, 0, 0, 0, 0, 0, 0,
331 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
332 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
333 46, 49, 0, 0, 0, 85, 0, 0, 0, 0,
334 80, 0, 0, 0, 64, 0, 0, 65, 0, 0,
335
336 0, 101, 101, 0, 0, 0, 0, 0, 0, 0,
337 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
338 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
339 0, 0, 0, 0, 0, 64, 0, 0, 0, 0,
340 0, 0, 0, 0, 0, 0, 0, 0, 0, 12,
341 0, 0, 0, 0, 0, 0, 0, 0, 0, 21,
342 0, 0, 0, 0, 0, 28, 0, 31, 0, 0,
343 34, 0, 0, 0, 2, 0, 0, 6, 0, 0,
344 0, 0, 0, 0, 0, 14, 0, 0, 0, 18,
345 0, 0, 0, 0, 24, 0, 27, 29, 32, 0,
346
347 0, 74, 1, 3, 0, 0, 8, 0, 0, 0,
348 0, 0, 0, 0, 0, 19, 0, 0, 0, 0,
349 0, 0, 4, 0, 0, 0, 0, 0, 0, 0,
350 0, 0, 0, 0, 22, 0, 0, 0, 33, 0,
351 0, 0, 0, 0, 0, 0, 0, 16, 17, 0,
352 0, 26, 0, 0, 0, 0, 0, 0, 25, 13,
353 0, 0, 0, 0, 5, 0, 0, 0, 11, 0,
354 0, 0, 0, 0, 9, 0, 15, 20, 23, 30,
355 0, 0, 7, 0, 0, 0, 0, 0, 10, 0
356 } ;
357
358static yyconst int yy_ec[256] =
359 { 0,
360 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
361 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
362 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
363 1, 2, 1, 4, 1, 5, 6, 1, 7, 1,
364 1, 8, 1, 9, 10, 11, 12, 13, 13, 13,
365 13, 13, 13, 13, 13, 14, 14, 15, 16, 17,
366 18, 19, 20, 21, 22, 22, 22, 22, 22, 22,
367 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
368 11, 11, 11, 11, 23, 11, 11, 11, 11, 11,
369 24, 25, 26, 1, 27, 1, 28, 29, 30, 31,
370
371 32, 33, 34, 35, 36, 11, 37, 38, 39, 40,
372 41, 42, 11, 43, 44, 45, 46, 47, 11, 48,
373 49, 11, 50, 51, 52, 1, 1, 1, 1, 1,
374 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
379 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381
382 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
383 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
386 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
387 1, 1, 1, 1, 1
388 } ;
389
390static yyconst int yy_meta[54] =
391 { 0,
392 1, 1, 2, 3, 4, 5, 6, 7, 1, 1,
393 8, 9, 10, 10, 1, 1, 1, 1, 11, 1,
394 4, 10, 8, 12, 13, 12, 8, 10, 10, 10,
395 10, 10, 10, 8, 8, 8, 8, 8, 8, 8,
396 8, 8, 8, 8, 8, 8, 8, 8, 8, 4,
397 1, 4, 11
398 } ;
399
400static yyconst short int yy_base[427] =
401 { 0,
402 0, 0, 46, 47, 53, 56, 802, 801, 59, 62,
403 50, 82, 65, 87, 85, 86, 110, 160, 92, 117,
404 121, 128, 808, 811, 58, 62, 811, 207, 811, 811,
405 0, 50, 54, 811, 811, 0, 811, 811, 811, 0,
406 114, 811, 811, 782, 811, 117, 0, 794, 0, 811,
407 146, 0, 811, 148, 0, 811, 254, 0, 811, 0,
408 0, 811, 165, 811, 149, 175, 811, 811, 811, 811,
409 0, 811, 753, 811, 175, 0, 0, 0, 182, 92,
410 811, 768, 95, 54, 767, 764, 68, 769, 163, 754,
411 110, 763, 121, 127, 758, 765, 768, 811, 0, 811,
412
413 0, 179, 776, 0, 811, 193, 769, 195, 199, 768,
414 0, 811, 0, 811, 203, 767, 212, 0, 811, 214,
415 766, 216, 0, 811, 811, 777, 0, 811, 811, 811,
416 811, 811, 811, 0, 811, 0, 0, 0, 811, 208,
417 212, 0, 811, 811, 225, 811, 216, 218, 0, 811,
418 0, 0, 0, 231, 749, 226, 745, 744, 744, 161,
419 742, 227, 754, 740, 743, 253, 749, 735, 736, 69,
420 735, 743, 744, 747, 731, 736, 730, 735, 727, 739,
421 0, 811, 240, 253, 266, 743, 269, 282, 742, 286,
422 741, 288, 293, 740, 751, 0, 0, 0, 744, 301,
423
424 297, 304, 300, 734, 715, 724, 714, 726, 716, 724,
425 723, 722, 743, 707, 741, 722, 715, 716, 709, 718,
426 702, 702, 699, 712, 701, 708, 704, 700, 694, 697,
427 703, 702, 692, 703, 701, 811, 0, 0, 305, 687,
428 695, 688, 684, 696, 682, 694, 713, 691, 679, 811,
429 678, 674, 686, 254, 681, 672, 676, 668, 681, 811,
430 667, 301, 666, 678, 664, 811, 668, 811, 667, 665,
431 811, 0, 0, 656, 811, 672, 657, 811, 303, 657,
432 659, 304, 672, 671, 662, 811, 655, 656, 651, 811,
433 649, 683, 660, 649, 811, 645, 811, 306, 811, 645,
434
435 0, 811, 811, 644, 657, 639, 811, 642, 643, 640,
436 639, 640, 637, 647, 637, 811, 635, 633, 647, 633,
437 628, 640, 811, 626, 638, 635, 612, 601, 614, 589,
438 594, 579, 592, 592, 811, 573, 573, 582, 811, 567,
439 564, 565, 525, 534, 510, 498, 489, 811, 811, 470,
440 461, 811, 466, 449, 458, 442, 427, 423, 811, 811,
441 296, 301, 295, 288, 811, 283, 275, 275, 811, 272,
442 259, 249, 254, 232, 811, 228, 811, 811, 811, 811,
443 234, 307, 811, 229, 208, 199, 203, 179, 811, 811,
444 334, 347, 360, 373, 386, 399, 412, 425, 438, 451,
445
446 457, 467, 480, 493, 506, 519, 530, 543, 554, 567,
447 579, 592, 604, 617, 630, 643, 201, 193, 167, 656,
448 159, 145, 136, 134, 120, 93
449 } ;
450
451static yyconst short int yy_def[427] =
452 { 0,
453 390, 1, 391, 391, 392, 392, 393, 393, 394, 394,
454 395, 395, 396, 396, 397, 397, 398, 398, 399, 399,
455 400, 400, 390, 390, 390, 390, 390, 390, 390, 390,
456 401, 390, 390, 390, 390, 402, 390, 390, 390, 403,
457 390, 390, 390, 404, 390, 404, 405, 390, 406, 390,
458 407, 408, 390, 409, 410, 390, 411, 412, 390, 413,
459 413, 390, 390, 390, 390, 390, 390, 390, 390, 390,
460 414, 390, 390, 390, 390, 415, 415, 415, 415, 390,
461 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
462 390, 390, 390, 390, 390, 390, 390, 390, 401, 390,
463
464 416, 390, 402, 403, 390, 390, 404, 404, 404, 404,
465 405, 390, 406, 390, 390, 390, 390, 408, 390, 390,
466 390, 390, 410, 390, 390, 390, 417, 390, 390, 390,
467 390, 390, 390, 418, 390, 419, 412, 413, 390, 390,
468 390, 420, 390, 390, 390, 390, 390, 390, 414, 390,
469 415, 415, 415, 415, 390, 390, 390, 390, 390, 390,
470 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
471 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
472 416, 390, 390, 390, 390, 390, 390, 390, 407, 390,
473 390, 390, 390, 409, 390, 421, 422, 419, 420, 390,
474
475 390, 415, 415, 390, 390, 390, 390, 390, 390, 390,
476 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
477 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
478 390, 390, 390, 390, 390, 390, 423, 424, 390, 390,
479 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
480 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
481 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
482 390, 425, 426, 390, 390, 390, 390, 390, 390, 390,
483 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
484 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
485
486 418, 390, 390, 390, 390, 390, 390, 390, 390, 390,
487 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
488 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
489 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
490 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
491 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
492 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
493 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
494 390, 390, 390, 390, 390, 390, 390, 390, 390, 0,
495 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
496
497 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
498 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
499 390, 390, 390, 390, 390, 390
500 } ;
501
502static yyconst short int yy_nxt[865] =
503 { 0,
504 24, 25, 26, 27, 24, 28, 29, 24, 30, 24,
505 31, 32, 33, 33, 34, 35, 36, 37, 24, 24,
506 24, 31, 31, 24, 24, 24, 31, 31, 31, 31,
507 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
508 31, 31, 31, 31, 31, 31, 31, 31, 31, 38,
509 39, 24, 24, 41, 41, 45, 53, 100, 45, 80,
510 80, 101, 50, 80, 80, 50, 102, 102, 56, 42,
511 42, 43, 43, 42, 54, 43, 42, 46, 43, 42,
512 46, 43, 42, 51, 43, 42, 51, 43, 53, 57,
513 56, 59, 59, 80, 80, 72, 158, 73, 74, 162,
514
515 224, 159, 302, 75, 225, 42, 54, 43, 163, 57,
516 57, 57, 61, 62, 63, 42, 64, 43, 109, 110,
517 72, 65, 73, 74, 77, 105, 156, 78, 75, 301,
518 66, 77, 79, 67, 78, 68, 157, 169, 106, 79,
519 42, 108, 43, 273, 42, 272, 43, 115, 116, 120,
520 121, 42, 170, 43, 238, 171, 143, 173, 175, 69,
521 144, 70, 61, 62, 63, 174, 64, 176, 237, 139,
522 117, 65, 122, 145, 140, 177, 198, 141, 141, 146,
523 66, 142, 143, 67, 147, 68, 144, 148, 148, 152,
524 165, 102, 102, 153, 183, 184, 109, 110, 211, 145,
525
526 109, 110, 197, 166, 185, 186, 154, 167, 212, 69,
527 196, 70, 81, 188, 189, 190, 191, 193, 194, 108,
528 141, 141, 389, 108, 141, 141, 200, 201, 148, 148,
529 148, 148, 202, 203, 388, 82, 387, 83, 84, 85,
530 86, 183, 184, 386, 87, 88, 89, 90, 91, 92,
531 93, 94, 95, 96, 205, 97, 98, 125, 206, 214,
532 125, 385, 219, 287, 105, 383, 126, 185, 186, 207,
533 185, 186, 382, 125, 215, 381, 127, 106, 125, 219,
534 287, 128, 129, 188, 189, 380, 130, 190, 191, 190,
535 191, 379, 220, 131, 193, 194, 132, 378, 133, 134,
536
537 135, 136, 200, 201, 143, 202, 203, 152, 144, 139,
538 294, 153, 306, 309, 140, 321, 384, 141, 141, 377,
539 376, 145, 375, 374, 154, 373, 372, 294, 371, 306,
540 309, 370, 321, 384, 40, 40, 40, 40, 40, 40,
541 40, 40, 40, 40, 40, 40, 40, 44, 44, 44,
542 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
543 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
544 47, 47, 47, 49, 49, 49, 49, 49, 49, 49,
545 49, 49, 49, 49, 49, 49, 52, 52, 52, 52,
546 52, 52, 52, 52, 52, 52, 52, 52, 52, 55,
547
548 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
549 55, 55, 58, 58, 58, 58, 58, 58, 58, 58,
550 58, 58, 58, 58, 58, 60, 60, 60, 60, 60,
551 60, 60, 60, 60, 60, 60, 60, 60, 71, 71,
552 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
553 71, 76, 76, 76, 76, 76, 76, 76, 76, 76,
554 76, 76, 76, 76, 99, 369, 99, 103, 368, 103,
555 103, 103, 103, 103, 103, 103, 103, 367, 103, 103,
556 104, 104, 104, 104, 104, 104, 366, 104, 104, 104,
557 104, 365, 104, 107, 364, 107, 107, 107, 107, 107,
558
559 107, 107, 107, 107, 363, 107, 111, 111, 111, 111,
560 111, 111, 362, 111, 111, 111, 111, 111, 111, 113,
561 113, 361, 113, 113, 113, 113, 113, 113, 113, 113,
562 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
563 114, 360, 114, 118, 118, 118, 118, 118, 359, 118,
564 118, 118, 118, 118, 119, 119, 119, 119, 119, 119,
565 119, 119, 119, 119, 119, 358, 119, 123, 123, 357,
566 123, 123, 123, 123, 123, 123, 123, 123, 123, 124,
567 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
568 124, 124, 137, 137, 137, 137, 137, 356, 137, 137,
569
570 137, 137, 137, 137, 138, 138, 355, 354, 138, 353,
571 138, 138, 352, 138, 138, 351, 138, 149, 149, 350,
572 149, 349, 348, 149, 149, 347, 149, 149, 346, 149,
573 151, 151, 151, 151, 151, 151, 151, 151, 151, 151,
574 151, 345, 151, 181, 344, 181, 181, 181, 181, 181,
575 181, 181, 181, 181, 181, 181, 199, 343, 199, 199,
576 199, 199, 199, 199, 199, 199, 342, 199, 199, 341,
577 340, 339, 338, 337, 336, 335, 334, 333, 332, 331,
578 330, 329, 328, 327, 326, 325, 324, 323, 322, 320,
579 319, 318, 317, 316, 315, 314, 313, 312, 311, 310,
580
581 308, 307, 305, 304, 303, 300, 299, 298, 297, 296,
582 295, 293, 292, 291, 290, 289, 288, 286, 285, 284,
583 283, 282, 281, 280, 279, 278, 277, 276, 275, 274,
584 271, 270, 269, 268, 267, 266, 265, 264, 263, 262,
585 261, 260, 259, 258, 257, 256, 255, 254, 253, 252,
586 251, 250, 249, 248, 247, 246, 245, 244, 243, 242,
587 241, 240, 239, 236, 122, 192, 117, 187, 235, 234,
588 233, 232, 231, 230, 229, 228, 227, 226, 223, 222,
589 221, 218, 217, 216, 213, 210, 209, 208, 204, 195,
590 192, 187, 108, 108, 182, 180, 179, 178, 172, 168,
591
592 164, 161, 160, 155, 150, 112, 108, 390, 48, 48,
593 23, 390, 390, 390, 390, 390, 390, 390, 390, 390,
594 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
595 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
596 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
597 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
598 390, 390, 390, 390
599 } ;
600
601static yyconst short int yy_chk[865] =
602 { 0,
603 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
604 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
605 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
606 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
607 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
608 1, 1, 1, 3, 4, 5, 11, 32, 6, 25,
609 25, 32, 9, 26, 26, 10, 33, 33, 13, 3,
610 4, 3, 4, 11, 11, 11, 5, 5, 5, 6,
611 6, 6, 9, 9, 9, 10, 10, 10, 12, 13,
612 14, 15, 16, 80, 80, 19, 84, 19, 19, 87,
613
614 170, 84, 426, 19, 170, 12, 12, 12, 87, 15,
615 16, 14, 17, 17, 17, 19, 17, 19, 46, 46,
616 20, 17, 20, 20, 21, 41, 83, 21, 20, 425,
617 17, 22, 21, 17, 22, 17, 83, 91, 41, 22,
618 20, 46, 20, 424, 21, 423, 21, 51, 51, 54,
619 54, 22, 91, 22, 422, 91, 65, 93, 94, 17,
620 65, 17, 18, 18, 18, 93, 18, 94, 421, 63,
621 51, 18, 54, 65, 63, 94, 419, 63, 63, 66,
622 18, 63, 75, 18, 66, 18, 75, 66, 66, 79,
623 89, 102, 102, 79, 106, 106, 108, 108, 160, 75,
624
625 109, 109, 418, 89, 115, 115, 79, 89, 160, 18,
626 417, 18, 28, 117, 117, 120, 120, 122, 122, 108,
627 140, 140, 388, 109, 141, 141, 145, 145, 147, 147,
628 148, 148, 154, 154, 387, 28, 386, 28, 28, 28,
629 28, 183, 183, 385, 28, 28, 28, 28, 28, 28,
630 28, 28, 28, 28, 156, 28, 28, 57, 156, 162,
631 57, 384, 166, 254, 184, 381, 57, 185, 185, 156,
632 187, 187, 376, 57, 162, 374, 57, 184, 57, 166,
633 254, 57, 57, 188, 188, 373, 57, 190, 190, 192,
634 192, 372, 166, 57, 193, 193, 57, 371, 57, 57,
635
636 57, 57, 200, 200, 201, 202, 202, 203, 201, 239,
637 262, 203, 279, 282, 239, 298, 382, 239, 239, 370,
638 368, 201, 367, 366, 203, 364, 363, 262, 362, 279,
639 282, 361, 298, 382, 391, 391, 391, 391, 391, 391,
640 391, 391, 391, 391, 391, 391, 391, 392, 392, 392,
641 392, 392, 392, 392, 392, 392, 392, 392, 392, 392,
642 393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
643 393, 393, 393, 394, 394, 394, 394, 394, 394, 394,
644 394, 394, 394, 394, 394, 394, 395, 395, 395, 395,
645 395, 395, 395, 395, 395, 395, 395, 395, 395, 396,
646
647 396, 396, 396, 396, 396, 396, 396, 396, 396, 396,
648 396, 396, 397, 397, 397, 397, 397, 397, 397, 397,
649 397, 397, 397, 397, 397, 398, 398, 398, 398, 398,
650 398, 398, 398, 398, 398, 398, 398, 398, 399, 399,
651 399, 399, 399, 399, 399, 399, 399, 399, 399, 399,
652 399, 400, 400, 400, 400, 400, 400, 400, 400, 400,
653 400, 400, 400, 400, 401, 358, 401, 402, 357, 402,
654 402, 402, 402, 402, 402, 402, 402, 356, 402, 402,
655 403, 403, 403, 403, 403, 403, 355, 403, 403, 403,
656 403, 354, 403, 404, 353, 404, 404, 404, 404, 404,
657
658 404, 404, 404, 404, 351, 404, 405, 405, 405, 405,
659 405, 405, 350, 405, 405, 405, 405, 405, 405, 406,
660 406, 347, 406, 406, 406, 406, 406, 406, 406, 406,
661 407, 407, 407, 407, 407, 407, 407, 407, 407, 407,
662 407, 346, 407, 408, 408, 408, 408, 408, 345, 408,
663 408, 408, 408, 408, 409, 409, 409, 409, 409, 409,
664 409, 409, 409, 409, 409, 344, 409, 410, 410, 343,
665 410, 410, 410, 410, 410, 410, 410, 410, 410, 411,
666 411, 411, 411, 411, 411, 411, 411, 411, 411, 411,
667 411, 411, 412, 412, 412, 412, 412, 342, 412, 412,
668
669 412, 412, 412, 412, 413, 413, 341, 340, 413, 338,
670 413, 413, 337, 413, 413, 336, 413, 414, 414, 334,
671 414, 333, 332, 414, 414, 331, 414, 414, 330, 414,
672 415, 415, 415, 415, 415, 415, 415, 415, 415, 415,
673 415, 329, 415, 416, 328, 416, 416, 416, 416, 416,
674 416, 416, 416, 416, 416, 416, 420, 327, 420, 420,
675 420, 420, 420, 420, 420, 420, 326, 420, 420, 325,
676 324, 322, 321, 320, 319, 318, 317, 315, 314, 313,
677 312, 311, 310, 309, 308, 306, 305, 304, 300, 296,
678 294, 293, 292, 291, 289, 288, 287, 285, 284, 283,
679
680 281, 280, 277, 276, 274, 270, 269, 267, 265, 264,
681 263, 261, 259, 258, 257, 256, 255, 253, 252, 251,
682 249, 248, 247, 246, 245, 244, 243, 242, 241, 240,
683 235, 234, 233, 232, 231, 230, 229, 228, 227, 226,
684 225, 224, 223, 222, 221, 220, 219, 218, 217, 216,
685 215, 214, 213, 212, 211, 210, 209, 208, 207, 206,
686 205, 204, 199, 195, 194, 191, 189, 186, 180, 179,
687 178, 177, 176, 175, 174, 173, 172, 171, 169, 168,
688 167, 165, 164, 163, 161, 159, 158, 157, 155, 126,
689 121, 116, 110, 107, 103, 97, 96, 95, 92, 90,
690
691 88, 86, 85, 82, 73, 48, 44, 23, 8, 7,
692 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
693 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
694 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
695 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
696 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
697 390, 390, 390, 390
698 } ;
699
700static yy_state_type yy_last_accepting_state;
701static char *yy_last_accepting_cpos;
702
703extern int yy_flex_debug;
704int yy_flex_debug = 1;
705
706static yyconst short int yy_rule_linenum[102] =
707 { 0,
708 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
709 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
710 235, 236, 237, 238, 239, 240, 241, 242, 243, 244,
711 245, 246, 247, 248, 250, 251, 252, 253, 254, 256,
712 258, 264, 278, 281, 284, 285, 288, 291, 294, 302,
713 308, 324, 325, 335, 340, 356, 357, 373, 374, 386,
714 396, 416, 432, 452, 464, 478, 479, 480, 481, 482,
715 483, 484, 485, 486, 497, 503, 514, 520, 521, 522,
716 524, 542, 548, 549, 550, 552, 570, 573, 576, 577,
717 580, 591, 603, 605, 607, 610, 613, 633, 640, 641,
718
719 661
720 } ;
721
722/* The intent behind this definition is that it'll catch
723 * any uses of REJECT which flex missed.
724 */
725#define REJECT reject_used_but_not_detected
726#define yymore() yymore_used_but_not_detected
727#define YY_MORE_ADJ 0
728#define YY_RESTORE_YY_MORE_OFFSET
729char *yytext;
730#line 1 "scan-gram.l"
731#define INITIAL 0
732/* Bison Grammar Scanner -*- C -*-
733 Copyright (C) 2002 Free Software Foundation, Inc.
734
735 This file is part of Bison, the GNU Compiler Compiler.
736
737 This program is free software; you can redistribute it and/or modify
738 it under the terms of the GNU General Public License as published by
739 the Free Software Foundation; either version 2 of the License, or
740 (at your option) any later version.
741
742 This program is distributed in the hope that it will be useful,
743 but WITHOUT ANY WARRANTY; without even the implied warranty of
744 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
745 GNU General Public License for more details.
746
747 You should have received a copy of the GNU General Public License
748 along with this program; if not, write to the Free Software
749 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
750 02111-1307 USA
751*/
752#define YY_NO_UNPUT 1
753#define YY_NEVER_INTERACTIVE 1
754#define YY_STACK_USED 1
755#line 26 "scan-gram.l"
756#include "system.h"
757#include "mbswidth.h"
758#include "complain.h"
759#include "quote.h"
760#include "getargs.h"
761#include "gram.h"
762#include "reader.h"
763
764/* Each time we match a string, move the end cursor to its end. */
765#define YY_USER_INIT \
766do { \
767 LOCATION_RESET (*yylloc); \
768 yylloc->file = infile; \
769 /* This is only to avoid GCC warnings. */ \
770 if (yycontrol) {;}; \
771} while (0)
772
773#define YY_USER_ACTION extend_location (yylloc, yytext, yyleng);
774#define YY_STEP LOCATION_STEP (*yylloc)
775
776#define YY_INPUT(buf, result, size) ((result) = no_cr_read (yyin, buf, size))
777
778
779/* Read bytes from FP into buffer BUF of size SIZE. Return the
780 number of bytes read. Remove '\r' from input, treating \r\n
781 and isolated \r as \n. */
782
783static size_t
784no_cr_read (FILE *fp, char *buf, size_t size)
785{
786 size_t s = fread (buf, 1, size, fp);
787 if (s)
788 {
789 char *w = memchr (buf, '\r', s);
790 if (w)
791 {
792 char const *r = ++w;
793 char const *lim = buf + s;
794
795 for (;;)
796 {
797 /* Found an '\r'. Treat it like '\n', but ignore any
798 '\n' that immediately follows. */
799 w[-1] = '\n';
800 if (r == lim)
801 {
802 int ch = getc (fp);
803 if (ch != '\n' && ungetc (ch, fp) != ch)
804 break;
805 }
806 else if (*r == '\n')
807 r++;
808
809 /* Copy until the next '\r'. */
810 do
811 {
812 if (r == lim)
813 return w - buf;
814 }
815 while ((*w++ = *r++) != '\r');
816 }
817
818 return w - buf;
819 }
820 }
821
822 return s;
823}
824
825
826/* Extend *LOC to account for token TOKEN of size SIZE. */
827
828static void
829extend_location (location_t *loc, char const *token, int size)
830{
831 int line = loc->last_line;
832 int column = loc->last_column;
833 char const *p0 = token;
834 char const *p = token;
835 char const *lim = token + size;
836
837 for (p = token; p < lim; p++)
838 switch (*p)
839 {
840 case '\r':
841 /* \r shouldn't survive no_cr_read. */
842 abort ();
843
844 case '\n':
845 line++;
846 column = 1;
847 p0 = p + 1;
848 break;
849
850 case '\t':
851 column += mbsnwidth (p0, p - p0, 0);
852 column += 8 - ((column - 1) & 7);
853 p0 = p + 1;
854 break;
855 }
856
857 loc->last_line = line;
858 loc->last_column = column + mbsnwidth (p0, p - p0, 0);
859}
860
861
862
863/* STRING_OBSTACK -- Used to store all the characters that we need to
864 keep (to construct ID, STRINGS etc.). Use the following macros to
865 use it.
866
867 Use YY_OBS_GROW to append what has just been matched, and
868 YY_OBS_FINISH to end the string (it puts the ending 0).
869 YY_OBS_FINISH also stores this string in LAST_STRING, which can be
870 used, and which is used by YY_OBS_FREE to free the last string. */
871
872static struct obstack string_obstack;
873char *last_string;
874
875#define YY_OBS_GROW \
876 obstack_grow (&string_obstack, yytext, yyleng)
877
878#define YY_OBS_FINISH \
879 do { \
880 obstack_1grow (&string_obstack, '\0'); \
881 last_string = obstack_finish (&string_obstack); \
882 } while (0)
883
884#define YY_OBS_FREE \
885 do { \
886 obstack_free (&string_obstack, last_string); \
887 } while (0)
888
889void
890scanner_last_string_free (void)
891{
892 YY_OBS_FREE;
893}
894
895
896static int braces_level = 0;
897static int percent_percent_count = 0;
898
899/* Within well-formed rules, RULE_LENGTH is the number of values in
900 the current rule so far, which says where to find `$0' with respect
901 to the top of the stack. It is not the same as the rule->length in
902 the case of mid rule actions.
903
904 Outside of well-formed rules, RULE_LENGTH has an undefined value. */
905static int rule_length;
906
907static void handle_dollar (braced_code_t code_kind,
908 char *cp, location_t location);
909static void handle_at (braced_code_t code_kind,
910 char *cp, location_t location);
911static int convert_ucn_to_byte (char const *hex_text);
912
913#define SC_COMMENT 1
914#define SC_LINE_COMMENT 2
915#define SC_YACC_COMMENT 3
916
917#define SC_STRING 4
918#define SC_CHARACTER 5
919
920#define SC_ESCAPED_STRING 6
921#define SC_ESCAPED_CHARACTER 7
922
923#define SC_BRACED_CODE 8
924#define SC_PROLOGUE 9
925#define SC_EPILOGUE 10
926
927/* POSIX says that a tag must be both an id and a C union member, but
928 historically almost any character is allowed in a tag. We disallow
929 NUL and newline, as this simplifies our implementation. */
930/* Zero or more instances of backslash-newline. Following GCC, allow
931 white space between the backslash and the newline. */
932#line 933 "scan-gram.c"
933
934/* Macros after this point can all be overridden by user definitions in
935 * section 1.
936 */
937
938#ifndef YY_SKIP_YYWRAP
939#ifdef __cplusplus
940extern "C" int yywrap YY_PROTO(( void ));
941#else
942extern int yywrap YY_PROTO(( void ));
943#endif
944#endif
945
946#ifndef YY_NO_UNPUT
947static void yyunput YY_PROTO(( int c, char *buf_ptr ));
948#endif
949
950#ifndef yytext_ptr
951static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
952#endif
953
954#ifdef YY_NEED_STRLEN
955static int yy_flex_strlen YY_PROTO(( yyconst char * ));
956#endif
957
958#ifndef YY_NO_INPUT
959#ifdef __cplusplus
960static int yyinput YY_PROTO(( void ));
961#else
962static int input YY_PROTO(( void ));
963#endif
964#endif
965
966#if YY_STACK_USED
967static int yy_start_stack_ptr = 0;
968static int yy_start_stack_depth = 0;
969static int *yy_start_stack = 0;
970#ifndef YY_NO_PUSH_STATE
971static void yy_push_state YY_PROTO(( int new_state ));
972#endif
973#ifndef YY_NO_POP_STATE
974static void yy_pop_state YY_PROTO(( void ));
975#endif
976#ifndef YY_NO_TOP_STATE
977static int yy_top_state YY_PROTO(( void ));
978#endif
979
980#else
981#define YY_NO_PUSH_STATE 1
982#define YY_NO_POP_STATE 1
983#define YY_NO_TOP_STATE 1
984#endif
985
986#ifdef YY_MALLOC_DECL
987YY_MALLOC_DECL
988#else
989#if __STDC__
990#ifndef __cplusplus
991#include <stdlib.h>
992#endif
993#else
994/* Just try to get by without declaring the routines. This will fail
995 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
996 * or sizeof(void*) != sizeof(int).
997 */
998#endif
999#endif
1000
1001/* Amount of stuff to slurp up with each read. */
1002#ifndef YY_READ_BUF_SIZE
1003#define YY_READ_BUF_SIZE 8192
1004#endif
1005
1006/* Copy whatever the last rule matched to the standard output. */
1007
1008#ifndef ECHO
1009/* This used to be an fputs(), but since the string might contain NUL's,
1010 * we now use fwrite().
1011 */
1012#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1013#endif
1014
1015/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1016 * is returned in "result".
1017 */
1018#ifndef YY_INPUT
1019#define YY_INPUT(buf,result,max_size) \
1020 if ( yy_current_buffer->yy_is_interactive ) \
1021 { \
1022 int c = '*', n; \
1023 for ( n = 0; n < max_size && \
1024 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1025 buf[n] = (char) c; \
1026 if ( c == '\n' ) \
1027 buf[n++] = (char) c; \
1028 if ( c == EOF && ferror( yyin ) ) \
1029 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1030 result = n; \
1031 } \
1032 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
1033 && ferror( yyin ) ) \
1034 YY_FATAL_ERROR( "input in flex scanner failed" );
1035#endif
1036
1037/* No semi-colon after return; correct usage is to write "yyterminate();" -
1038 * we don't want an extra ';' after the "return" because that will cause
1039 * some compilers to complain about unreachable statements.
1040 */
1041#ifndef yyterminate
1042#define yyterminate() return YY_NULL
1043#endif
1044
1045/* Number of entries by which start-condition stack grows. */
1046#ifndef YY_START_STACK_INCR
1047#define YY_START_STACK_INCR 25
1048#endif
1049
1050/* Report a fatal error. */
1051#ifndef YY_FATAL_ERROR
1052#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1053#endif
1054
1055/* Default declaration of generated scanner - a define so the user can
1056 * easily add parameters.
1057 */
1058#ifndef YY_DECL
1059#define YY_DECL int yylex YY_PROTO(( void ))
1060#endif
1061
1062/* Code executed at the beginning of each rule, after yytext and yyleng
1063 * have been set up.
1064 */
1065#ifndef YY_USER_ACTION
1066#define YY_USER_ACTION
1067#endif
1068
1069/* Code executed at the end of each rule. */
1070#ifndef YY_BREAK
1071#define YY_BREAK break;
1072#endif
1073
1074#define YY_RULE_SETUP \
1075 YY_USER_ACTION
1076
1077YY_DECL
1078 {
1079 register yy_state_type yy_current_state;
1080 register char *yy_cp, *yy_bp;
1081 register int yy_act;
1082
1083#line 202 "scan-gram.l"
1084
1085
1086 /* At each yylex invocation, mark the current position as the
1087 start of the next token. */
1088 YY_STEP;
1089
1090
1091
1092 /*----------------------------.
1093 | Scanning Bison directives. |
1094 `----------------------------*/
1095#line 1096 "scan-gram.c"
1096
1097 if ( yy_init )
1098 {
1099 yy_init = 0;
1100
1101#ifdef YY_USER_INIT
1102 YY_USER_INIT;
1103#endif
1104
1105 if ( ! yy_start )
1106 yy_start = 1; /* first start state */
1107
1108 if ( ! yyin )
1109 yyin = stdin;
1110
1111 if ( ! yyout )
1112 yyout = stdout;
1113
1114 if ( ! yy_current_buffer )
1115 yy_current_buffer =
1116 yy_create_buffer( yyin, YY_BUF_SIZE );
1117
1118 yy_load_buffer_state();
1119 }
1120
1121 while ( 1 ) /* loops until end-of-file is reached */
1122 {
1123 yy_cp = yy_c_buf_p;
1124
1125 /* Support of yytext. */
1126 *yy_cp = yy_hold_char;
1127
1128 /* yy_bp points to the position in yy_ch_buf of the start of
1129 * the current run.
1130 */
1131 yy_bp = yy_cp;
1132
1133 yy_current_state = yy_start;
1134yy_match:
1135 do
1136 {
1137 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1138 if ( yy_accept[yy_current_state] )
1139 {
1140 yy_last_accepting_state = yy_current_state;
1141 yy_last_accepting_cpos = yy_cp;
1142 }
1143 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1144 {
1145 yy_current_state = (int) yy_def[yy_current_state];
1146 if ( yy_current_state >= 391 )
1147 yy_c = yy_meta[(unsigned int) yy_c];
1148 }
1149 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1150 ++yy_cp;
1151 }
1152 while ( yy_base[yy_current_state] != 811 );
1153
1154yy_find_action:
1155 yy_act = yy_accept[yy_current_state];
1156 if ( yy_act == 0 )
1157 { /* have to back up */
1158 yy_cp = yy_last_accepting_cpos;
1159 yy_current_state = yy_last_accepting_state;
1160 yy_act = yy_accept[yy_current_state];
1161 }
1162
1163 YY_DO_BEFORE_ACTION;
1164
1165
1166do_action: /* This label is used only to access EOF actions. */
1167
1168 if ( yy_flex_debug )
1169 {
1170 if ( yy_act == 0 )
1171 fprintf( stderr, "--scanner backing up\n" );
1172 else if ( yy_act < 102 )
1173 fprintf( stderr, "--accepting rule at line %d (\"%s\")\n",
1174 yy_rule_linenum[yy_act], yytext );
1175 else if ( yy_act == 102 )
1176 fprintf( stderr, "--accepting default rule (\"%s\")\n",
1177 yytext );
1178 else if ( yy_act == 103 )
1179 fprintf( stderr, "--(end of buffer or a NUL)\n" );
1180 else
1181 fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
1182 }
1183
1184 switch ( yy_act )
1185 { /* beginning of action switch */
1186 case 0: /* must back up */
1187 /* undo the effects of YY_DO_BEFORE_ACTION */
1188 *yy_cp = yy_hold_char;
1189 yy_cp = yy_last_accepting_cpos;
1190 yy_current_state = yy_last_accepting_state;
1191 goto yy_find_action;
1192
1193
1194
1195case 1:
1196YY_RULE_SETUP
1197#line 215 "scan-gram.l"
1198return PERCENT_NONASSOC;
1199 YY_BREAK
1200case 2:
1201YY_RULE_SETUP
1202#line 216 "scan-gram.l"
1203return PERCENT_DEBUG;
1204 YY_BREAK
1205case 3:
1206YY_RULE_SETUP
1207#line 217 "scan-gram.l"
1208return PERCENT_DEFINE;
1209 YY_BREAK
1210case 4:
1211YY_RULE_SETUP
1212#line 218 "scan-gram.l"
1213return PERCENT_DEFINES;
1214 YY_BREAK
1215case 5:
1216YY_RULE_SETUP
1217#line 219 "scan-gram.l"
1218return PERCENT_DESTRUCTOR;
1219 YY_BREAK
1220case 6:
1221YY_RULE_SETUP
1222#line 220 "scan-gram.l"
1223return PERCENT_DPREC;
1224 YY_BREAK
1225case 7:
1226YY_RULE_SETUP
1227#line 221 "scan-gram.l"
1228return PERCENT_ERROR_VERBOSE;
1229 YY_BREAK
1230case 8:
1231YY_RULE_SETUP
1232#line 222 "scan-gram.l"
1233return PERCENT_EXPECT;
1234 YY_BREAK
1235case 9:
1236YY_RULE_SETUP
1237#line 223 "scan-gram.l"
1238return PERCENT_FILE_PREFIX;
1239 YY_BREAK
1240case 10:
1241YY_RULE_SETUP
1242#line 224 "scan-gram.l"
1243return PERCENT_YACC;
1244 YY_BREAK
1245case 11:
1246YY_RULE_SETUP
1247#line 225 "scan-gram.l"
1248return PERCENT_GLR_PARSER;
1249 YY_BREAK
1250case 12:
1251YY_RULE_SETUP
1252#line 226 "scan-gram.l"
1253return PERCENT_LEFT;
1254 YY_BREAK
1255case 13:
1256YY_RULE_SETUP
1257#line 227 "scan-gram.l"
1258return PERCENT_LOCATIONS;
1259 YY_BREAK
1260case 14:
1261YY_RULE_SETUP
1262#line 228 "scan-gram.l"
1263return PERCENT_MERGE;
1264 YY_BREAK
1265case 15:
1266YY_RULE_SETUP
1267#line 229 "scan-gram.l"
1268return PERCENT_NAME_PREFIX;
1269 YY_BREAK
1270case 16:
1271YY_RULE_SETUP
1272#line 230 "scan-gram.l"
1273return PERCENT_NO_LINES;
1274 YY_BREAK
1275case 17:
1276YY_RULE_SETUP
1277#line 231 "scan-gram.l"
1278return PERCENT_NONASSOC;
1279 YY_BREAK
1280case 18:
1281YY_RULE_SETUP
1282#line 232 "scan-gram.l"
1283return PERCENT_NTERM;
1284 YY_BREAK
1285case 19:
1286YY_RULE_SETUP
1287#line 233 "scan-gram.l"
1288return PERCENT_OUTPUT;
1289 YY_BREAK
1290case 20:
1291YY_RULE_SETUP
1292#line 234 "scan-gram.l"
1293return PERCENT_PARSE_PARAM;
1294 YY_BREAK
1295case 21:
1296YY_RULE_SETUP
1297#line 235 "scan-gram.l"
1298rule_length--; return PERCENT_PREC;
1299 YY_BREAK
1300case 22:
1301YY_RULE_SETUP
1302#line 236 "scan-gram.l"
1303return PERCENT_PRINTER;
1304 YY_BREAK
1305case 23:
1306YY_RULE_SETUP
1307#line 237 "scan-gram.l"
1308return PERCENT_PURE_PARSER;
1309 YY_BREAK
1310case 24:
1311YY_RULE_SETUP
1312#line 238 "scan-gram.l"
1313return PERCENT_RIGHT;
1314 YY_BREAK
1315case 25:
1316YY_RULE_SETUP
1317#line 239 "scan-gram.l"
1318return PERCENT_LEX_PARAM;
1319 YY_BREAK
1320case 26:
1321YY_RULE_SETUP
1322#line 240 "scan-gram.l"
1323return PERCENT_SKELETON;
1324 YY_BREAK
1325case 27:
1326YY_RULE_SETUP
1327#line 241 "scan-gram.l"
1328return PERCENT_START;
1329 YY_BREAK
1330case 28:
1331YY_RULE_SETUP
1332#line 242 "scan-gram.l"
1333return PERCENT_TOKEN;
1334 YY_BREAK
1335case 29:
1336YY_RULE_SETUP
1337#line 243 "scan-gram.l"
1338return PERCENT_TOKEN;
1339 YY_BREAK
1340case 30:
1341YY_RULE_SETUP
1342#line 244 "scan-gram.l"
1343return PERCENT_TOKEN_TABLE;
1344 YY_BREAK
1345case 31:
1346YY_RULE_SETUP
1347#line 245 "scan-gram.l"
1348return PERCENT_TYPE;
1349 YY_BREAK
1350case 32:
1351YY_RULE_SETUP
1352#line 246 "scan-gram.l"
1353return PERCENT_UNION;
1354 YY_BREAK
1355case 33:
1356YY_RULE_SETUP
1357#line 247 "scan-gram.l"
1358return PERCENT_VERBOSE;
1359 YY_BREAK
1360case 34:
1361YY_RULE_SETUP
1362#line 248 "scan-gram.l"
1363return PERCENT_YACC;
1364 YY_BREAK
1365case 35:
1366YY_RULE_SETUP
1367#line 250 "scan-gram.l"
1368return EQUAL;
1369 YY_BREAK
1370case 36:
1371YY_RULE_SETUP
1372#line 251 "scan-gram.l"
1373rule_length = 0; return COLON;
1374 YY_BREAK
1375case 37:
1376YY_RULE_SETUP
1377#line 252 "scan-gram.l"
1378rule_length = 0; return PIPE;
1379 YY_BREAK
1380case 38:
1381YY_RULE_SETUP
1382#line 253 "scan-gram.l"
1383return COMMA;
1384 YY_BREAK
1385case 39:
1386YY_RULE_SETUP
1387#line 254 "scan-gram.l"
1388return SEMICOLON;
1389 YY_BREAK
1390case 40:
1391YY_RULE_SETUP
1392#line 256 "scan-gram.l"
1393YY_STEP;
1394 YY_BREAK
1395case 41:
1396YY_RULE_SETUP
1397#line 258 "scan-gram.l"
1398{
1399 yylval->symbol = symbol_get (yytext, *yylloc);
1400 rule_length++;
1401 return ID;
1402 }
1403 YY_BREAK
1404case 42:
1405YY_RULE_SETUP
1406#line 264 "scan-gram.l"
1407{
1408 unsigned long num;
1409 errno = 0;
1410 num = strtoul (yytext, 0, 10);
1411 if (INT_MAX < num || errno)
1412 {
1413 complain_at (*yylloc, _("%s is invalid"), yytext);
1414 num = INT_MAX;
1415 }
1416 yylval->integer = num;
1417 return INT;
1418 }
1419 YY_BREAK
1420/* Characters. We don't check there is only one. */
1421case 43:
1422YY_RULE_SETUP
1423#line 278 "scan-gram.l"
1424YY_OBS_GROW; yy_push_state (SC_ESCAPED_CHARACTER);
1425 YY_BREAK
1426/* Strings. */
1427case 44:
1428YY_RULE_SETUP
1429#line 281 "scan-gram.l"
1430YY_OBS_GROW; yy_push_state (SC_ESCAPED_STRING);
1431 YY_BREAK
1432/* Comments. */
1433case 45:
1434YY_RULE_SETUP
1435#line 284 "scan-gram.l"
1436BEGIN SC_YACC_COMMENT;
1437 YY_BREAK
1438case 46:
1439YY_RULE_SETUP
1440#line 285 "scan-gram.l"
1441YY_STEP;
1442 YY_BREAK
1443/* Prologue. */
1444case 47:
1445YY_RULE_SETUP
1446#line 288 "scan-gram.l"
1447yy_push_state (SC_PROLOGUE);
1448 YY_BREAK
1449/* Code in between braces. */
1450case 48:
1451YY_RULE_SETUP
1452#line 291 "scan-gram.l"
1453YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE);
1454 YY_BREAK
1455/* A type. */
1456case 49:
1457YY_RULE_SETUP
1458#line 294 "scan-gram.l"
1459{
1460 obstack_grow (&string_obstack, yytext + 1, yyleng - 2);
1461 YY_OBS_FINISH;
1462 yylval->string = last_string;
1463 return TYPE;
1464 }
1465 YY_BREAK
1466case 50:
1467YY_RULE_SETUP
1468#line 302 "scan-gram.l"
1469{
1470 if (++percent_percent_count == 2)
1471 yy_push_state (SC_EPILOGUE);
1472 return PERCENT_PERCENT;
1473 }
1474 YY_BREAK
1475case 51:
1476YY_RULE_SETUP
1477#line 308 "scan-gram.l"
1478{
1479 LOCATION_PRINT (stderr, *yylloc);
1480 fprintf (stderr, _(": invalid character: `%c'\n"), *yytext);
1481 YY_STEP;
1482 }
1483 YY_BREAK
1484
1485/*-------------------------------------------------------------------.
1486 | Whatever the start condition (but those which correspond to |
1487 | entities `swallowed' by Bison: SC_YACC_COMMENT, SC_ESCAPED_STRING, |
1488 | and SC_ESCAPED_CHARACTER), no M4 character must escape as is. |
1489 `-------------------------------------------------------------------*/
1490
1491
1492case 52:
1493YY_RULE_SETUP
1494#line 324 "scan-gram.l"
1495obstack_sgrow (&string_obstack, "@<:@");
1496 YY_BREAK
1497case 53:
1498YY_RULE_SETUP
1499#line 325 "scan-gram.l"
1500obstack_sgrow (&string_obstack, "@:>@");
1501 YY_BREAK
1502
1503/*---------------------------------------------------------------.
1504 | Scanning a Yacc comment. The initial `/ *' is already eaten. |
1505 `---------------------------------------------------------------*/
1506
1507
1508case 54:
1509YY_RULE_SETUP
1510#line 335 "scan-gram.l"
1511{
1512 YY_STEP;
1513 BEGIN INITIAL;
1514 }
1515 YY_BREAK
1516case 55:
1517YY_RULE_SETUP
1518#line 340 "scan-gram.l"
1519;
1520 YY_BREAK
1521case YY_STATE_EOF(SC_YACC_COMMENT):
1522#line 342 "scan-gram.l"
1523{
1524 LOCATION_PRINT (stderr, *yylloc);
1525 fprintf (stderr, _(": unexpected end of file in a comment\n"));
1526 BEGIN INITIAL;
1527 }
1528 YY_BREAK
1529
1530/*------------------------------------------------------------.
1531 | Scanning a C comment. The initial `/ *' is already eaten. |
1532 `------------------------------------------------------------*/
1533
1534
1535case 56:
1536YY_RULE_SETUP
1537#line 356 "scan-gram.l"
1538YY_OBS_GROW; yy_pop_state ();
1539 YY_BREAK
1540case 57:
1541YY_RULE_SETUP
1542#line 357 "scan-gram.l"
1543YY_OBS_GROW;
1544 YY_BREAK
1545case YY_STATE_EOF(SC_COMMENT):
1546#line 359 "scan-gram.l"
1547{
1548 LOCATION_PRINT (stderr, *yylloc);
1549 fprintf (stderr, _(": unexpected end of file in a comment\n"));
1550 yy_pop_state ();
1551 }
1552 YY_BREAK
1553
1554/*--------------------------------------------------------------.
1555 | Scanning a line comment. The initial `//' is already eaten. |
1556 `--------------------------------------------------------------*/
1557
1558
1559case 58:
1560YY_RULE_SETUP
1561#line 373 "scan-gram.l"
1562YY_OBS_GROW; yy_pop_state ();
1563 YY_BREAK
1564case 59:
1565YY_RULE_SETUP
1566#line 374 "scan-gram.l"
1567YY_OBS_GROW;
1568 YY_BREAK
1569case YY_STATE_EOF(SC_LINE_COMMENT):
1570#line 375 "scan-gram.l"
1571yy_pop_state ();
1572 YY_BREAK
1573
1574/*----------------------------------------------------------------.
1575 | Scanning a C string, including its escapes. The initial `"' is |
1576 | already eaten. |
1577 `----------------------------------------------------------------*/
1578
1579
1580case 60:
1581YY_RULE_SETUP
1582#line 386 "scan-gram.l"
1583{
1584 assert (yy_top_state () == INITIAL);
1585 YY_OBS_GROW;
1586 YY_OBS_FINISH;
1587 yylval->string = last_string;
1588 yy_pop_state ();
1589 rule_length++;
1590 return STRING;
1591 }
1592 YY_BREAK
1593case 61:
1594YY_RULE_SETUP
1595#line 396 "scan-gram.l"
1596YY_OBS_GROW;
1597 YY_BREAK
1598case YY_STATE_EOF(SC_ESCAPED_STRING):
1599#line 398 "scan-gram.l"
1600{
1601 LOCATION_PRINT (stderr, *yylloc);
1602 fprintf (stderr, _(": unexpected end of file in a string\n"));
1603 assert (yy_top_state () == INITIAL);
1604 YY_OBS_FINISH;
1605 yylval->string = last_string;
1606 yy_pop_state ();
1607 return STRING;
1608 }
1609 YY_BREAK
1610
1611/*---------------------------------------------------------------.
1612 | Scanning a C character, decoding its escapes. The initial "'" |
1613 | is already eaten. |
1614 `---------------------------------------------------------------*/
1615
1616
1617case 62:
1618YY_RULE_SETUP
1619#line 416 "scan-gram.l"
1620{
1621 YY_OBS_GROW;
1622 assert (yy_top_state () == INITIAL);
1623 {
1624 YY_OBS_FINISH;
1625 yylval->symbol = symbol_get (last_string, *yylloc);
1626 symbol_class_set (yylval->symbol, token_sym, *yylloc);
1627 symbol_user_token_number_set (yylval->symbol,
1628 (unsigned char) last_string[1], *yylloc);
1629 YY_OBS_FREE;
1630 yy_pop_state ();
1631 rule_length++;
1632 return ID;
1633 }
1634 }
1635 YY_BREAK
1636case 63:
1637YY_RULE_SETUP
1638#line 432 "scan-gram.l"
1639YY_OBS_GROW;
1640 YY_BREAK
1641case YY_STATE_EOF(SC_ESCAPED_CHARACTER):
1642#line 434 "scan-gram.l"
1643{
1644 LOCATION_PRINT (stderr, *yylloc);
1645 fprintf (stderr, _(": unexpected end of file in a character\n"));
1646 assert (yy_top_state () == INITIAL);
1647 YY_OBS_FINISH;
1648 yylval->string = last_string;
1649 yy_pop_state ();
1650 return CHARACTER;
1651 }
1652 YY_BREAK
1653
1654/*----------------------------.
1655 | Decode escaped characters. |
1656 `----------------------------*/
1657
1658
1659case 64:
1660YY_RULE_SETUP
1661#line 452 "scan-gram.l"
1662{
1663 unsigned long c = strtoul (yytext + 1, 0, 8);
1664 if (UCHAR_MAX < c)
1665 {
1666 LOCATION_PRINT (stderr, *yylloc);
1667 fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));
1668 YY_STEP;
1669 }
1670 else
1671 obstack_1grow (&string_obstack, c);
1672 }
1673 YY_BREAK
1674case 65:
1675YY_RULE_SETUP
1676#line 464 "scan-gram.l"
1677{
1678 unsigned long c;
1679 errno = 0;
1680 c = strtoul (yytext + 2, 0, 16);
1681 if (UCHAR_MAX < c || errno)
1682 {
1683 LOCATION_PRINT (stderr, *yylloc);
1684 fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));
1685 YY_STEP;
1686 }
1687 else
1688 obstack_1grow (&string_obstack, c);
1689 }
1690 YY_BREAK
1691case 66:
1692YY_RULE_SETUP
1693#line 478 "scan-gram.l"
1694obstack_1grow (&string_obstack, '\a');
1695 YY_BREAK
1696case 67:
1697YY_RULE_SETUP
1698#line 479 "scan-gram.l"
1699obstack_1grow (&string_obstack, '\b');
1700 YY_BREAK
1701case 68:
1702YY_RULE_SETUP
1703#line 480 "scan-gram.l"
1704obstack_1grow (&string_obstack, '\f');
1705 YY_BREAK
1706case 69:
1707YY_RULE_SETUP
1708#line 481 "scan-gram.l"
1709obstack_1grow (&string_obstack, '\n');
1710 YY_BREAK
1711case 70:
1712YY_RULE_SETUP
1713#line 482 "scan-gram.l"
1714obstack_1grow (&string_obstack, '\r');
1715 YY_BREAK
1716case 71:
1717YY_RULE_SETUP
1718#line 483 "scan-gram.l"
1719obstack_1grow (&string_obstack, '\t');
1720 YY_BREAK
1721case 72:
1722YY_RULE_SETUP
1723#line 484 "scan-gram.l"
1724obstack_1grow (&string_obstack, '\v');
1725 YY_BREAK
1726case 73:
1727YY_RULE_SETUP
1728#line 485 "scan-gram.l"
1729obstack_1grow (&string_obstack, yytext[1]);
1730 YY_BREAK
1731case 74:
1732YY_RULE_SETUP
1733#line 486 "scan-gram.l"
1734{
1735 int c = convert_ucn_to_byte (yytext);
1736 if (c < 0)
1737 {
1738 LOCATION_PRINT (stderr, *yylloc);
1739 fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));
1740 YY_STEP;
1741 }
1742 else
1743 obstack_1grow (&string_obstack, c);
1744 }
1745 YY_BREAK
1746case 75:
1747YY_RULE_SETUP
1748#line 497 "scan-gram.l"
1749{
1750 LOCATION_PRINT (stderr, *yylloc);
1751 fprintf (stderr, _(": unrecognized escape: %s\n"), quote (yytext));
1752 YY_OBS_GROW;
1753 }
1754 YY_BREAK
1755/* FLex wants this rule, in case of a `\<<EOF>>'. */
1756case 76:
1757YY_RULE_SETUP
1758#line 503 "scan-gram.l"
1759YY_OBS_GROW;
1760 YY_BREAK
1761
1762/*----------------------------------------------------------.
1763 | Scanning a C character without decoding its escapes. The |
1764 | initial "'" is already eaten. |
1765 `----------------------------------------------------------*/
1766
1767
1768case 77:
1769YY_RULE_SETUP
1770#line 514 "scan-gram.l"
1771{
1772 YY_OBS_GROW;
1773 assert (yy_top_state () != INITIAL);
1774 yy_pop_state ();
1775 }
1776 YY_BREAK
1777case 78:
1778YY_RULE_SETUP
1779#line 520 "scan-gram.l"
1780YY_OBS_GROW;
1781 YY_BREAK
1782case 79:
1783YY_RULE_SETUP
1784#line 521 "scan-gram.l"
1785YY_OBS_GROW;
1786 YY_BREAK
1787case 80:
1788YY_RULE_SETUP
1789#line 522 "scan-gram.l"
1790YY_OBS_GROW;
1791 YY_BREAK
1792/* Needed for `\<<EOF>>', `\\<<newline>>[', and `\\<<newline>>]'. */
1793case 81:
1794YY_RULE_SETUP
1795#line 524 "scan-gram.l"
1796YY_OBS_GROW;
1797 YY_BREAK
1798case YY_STATE_EOF(SC_CHARACTER):
1799#line 526 "scan-gram.l"
1800{
1801 LOCATION_PRINT (stderr, *yylloc);
1802 fprintf (stderr, _(": unexpected end of file in a character\n"));
1803 assert (yy_top_state () != INITIAL);
1804 yy_pop_state ();
1805 }
1806 YY_BREAK
1807
1808/*----------------------------------------------------------------.
1809 | Scanning a C string, without decoding its escapes. The initial |
1810 | `"' is already eaten. |
1811 `----------------------------------------------------------------*/
1812
1813
1814case 82:
1815YY_RULE_SETUP
1816#line 542 "scan-gram.l"
1817{
1818 assert (yy_top_state () != INITIAL);
1819 YY_OBS_GROW;
1820 yy_pop_state ();
1821 }
1822 YY_BREAK
1823case 83:
1824YY_RULE_SETUP
1825#line 548 "scan-gram.l"
1826YY_OBS_GROW;
1827 YY_BREAK
1828case 84:
1829YY_RULE_SETUP
1830#line 549 "scan-gram.l"
1831YY_OBS_GROW;
1832 YY_BREAK
1833case 85:
1834YY_RULE_SETUP
1835#line 550 "scan-gram.l"
1836YY_OBS_GROW;
1837 YY_BREAK
1838/* Needed for `\<<EOF>>', `\\<<newline>>[', and `\\<<newline>>]'. */
1839case 86:
1840YY_RULE_SETUP
1841#line 552 "scan-gram.l"
1842YY_OBS_GROW;
1843 YY_BREAK
1844case YY_STATE_EOF(SC_STRING):
1845#line 554 "scan-gram.l"
1846{
1847 LOCATION_PRINT (stderr, *yylloc);
1848 fprintf (stderr, _(": unexpected end of file in a string\n"));
1849 assert (yy_top_state () != INITIAL);
1850 yy_pop_state ();
1851 }
1852 YY_BREAK
1853
1854/*---------------------------------------------------.
1855 | Strings, comments etc. can be found in user code. |
1856 `---------------------------------------------------*/
1857
1858
1859/* Characters. We don't check there is only one. */
1860case 87:
1861YY_RULE_SETUP
1862#line 570 "scan-gram.l"
1863YY_OBS_GROW; yy_push_state (SC_CHARACTER);
1864 YY_BREAK
1865/* Strings. */
1866case 88:
1867YY_RULE_SETUP
1868#line 573 "scan-gram.l"
1869YY_OBS_GROW; yy_push_state (SC_STRING);
1870 YY_BREAK
1871/* Comments. */
1872case 89:
1873YY_RULE_SETUP
1874#line 576 "scan-gram.l"
1875YY_OBS_GROW; yy_push_state (SC_COMMENT);
1876 YY_BREAK
1877case 90:
1878YY_RULE_SETUP
1879#line 577 "scan-gram.l"
1880YY_OBS_GROW; yy_push_state (SC_LINE_COMMENT);
1881 YY_BREAK
1882/* Not comments. */
1883case 91:
1884YY_RULE_SETUP
1885#line 580 "scan-gram.l"
1886YY_OBS_GROW;
1887 YY_BREAK
1888
1889/*---------------------------------------------------------------.
1890 | Scanning some code in braces (%union and actions). The initial |
1891 | "{" is already eaten. |
1892 `---------------------------------------------------------------*/
1893
1894
1895case 92:
1896YY_RULE_SETUP
1897#line 591 "scan-gram.l"
1898{
1899 YY_OBS_GROW;
1900 if (--braces_level == 0)
1901 {
1902 yy_pop_state ();
1903 YY_OBS_FINISH;
1904 yylval->string = last_string;
1905 rule_length++;
1906 return BRACED_CODE;
1907 }
1908 }
1909 YY_BREAK
1910case 93:
1911YY_RULE_SETUP
1912#line 603 "scan-gram.l"
1913YY_OBS_GROW; braces_level++;
1914 YY_BREAK
1915case 94:
1916YY_RULE_SETUP
1917#line 605 "scan-gram.l"
1918{ handle_dollar (current_braced_code,
1919 yytext, *yylloc); }
1920 YY_BREAK
1921case 95:
1922YY_RULE_SETUP
1923#line 607 "scan-gram.l"
1924{ handle_at (current_braced_code,
1925 yytext, *yylloc); }
1926 YY_BREAK
1927case 96:
1928YY_RULE_SETUP
1929#line 610 "scan-gram.l"
1930YY_OBS_GROW;
1931 YY_BREAK
1932/* A stray $, or /, or etc. */
1933case 97:
1934YY_RULE_SETUP
1935#line 613 "scan-gram.l"
1936YY_OBS_GROW;
1937 YY_BREAK
1938case YY_STATE_EOF(SC_BRACED_CODE):
1939#line 615 "scan-gram.l"
1940{
1941 LOCATION_PRINT (stderr, *yylloc);
1942 fprintf (stderr, _(": unexpected end of file in a braced code\n"));
1943 yy_pop_state ();
1944 YY_OBS_FINISH;
1945 yylval->string = last_string;
1946 return BRACED_CODE;
1947 }
1948 YY_BREAK
1949
1950/*--------------------------------------------------------------.
1951 | Scanning some prologue: from "%{" (already scanned) to "%}". |
1952 `--------------------------------------------------------------*/
1953
1954
1955case 98:
1956YY_RULE_SETUP
1957#line 633 "scan-gram.l"
1958{
1959 yy_pop_state ();
1960 YY_OBS_FINISH;
1961 yylval->string = last_string;
1962 return PROLOGUE;
1963 }
1964 YY_BREAK
1965case 99:
1966YY_RULE_SETUP
1967#line 640 "scan-gram.l"
1968YY_OBS_GROW;
1969 YY_BREAK
1970case 100:
1971YY_RULE_SETUP
1972#line 641 "scan-gram.l"
1973YY_OBS_GROW;
1974 YY_BREAK
1975case YY_STATE_EOF(SC_PROLOGUE):
1976#line 643 "scan-gram.l"
1977{
1978 LOCATION_PRINT (stderr, *yylloc);
1979 fprintf (stderr, _(": unexpected end of file in a prologue\n"));
1980 yy_pop_state ();
1981 YY_OBS_FINISH;
1982 yylval->string = last_string;
1983 return PROLOGUE;
1984 }
1985 YY_BREAK
1986
1987/*---------------------------------------------------------------.
1988 | Scanning the epilogue (everything after the second "%%", which |
1989 | has already been eaten). |
1990 `---------------------------------------------------------------*/
1991
1992
1993case 101:
1994YY_RULE_SETUP
1995#line 661 "scan-gram.l"
1996YY_OBS_GROW;
1997 YY_BREAK
1998case YY_STATE_EOF(SC_EPILOGUE):
1999#line 663 "scan-gram.l"
2000{
2001 yy_pop_state ();
2002 YY_OBS_FINISH;
2003 yylval->string = last_string;
2004 return EPILOGUE;
2005 }
2006 YY_BREAK
2007
2008case 102:
2009YY_RULE_SETUP
2010#line 672 "scan-gram.l"
2011YY_FATAL_ERROR( "flex scanner jammed" );
2012 YY_BREAK
2013#line 2014 "scan-gram.c"
2014case YY_STATE_EOF(INITIAL):
2015 yyterminate();
2016
2017 case YY_END_OF_BUFFER:
2018 {
2019 /* Amount of text matched not including the EOB char. */
2020 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2021
2022 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2023 *yy_cp = yy_hold_char;
2024 YY_RESTORE_YY_MORE_OFFSET
2025
2026 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2027 {
2028 /* We're scanning a new file or input source. It's
2029 * possible that this happened because the user
2030 * just pointed yyin at a new source and called
2031 * yylex(). If so, then we have to assure
2032 * consistency between yy_current_buffer and our
2033 * globals. Here is the right place to do so, because
2034 * this is the first action (other than possibly a
2035 * back-up) that will match for the new input source.
2036 */
2037 yy_n_chars = yy_current_buffer->yy_n_chars;
2038 yy_current_buffer->yy_input_file = yyin;
2039 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2040 }
2041
2042 /* Note that here we test for yy_c_buf_p "<=" to the position
2043 * of the first EOB in the buffer, since yy_c_buf_p will
2044 * already have been incremented past the NUL character
2045 * (since all states make transitions on EOB to the
2046 * end-of-buffer state). Contrast this with the test
2047 * in input().
2048 */
2049 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2050 { /* This was really a NUL. */
2051 yy_state_type yy_next_state;
2052
2053 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2054
2055 yy_current_state = yy_get_previous_state();
2056
2057 /* Okay, we're now positioned to make the NUL
2058 * transition. We couldn't have
2059 * yy_get_previous_state() go ahead and do it
2060 * for us because it doesn't know how to deal
2061 * with the possibility of jamming (and we don't
2062 * want to build jamming into it because then it
2063 * will run more slowly).
2064 */
2065
2066 yy_next_state = yy_try_NUL_trans( yy_current_state );
2067
2068 yy_bp = yytext_ptr + YY_MORE_ADJ;
2069
2070 if ( yy_next_state )
2071 {
2072 /* Consume the NUL. */
2073 yy_cp = ++yy_c_buf_p;
2074 yy_current_state = yy_next_state;
2075 goto yy_match;
2076 }
2077
2078 else
2079 {
2080 yy_cp = yy_c_buf_p;
2081 goto yy_find_action;
2082 }
2083 }
2084
2085 else switch ( yy_get_next_buffer() )
2086 {
2087 case EOB_ACT_END_OF_FILE:
2088 {
2089 yy_did_buffer_switch_on_eof = 0;
2090
2091 if ( yywrap() )
2092 {
2093 /* Note: because we've taken care in
2094 * yy_get_next_buffer() to have set up
2095 * yytext, we can now set up
2096 * yy_c_buf_p so that if some total
2097 * hoser (like flex itself) wants to
2098 * call the scanner after we return the
2099 * YY_NULL, it'll still work - another
2100 * YY_NULL will get returned.
2101 */
2102 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2103
2104 yy_act = YY_STATE_EOF(YY_START);
2105 goto do_action;
2106 }
2107
2108 else
2109 {
2110 if ( ! yy_did_buffer_switch_on_eof )
2111 YY_NEW_FILE;
2112 }
2113 break;
2114 }
2115
2116 case EOB_ACT_CONTINUE_SCAN:
2117 yy_c_buf_p =
2118 yytext_ptr + yy_amount_of_matched_text;
2119
2120 yy_current_state = yy_get_previous_state();
2121
2122 yy_cp = yy_c_buf_p;
2123 yy_bp = yytext_ptr + YY_MORE_ADJ;
2124 goto yy_match;
2125
2126 case EOB_ACT_LAST_MATCH:
2127 yy_c_buf_p =
2128 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2129
2130 yy_current_state = yy_get_previous_state();
2131
2132 yy_cp = yy_c_buf_p;
2133 yy_bp = yytext_ptr + YY_MORE_ADJ;
2134 goto yy_find_action;
2135 }
2136 break;
2137 }
2138
2139 default:
2140 YY_FATAL_ERROR(
2141 "fatal flex scanner internal error--no action found" );
2142 } /* end of action switch */
2143 } /* end of scanning one token */
2144 } /* end of yylex */
2145
2146
2147/* yy_get_next_buffer - try to read in a new buffer
2148 *
2149 * Returns a code representing an action:
2150 * EOB_ACT_LAST_MATCH -
2151 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2152 * EOB_ACT_END_OF_FILE - end of file
2153 */
2154
2155static int yy_get_next_buffer()
2156 {
2157 register char *dest = yy_current_buffer->yy_ch_buf;
2158 register char *source = yytext_ptr;
2159 register int number_to_move, i;
2160 int ret_val;
2161
2162 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2163 YY_FATAL_ERROR(
2164 "fatal flex scanner internal error--end of buffer missed" );
2165
2166 if ( yy_current_buffer->yy_fill_buffer == 0 )
2167 { /* Don't try to fill the buffer, so this is an EOF. */
2168 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2169 {
2170 /* We matched a single character, the EOB, so
2171 * treat this as a final EOF.
2172 */
2173 return EOB_ACT_END_OF_FILE;
2174 }
2175
2176 else
2177 {
2178 /* We matched some text prior to the EOB, first
2179 * process it.
2180 */
2181 return EOB_ACT_LAST_MATCH;
2182 }
2183 }
2184
2185 /* Try to read more data. */
2186
2187 /* First move last chars to start of buffer. */
2188 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2189
2190 for ( i = 0; i < number_to_move; ++i )
2191 *(dest++) = *(source++);
2192
2193 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2194 /* don't do the read, it's not guaranteed to return an EOF,
2195 * just force an EOF
2196 */
2197 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2198
2199 else
2200 {
2201 int num_to_read =
2202 yy_current_buffer->yy_buf_size - number_to_move - 1;
2203
2204 while ( num_to_read <= 0 )
2205 { /* Not enough room in the buffer - grow it. */
2206#ifdef YY_USES_REJECT
2207 YY_FATAL_ERROR(
2208"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2209#else
2210
2211 /* just a shorter name for the current buffer */
2212 YY_BUFFER_STATE b = yy_current_buffer;
2213
2214 int yy_c_buf_p_offset =
2215 (int) (yy_c_buf_p - b->yy_ch_buf);
2216
2217 if ( b->yy_is_our_buffer )
2218 {
2219 int new_size = b->yy_buf_size * 2;
2220
2221 if ( new_size <= 0 )
2222 b->yy_buf_size += b->yy_buf_size / 8;
2223 else
2224 b->yy_buf_size *= 2;
2225
2226 b->yy_ch_buf = (char *)
2227 /* Include room in for 2 EOB chars. */
2228 yy_flex_realloc( (void *) b->yy_ch_buf,
2229 b->yy_buf_size + 2 );
2230 }
2231 else
2232 /* Can't grow it, we don't own it. */
2233 b->yy_ch_buf = 0;
2234
2235 if ( ! b->yy_ch_buf )
2236 YY_FATAL_ERROR(
2237 "fatal error - scanner input buffer overflow" );
2238
2239 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2240
2241 num_to_read = yy_current_buffer->yy_buf_size -
2242 number_to_move - 1;
2243#endif
2244 }
2245
2246 if ( num_to_read > YY_READ_BUF_SIZE )
2247 num_to_read = YY_READ_BUF_SIZE;
2248
2249 /* Read in more data. */
2250 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2251 yy_n_chars, num_to_read );
2252
2253 yy_current_buffer->yy_n_chars = yy_n_chars;
2254 }
2255
2256 if ( yy_n_chars == 0 )
2257 {
2258 if ( number_to_move == YY_MORE_ADJ )
2259 {
2260 ret_val = EOB_ACT_END_OF_FILE;
2261 yyrestart( yyin );
2262 }
2263
2264 else
2265 {
2266 ret_val = EOB_ACT_LAST_MATCH;
2267 yy_current_buffer->yy_buffer_status =
2268 YY_BUFFER_EOF_PENDING;
2269 }
2270 }
2271
2272 else
2273 ret_val = EOB_ACT_CONTINUE_SCAN;
2274
2275 yy_n_chars += number_to_move;
2276 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2277 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2278
2279 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2280
2281 return ret_val;
2282 }
2283
2284
2285/* yy_get_previous_state - get the state just before the EOB char was reached */
2286
2287static yy_state_type yy_get_previous_state()
2288 {
2289 register yy_state_type yy_current_state;
2290 register char *yy_cp;
2291
2292 yy_current_state = yy_start;
2293
2294 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2295 {
2296 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 53);
2297 if ( yy_accept[yy_current_state] )
2298 {
2299 yy_last_accepting_state = yy_current_state;
2300 yy_last_accepting_cpos = yy_cp;
2301 }
2302 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2303 {
2304 yy_current_state = (int) yy_def[yy_current_state];
2305 if ( yy_current_state >= 391 )
2306 yy_c = yy_meta[(unsigned int) yy_c];
2307 }
2308 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2309 }
2310
2311 return yy_current_state;
2312 }
2313
2314
2315/* yy_try_NUL_trans - try to make a transition on the NUL character
2316 *
2317 * synopsis
2318 * next_state = yy_try_NUL_trans( current_state );
2319 */
2320
2321#ifdef YY_USE_PROTOS
2322static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2323#else
2324static yy_state_type yy_try_NUL_trans( yy_current_state )
2325yy_state_type yy_current_state;
2326#endif
2327 {
2328 register int yy_is_jam;
2329 register char *yy_cp = yy_c_buf_p;
2330
2331 register YY_CHAR yy_c = 53;
2332 if ( yy_accept[yy_current_state] )
2333 {
2334 yy_last_accepting_state = yy_current_state;
2335 yy_last_accepting_cpos = yy_cp;
2336 }
2337 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2338 {
2339 yy_current_state = (int) yy_def[yy_current_state];
2340 if ( yy_current_state >= 391 )
2341 yy_c = yy_meta[(unsigned int) yy_c];
2342 }
2343 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2344 yy_is_jam = (yy_current_state == 390);
2345
2346 return yy_is_jam ? 0 : yy_current_state;
2347 }
2348
2349
2350#ifndef YY_NO_UNPUT
2351#ifdef YY_USE_PROTOS
2352static void yyunput( int c, register char *yy_bp )
2353#else
2354static void yyunput( c, yy_bp )
2355int c;
2356register char *yy_bp;
2357#endif
2358 {
2359 register char *yy_cp = yy_c_buf_p;
2360
2361 /* undo effects of setting up yytext */
2362 *yy_cp = yy_hold_char;
2363
2364 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2365 { /* need to shift things up to make room */
2366 /* +2 for EOB chars. */
2367 register int number_to_move = yy_n_chars + 2;
2368 register char *dest = &yy_current_buffer->yy_ch_buf[
2369 yy_current_buffer->yy_buf_size + 2];
2370 register char *source =
2371 &yy_current_buffer->yy_ch_buf[number_to_move];
2372
2373 while ( source > yy_current_buffer->yy_ch_buf )
2374 *--dest = *--source;
2375
2376 yy_cp += (int) (dest - source);
2377 yy_bp += (int) (dest - source);
2378 yy_current_buffer->yy_n_chars =
2379 yy_n_chars = yy_current_buffer->yy_buf_size;
2380
2381 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2382 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2383 }
2384
2385 *--yy_cp = (char) c;
2386
2387
2388 yytext_ptr = yy_bp;
2389 yy_hold_char = *yy_cp;
2390 yy_c_buf_p = yy_cp;
2391 }
2392#endif /* ifndef YY_NO_UNPUT */
2393
2394
2395#ifdef __cplusplus
2396static int yyinput()
2397#else
2398static int input()
2399#endif
2400 {
2401 int c;
2402
2403 *yy_c_buf_p = yy_hold_char;
2404
2405 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2406 {
2407 /* yy_c_buf_p now points to the character we want to return.
2408 * If this occurs *before* the EOB characters, then it's a
2409 * valid NUL; if not, then we've hit the end of the buffer.
2410 */
2411 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2412 /* This was really a NUL. */
2413 *yy_c_buf_p = '\0';
2414
2415 else
2416 { /* need more input */
2417 int offset = yy_c_buf_p - yytext_ptr;
2418 ++yy_c_buf_p;
2419
2420 switch ( yy_get_next_buffer() )
2421 {
2422 case EOB_ACT_LAST_MATCH:
2423 /* This happens because yy_g_n_b()
2424 * sees that we've accumulated a
2425 * token and flags that we need to
2426 * try matching the token before
2427 * proceeding. But for input(),
2428 * there's no matching to consider.
2429 * So convert the EOB_ACT_LAST_MATCH
2430 * to EOB_ACT_END_OF_FILE.
2431 */
2432
2433 /* Reset buffer status. */
2434 yyrestart( yyin );
2435
2436 /* fall through */
2437
2438 case EOB_ACT_END_OF_FILE:
2439 {
2440 if ( yywrap() )
2441 return EOF;
2442
2443 if ( ! yy_did_buffer_switch_on_eof )
2444 YY_NEW_FILE;
2445#ifdef __cplusplus
2446 return yyinput();
2447#else
2448 return input();
2449#endif
2450 }
2451
2452 case EOB_ACT_CONTINUE_SCAN:
2453 yy_c_buf_p = yytext_ptr + offset;
2454 break;
2455 }
2456 }
2457 }
2458
2459 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2460 *yy_c_buf_p = '\0'; /* preserve yytext */
2461 yy_hold_char = *++yy_c_buf_p;
2462
2463
2464 return c;
2465 }
2466
2467
2468#ifdef YY_USE_PROTOS
2469void yyrestart( FILE *input_file )
2470#else
2471void yyrestart( input_file )
2472FILE *input_file;
2473#endif
2474 {
2475 if ( ! yy_current_buffer )
2476 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2477
2478 yy_init_buffer( yy_current_buffer, input_file );
2479 yy_load_buffer_state();
2480 }
2481
2482
2483#ifdef YY_USE_PROTOS
2484void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2485#else
2486void yy_switch_to_buffer( new_buffer )
2487YY_BUFFER_STATE new_buffer;
2488#endif
2489 {
2490 if ( yy_current_buffer == new_buffer )
2491 return;
2492
2493 if ( yy_current_buffer )
2494 {
2495 /* Flush out information for old buffer. */
2496 *yy_c_buf_p = yy_hold_char;
2497 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2498 yy_current_buffer->yy_n_chars = yy_n_chars;
2499 }
2500
2501 yy_current_buffer = new_buffer;
2502 yy_load_buffer_state();
2503
2504 /* We don't actually know whether we did this switch during
2505 * EOF (yywrap()) processing, but the only time this flag
2506 * is looked at is after yywrap() is called, so it's safe
2507 * to go ahead and always set it.
2508 */
2509 yy_did_buffer_switch_on_eof = 1;
2510 }
2511
2512
2513#ifdef YY_USE_PROTOS
2514void yy_load_buffer_state( void )
2515#else
2516void yy_load_buffer_state()
2517#endif
2518 {
2519 yy_n_chars = yy_current_buffer->yy_n_chars;
2520 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2521 yyin = yy_current_buffer->yy_input_file;
2522 yy_hold_char = *yy_c_buf_p;
2523 }
2524
2525
2526#ifdef YY_USE_PROTOS
2527YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2528#else
2529YY_BUFFER_STATE yy_create_buffer( file, size )
2530FILE *file;
2531int size;
2532#endif
2533 {
2534 YY_BUFFER_STATE b;
2535
2536 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2537 if ( ! b )
2538 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2539
2540 b->yy_buf_size = size;
2541
2542 /* yy_ch_buf has to be 2 characters longer than the size given because
2543 * we need to put in 2 end-of-buffer characters.
2544 */
2545 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2546 if ( ! b->yy_ch_buf )
2547 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2548
2549 b->yy_is_our_buffer = 1;
2550
2551 yy_init_buffer( b, file );
2552
2553 return b;
2554 }
2555
2556
2557#ifdef YY_USE_PROTOS
2558void yy_delete_buffer( YY_BUFFER_STATE b )
2559#else
2560void yy_delete_buffer( b )
2561YY_BUFFER_STATE b;
2562#endif
2563 {
2564 if ( ! b )
2565 return;
2566
2567 if ( b == yy_current_buffer )
2568 yy_current_buffer = (YY_BUFFER_STATE) 0;
2569
2570 if ( b->yy_is_our_buffer )
2571 yy_flex_free( (void *) b->yy_ch_buf );
2572
2573 yy_flex_free( (void *) b );
2574 }
2575
2576
2577#ifndef YY_ALWAYS_INTERACTIVE
2578#ifndef YY_NEVER_INTERACTIVE
2579extern int isatty YY_PROTO(( int ));
2580#endif
2581#endif
2582
2583#ifdef YY_USE_PROTOS
2584void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2585#else
2586void yy_init_buffer( b, file )
2587YY_BUFFER_STATE b;
2588FILE *file;
2589#endif
2590
2591
2592 {
2593 yy_flush_buffer( b );
2594
2595 b->yy_input_file = file;
2596 b->yy_fill_buffer = 1;
2597
2598#if YY_ALWAYS_INTERACTIVE
2599 b->yy_is_interactive = 1;
2600#else
2601#if YY_NEVER_INTERACTIVE
2602 b->yy_is_interactive = 0;
2603#else
2604 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2605#endif
2606#endif
2607 }
2608
2609
2610#ifdef YY_USE_PROTOS
2611void yy_flush_buffer( YY_BUFFER_STATE b )
2612#else
2613void yy_flush_buffer( b )
2614YY_BUFFER_STATE b;
2615#endif
2616
2617 {
2618 if ( ! b )
2619 return;
2620
2621 b->yy_n_chars = 0;
2622
2623 /* We always need two end-of-buffer characters. The first causes
2624 * a transition to the end-of-buffer state. The second causes
2625 * a jam in that state.
2626 */
2627 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2628 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2629
2630 b->yy_buf_pos = &b->yy_ch_buf[0];
2631
2632 b->yy_at_bol = 1;
2633 b->yy_buffer_status = YY_BUFFER_NEW;
2634
2635 if ( b == yy_current_buffer )
2636 yy_load_buffer_state();
2637 }
2638
2639
2640#ifndef YY_NO_SCAN_BUFFER
2641#ifdef YY_USE_PROTOS
2642YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2643#else
2644YY_BUFFER_STATE yy_scan_buffer( base, size )
2645char *base;
2646yy_size_t size;
2647#endif
2648 {
2649 YY_BUFFER_STATE b;
2650
2651 if ( size < 2 ||
2652 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2653 base[size-1] != YY_END_OF_BUFFER_CHAR )
2654 /* They forgot to leave room for the EOB's. */
2655 return 0;
2656
2657 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2658 if ( ! b )
2659 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2660
2661 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2662 b->yy_buf_pos = b->yy_ch_buf = base;
2663 b->yy_is_our_buffer = 0;
2664 b->yy_input_file = 0;
2665 b->yy_n_chars = b->yy_buf_size;
2666 b->yy_is_interactive = 0;
2667 b->yy_at_bol = 1;
2668 b->yy_fill_buffer = 0;
2669 b->yy_buffer_status = YY_BUFFER_NEW;
2670
2671 yy_switch_to_buffer( b );
2672
2673 return b;
2674 }
2675#endif
2676
2677
2678#ifndef YY_NO_SCAN_STRING
2679#ifdef YY_USE_PROTOS
2680YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2681#else
2682YY_BUFFER_STATE yy_scan_string( yy_str )
2683yyconst char *yy_str;
2684#endif
2685 {
2686 int len;
2687 for ( len = 0; yy_str[len]; ++len )
2688 ;
2689
2690 return yy_scan_bytes( yy_str, len );
2691 }
2692#endif
2693
2694
2695#ifndef YY_NO_SCAN_BYTES
2696#ifdef YY_USE_PROTOS
2697YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2698#else
2699YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2700yyconst char *bytes;
2701int len;
2702#endif
2703 {
2704 YY_BUFFER_STATE b;
2705 char *buf;
2706 yy_size_t n;
2707 int i;
2708
2709 /* Get memory for full buffer, including space for trailing EOB's. */
2710 n = len + 2;
2711 buf = (char *) yy_flex_alloc( n );
2712 if ( ! buf )
2713 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2714
2715 for ( i = 0; i < len; ++i )
2716 buf[i] = bytes[i];
2717
2718 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2719
2720 b = yy_scan_buffer( buf, n );
2721 if ( ! b )
2722 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2723
2724 /* It's okay to grow etc. this buffer, and we should throw it
2725 * away when we're done.
2726 */
2727 b->yy_is_our_buffer = 1;
2728
2729 return b;
2730 }
2731#endif
2732
2733
2734#ifndef YY_NO_PUSH_STATE
2735#ifdef YY_USE_PROTOS
2736static void yy_push_state( int new_state )
2737#else
2738static void yy_push_state( new_state )
2739int new_state;
2740#endif
2741 {
2742 if ( yy_start_stack_ptr >= yy_start_stack_depth )
2743 {
2744 yy_size_t new_size;
2745
2746 yy_start_stack_depth += YY_START_STACK_INCR;
2747 new_size = yy_start_stack_depth * sizeof( int );
2748
2749 if ( ! yy_start_stack )
2750 yy_start_stack = (int *) yy_flex_alloc( new_size );
2751
2752 else
2753 yy_start_stack = (int *) yy_flex_realloc(
2754 (void *) yy_start_stack, new_size );
2755
2756 if ( ! yy_start_stack )
2757 YY_FATAL_ERROR(
2758 "out of memory expanding start-condition stack" );
2759 }
2760
2761 yy_start_stack[yy_start_stack_ptr++] = YY_START;
2762
2763 BEGIN(new_state);
2764 }
2765#endif
2766
2767
2768#ifndef YY_NO_POP_STATE
2769static void yy_pop_state()
2770 {
2771 if ( --yy_start_stack_ptr < 0 )
2772 YY_FATAL_ERROR( "start-condition stack underflow" );
2773
2774 BEGIN(yy_start_stack[yy_start_stack_ptr]);
2775 }
2776#endif
2777
2778
2779#ifndef YY_NO_TOP_STATE
2780static int yy_top_state()
2781 {
2782 return yy_start_stack[yy_start_stack_ptr - 1];
2783 }
2784#endif
2785
2786#ifndef YY_EXIT_FAILURE
2787#define YY_EXIT_FAILURE 2
2788#endif
2789
2790#ifdef YY_USE_PROTOS
2791static void yy_fatal_error( yyconst char msg[] )
2792#else
2793static void yy_fatal_error( msg )
2794char msg[];
2795#endif
2796 {
2797 (void) fprintf( stderr, "%s\n", msg );
2798 exit( YY_EXIT_FAILURE );
2799 }
2800
2801
2802
2803/* Redefine yyless() so it works in section 3 code. */
2804
2805#undef yyless
2806#define yyless(n) \
2807 do \
2808 { \
2809 /* Undo effects of setting up yytext. */ \
2810 yytext[yyleng] = yy_hold_char; \
2811 yy_c_buf_p = yytext + n; \
2812 yy_hold_char = *yy_c_buf_p; \
2813 *yy_c_buf_p = '\0'; \
2814 yyleng = n; \
2815 } \
2816 while ( 0 )
2817
2818
2819/* Internal utility routines. */
2820
2821#ifndef yytext_ptr
2822#ifdef YY_USE_PROTOS
2823static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2824#else
2825static void yy_flex_strncpy( s1, s2, n )
2826char *s1;
2827yyconst char *s2;
2828int n;
2829#endif
2830 {
2831 register int i;
2832 for ( i = 0; i < n; ++i )
2833 s1[i] = s2[i];
2834 }
2835#endif
2836
2837#ifdef YY_NEED_STRLEN
2838#ifdef YY_USE_PROTOS
2839static int yy_flex_strlen( yyconst char *s )
2840#else
2841static int yy_flex_strlen( s )
2842yyconst char *s;
2843#endif
2844 {
2845 register int n;
2846 for ( n = 0; s[n]; ++n )
2847 ;
2848
2849 return n;
2850 }
2851#endif
2852
2853
2854#ifdef YY_USE_PROTOS
2855static void *yy_flex_alloc( yy_size_t size )
2856#else
2857static void *yy_flex_alloc( size )
2858yy_size_t size;
2859#endif
2860 {
2861 return (void *) malloc( size );
2862 }
2863
2864#ifdef YY_USE_PROTOS
2865static void *yy_flex_realloc( void *ptr, yy_size_t size )
2866#else
2867static void *yy_flex_realloc( ptr, size )
2868void *ptr;
2869yy_size_t size;
2870#endif
2871 {
2872 /* The cast to (char *) in the following accommodates both
2873 * implementations that use char* generic pointers, and those
2874 * that use void* generic pointers. It works with the latter
2875 * because both ANSI C and C++ allow castless assignment from
2876 * any pointer type to void*, and deal with argument conversions
2877 * as though doing an assignment.
2878 */
2879 return (void *) realloc( (char *) ptr, size );
2880 }
2881
2882#ifdef YY_USE_PROTOS
2883static void yy_flex_free( void *ptr )
2884#else
2885static void yy_flex_free( ptr )
2886void *ptr;
2887#endif
2888 {
2889 free( ptr );
2890 }
2891
2892#if YY_MAIN
2893int main()
2894 {
2895 yylex();
2896 return 0;
2897 }
2898#endif
2899#line 672 "scan-gram.l"
2900
2901
2902/*------------------------------------------------------------------.
2903| TEXT is pointing to a wannabee semantic value (i.e., a `$'). |
2904| |
2905| Possible inputs: $[<TYPENAME>]($|integer) |
2906| |
2907| Output to the STRING_OBSTACK a reference to this semantic value. |
2908`------------------------------------------------------------------*/
2909
2910static inline void
2911handle_action_dollar (char *text, location_t location)
2912{
2913 const char *type_name = NULL;
2914 char *cp = text + 1;
2915
2916 /* Get the type name if explicit. */
2917 if (*cp == '<')
2918 {
2919 type_name = ++cp;
2920 while (*cp != '>')
2921 ++cp;
2922 *cp = '\0';
2923 ++cp;
2924 }
2925
2926 if (*cp == '$')
2927 {
2928 if (!type_name)
2929 type_name = symbol_list_n_type_name_get (current_rule, location, 0);
2930 if (!type_name && typed)
2931 complain_at (location, _("$$ of `%s' has no declared type"),
2932 current_rule->sym->tag);
2933 if (!type_name)
2934 type_name = "";
2935 obstack_fgrow1 (&string_obstack,
2936 "]b4_lhs_value([%s])[", type_name);
2937 }
2938 else
2939 {
2940 long num;
2941 errno = 0;
2942 num = strtol (cp, 0, 10);
2943
2944 if (INT_MIN <= num && num <= rule_length && ! errno)
2945 {
2946 int n = num;
2947 if (!type_name && n > 0)
2948 type_name = symbol_list_n_type_name_get (current_rule, location,
2949 n);
2950 if (!type_name && typed)
2951 complain_at (location, _("$%d of `%s' has no declared type"),
2952 n, current_rule->sym->tag);
2953 if (!type_name)
2954 type_name = "";
2955 obstack_fgrow3 (&string_obstack,
2956 "]b4_rhs_value([%d], [%d], [%s])[",
2957 rule_length, n, type_name);
2958 }
2959 else
2960 complain_at (location, _("invalid value: %s"), text);
2961 }
2962}
2963
2964
2965/*---------------------------------------------------------------.
2966| TEXT is expected to be $$ in some code associated to a symbol: |
2967| destructor or printer. |
2968`---------------------------------------------------------------*/
2969
2970static inline void
2971handle_symbol_code_dollar (char *text, location_t location)
2972{
2973 char *cp = text + 1;
2974 if (*cp == '$')
2975 obstack_sgrow (&string_obstack, "]b4_dollar_dollar[");
2976 else
2977 complain_at (location, _("%s is invalid"), quote_n (1, text));
2978}
2979
2980
2981/*-----------------------------------------------------------------.
2982| Dispatch onto handle_action_dollar, or handle_destructor_dollar, |
2983| depending upon CODE_KIND. |
2984`-----------------------------------------------------------------*/
2985
2986static void
2987handle_dollar (braced_code_t braced_code_kind,
2988 char *text, location_t location)
2989{
2990 switch (braced_code_kind)
2991 {
2992 case action_braced_code:
2993 handle_action_dollar (text, location);
2994 break;
2995
2996 case destructor_braced_code:
2997 case printer_braced_code:
2998 handle_symbol_code_dollar (text, location);
2999 break;
3000 }
3001}
3002
3003
3004/*------------------------------------------------------.
3005| TEXT is a location token (i.e., a `@...'). Output to |
3006| STRING_OBSTACK a reference to this location. |
3007`------------------------------------------------------*/
3008
3009static inline void
3010handle_action_at (char *text, location_t location)
3011{
3012 char *cp = text + 1;
3013 locations_flag = 1;
3014
3015 if (*cp == '$')
3016 {
3017 obstack_sgrow (&string_obstack, "]b4_lhs_location[");
3018 }
3019 else
3020 {
3021 long num;
3022 errno = 0;
3023 num = strtol (cp, 0, 10);
3024
3025 if (INT_MIN <= num && num <= rule_length && ! errno)
3026 {
3027 int n = num;
3028 obstack_fgrow2 (&string_obstack, "]b4_rhs_location([%d], [%d])[",
3029 rule_length, n);
3030 }
3031 else
3032 complain_at (location, _("invalid value: %s"), text);
3033 }
3034}
3035
3036
3037/*---------------------------------------------------------------.
3038| TEXT is expected to be @$ in some code associated to a symbol: |
3039| destructor or printer. |
3040`---------------------------------------------------------------*/
3041
3042static inline void
3043handle_symbol_code_at (char *text, location_t location)
3044{
3045 char *cp = text + 1;
3046 if (*cp == '$')
3047 obstack_sgrow (&string_obstack, "]b4_at_dollar[");
3048 else
3049 complain_at (location, _("%s is invalid"), quote_n (1, text));
3050}
3051
3052
3053/*-------------------------------------------------------------------.
3054| Dispatch onto handle_action_at, or handle_destructor_at, depending |
3055| upon CODE_KIND. |
3056`-------------------------------------------------------------------*/
3057
3058static void
3059handle_at (braced_code_t braced_code_kind,
3060 char *text, location_t location)
3061{
3062 switch (braced_code_kind)
3063 {
3064 case action_braced_code:
3065 handle_action_at (text, location);
3066 break;
3067
3068 case destructor_braced_code:
3069 case printer_braced_code:
3070 handle_symbol_code_at (text, location);
3071 break;
3072 }
3073}
3074
3075
3076/*------------------------------------------------------------------.
3077| Convert universal character name UCN to a single-byte character, |
3078| and return that character. Return -1 if UCN does not correspond |
3079| to a single-byte character. |
3080`------------------------------------------------------------------*/
3081
3082static int
3083convert_ucn_to_byte (char const *ucn)
3084{
3085 unsigned long code = strtoul (ucn + 2, 0, 16);
3086
3087 /* FIXME: Currently we assume Unicode-compatible unibyte characters
3088 on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On
3089 non-ASCII hosts we support only the portable C character set.
3090 These limitations should be removed once we add support for
3091 multibyte characters. */
3092
3093 if (UCHAR_MAX < code)
3094 return -1;
3095
3096#if ! ('$' == 0x24 && '@' == 0x40 && '`' == 0x60 && '~' == 0x7e)
3097 {
3098 /* A non-ASCII host. Use CODE to index into a table of the C
3099 basic execution character set, which is guaranteed to exist on
3100 all Standard C platforms. This table also includes '$', '@',
3101 and '`', which not in the basic execution character set but
3102 which are unibyte characters on all the platforms that we know
3103 about. */
3104 static signed char const table[] =
3105 {
3106 '\0', -1, -1, -1, -1, -1, -1, '\a',
3107 '\b', '\t', '\n', '\v', '\f', '\r', -1, -1,
3108 -1, -1, -1, -1, -1, -1, -1, -1,
3109 -1, -1, -1, -1, -1, -1, -1, -1,
3110 ' ', '!', '"', '#', '$', '%', '&', '\'',
3111 '(', ')', '*', '+', ',', '-', '.', '/',
3112 '0', '1', '2', '3', '4', '5', '6', '7',
3113 '8', '9', ':', ';', '<', '=', '>', '?',
3114 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
3115 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
3116 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
3117 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
3118 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
3119 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
3120 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
3121 'x', 'y', 'z', '{', '|', '}', '~'
3122 };
3123
3124 code = code < sizeof table ? table[code] : -1;
3125 }
3126#endif
3127
3128 return code;
3129}
3130
3131
3132/*-------------------------.
3133| Initialize the scanner. |
3134`-------------------------*/
3135
3136void
3137scanner_initialize (void)
3138{
3139 obstack_init (&string_obstack);
3140}
3141
3142
3143/*-----------------------------------------------.
3144| Free all the memory allocated to the scanner. |
3145`-----------------------------------------------*/
3146
3147void
3148scanner_free (void)
3149{
3150 obstack_free (&string_obstack, 0);
3151 /* Reclaim Flex's buffers. */
3152 yy_delete_buffer (YY_CURRENT_BUFFER);
3153}