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