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