]> git.saurik.com Git - bison.git/blame - src/scan-gram.c
Regen.
[bison.git] / src / scan-gram.c
CommitLineData
e9955c83
AD
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
eb714592 18#line 19 "scan-gram.c"
e9955c83
AD
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>
1a43c452 30#include <errno.h>
e9955c83
AD
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>
1a43c452 43#ifndef _WIN32
e9955c83 44#include <unistd.h>
1a43c452
AD
45#else
46#ifndef YY_ALWAYS_INTERACTIVE
47#ifndef YY_NEVER_INTERACTIVE
48extern int isatty YY_PROTO(( int ));
49#endif
50#endif
51#endif
e9955c83
AD
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
125typedef struct yy_buffer_state *YY_BUFFER_STATE;
126
127extern int yyleng;
128extern 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 */
167typedef unsigned int yy_size_t;
168
169
170struct 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
227static 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. */
237static char yy_hold_char;
238
239static int yy_n_chars; /* number of characters read into yy_ch_buf */
240
241
242int yyleng;
243
244/* Points to current character in buffer. */
245static char *yy_c_buf_p = (char *) 0;
246static int yy_init = 1; /* whether we need to initialize */
247static 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 */
252static int yy_did_buffer_switch_on_eof;
253
254void yyrestart YY_PROTO(( FILE *input_file ));
255
256void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
257void yy_load_buffer_state YY_PROTO(( void ));
258YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
259void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
260void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
261void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
262#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
263
264YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
265YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
266YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
267
268static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
269static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
270static 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
295typedef unsigned char YY_CHAR;
296FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
297typedef int yy_state_type;
298
299#define FLEX_DEBUG
300extern char *yytext;
301#define yytext_ptr yytext
302
303static yy_state_type yy_get_previous_state YY_PROTO(( void ));
304static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
305static int yy_get_next_buffer YY_PROTO(( void ));
306static 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
03cae905
PE
318#define YY_NUM_RULES 102
319#define YY_END_OF_BUFFER 103
320static yyconst short int yy_accept[391] =
e9955c83 321 { 0,
03cae905
PE
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,
e9955c83 339 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
e9955c83 340 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
03cae905
PE
341 46, 49, 0, 0, 0, 85, 0, 0, 0, 0,
342 80, 0, 0, 0, 64, 0, 0, 65, 0, 0,
e9955c83 343
03cae905 344 0, 101, 101, 0, 0, 0, 0, 0, 0, 0,
e9955c83 345 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
ae7453f2 346 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
03cae905
PE
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
e9955c83
AD
364 } ;
365
366static yyconst int yy_ec[256] =
367 { 0,
368 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
03cae905 369 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
e9955c83 370 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
03cae905
PE
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,
e9955c83
AD
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
03cae905 398static yyconst int yy_meta[54] =
e9955c83 399 { 0,
03cae905
PE
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
e9955c83
AD
406 } ;
407
03cae905 408static yyconst short int yy_base[427] =
e9955c83 409 { 0,
03cae905
PE
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
e9955c83
AD
457 } ;
458
03cae905 459static yyconst short int yy_def[427] =
e9955c83 460 { 0,
03cae905
PE
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
e9955c83
AD
508 } ;
509
03cae905 510static yyconst short int yy_nxt[865] =
e9955c83 511 { 0,
03cae905
PE
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
e9955c83
AD
607 } ;
608
03cae905 609static yyconst short int yy_chk[865] =
e9955c83
AD
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,
03cae905
PE
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
e9955c83
AD
706 } ;
707
708static yy_state_type yy_last_accepting_state;
709static char *yy_last_accepting_cpos;
710
711extern int yy_flex_debug;
712int yy_flex_debug = 1;
713
03cae905 714static yyconst short int yy_rule_linenum[102] =
e9955c83 715 { 0,
03cae905
PE
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
e9955c83
AD
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
737char *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"
03cae905 765#include "mbswidth.h"
e9955c83
AD
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. */
8efe435c
AD
773#define YY_USER_INIT \
774do { \
775 LOCATION_RESET (*yylloc); \
1a715ef2 776 yylloc->file = infile; \
8efe435c
AD
777 /* This is only to avoid GCC warnings. */ \
778 if (yycontrol) {;}; \
779} while (0)
780
03cae905
PE
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
791static size_t
792no_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
836static void
837extend_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
e9955c83 870
44995b2e
AD
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
1d6412ad
AD
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. */
44995b2e
AD
879
880static struct obstack string_obstack;
881char *last_string;
882
44995b2e
AD
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); \
44995b2e
AD
890 } while (0)
891
892#define YY_OBS_FREE \
893 do { \
894 obstack_free (&string_obstack, last_string); \
895 } while (0)
e9955c83 896
4cdb01db
AD
897void
898scanner_last_string_free (void)
899{
900 YY_OBS_FREE;
901}
902
903
e9955c83
AD
904static int braces_level = 0;
905static int percent_percent_count = 0;
906
3b7d4eb2
PE
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. */
913static int rule_length;
914
d33cb3ae
PE
915static void handle_dollar (braced_code_t code_kind,
916 char *cp, location_t location);
917static void handle_at (braced_code_t code_kind,
918 char *cp, location_t location);
03cae905 919static int convert_ucn_to_byte (char const *hex_text);
e9955c83
AD
920
921#define SC_COMMENT 1
03cae905
PE
922#define SC_LINE_COMMENT 2
923#define SC_YACC_COMMENT 3
e9955c83 924
03cae905
PE
925#define SC_STRING 4
926#define SC_CHARACTER 5
e9955c83 927
03cae905
PE
928#define SC_ESCAPED_STRING 6
929#define SC_ESCAPED_CHARACTER 7
e9955c83 930
03cae905
PE
931#define SC_BRACED_CODE 8
932#define SC_PROLOGUE 9
933#define SC_EPILOGUE 10
e9955c83 934
03cae905
PE
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. */
1a43c452 940#line 941 "scan-gram.c"
e9955c83
AD
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
948extern "C" int yywrap YY_PROTO(( void ));
949#else
950extern int yywrap YY_PROTO(( void ));
951#endif
952#endif
953
954#ifndef YY_NO_UNPUT
955static void yyunput YY_PROTO(( int c, char *buf_ptr ));
956#endif
957
958#ifndef yytext_ptr
959static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
960#endif
961
962#ifdef YY_NEED_STRLEN
963static int yy_flex_strlen YY_PROTO(( yyconst char * ));
964#endif
965
966#ifndef YY_NO_INPUT
967#ifdef __cplusplus
968static int yyinput YY_PROTO(( void ));
969#else
970static int input YY_PROTO(( void ));
971#endif
972#endif
973
974#if YY_STACK_USED
975static int yy_start_stack_ptr = 0;
976static int yy_start_stack_depth = 0;
977static int *yy_start_stack = 0;
978#ifndef YY_NO_PUSH_STATE
979static void yy_push_state YY_PROTO(( int new_state ));
980#endif
981#ifndef YY_NO_POP_STATE
982static void yy_pop_state YY_PROTO(( void ));
983#endif
984#ifndef YY_NO_TOP_STATE
985static 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
995YY_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 } \
1a43c452
AD
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 }
e9955c83
AD
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
1096YY_DECL
1097 {
1098 register yy_state_type yy_current_state;
1099 register char *yy_cp, *yy_bp;
1100 register int yy_act;
1101
03cae905 1102#line 202 "scan-gram.l"
e9955c83
AD
1103
1104
1105 /* At each yylex invocation, mark the current position as the
1106 start of the next token. */
e9955c83 1107 YY_STEP;
e9955c83
AD
1108
1109
1110
1111 /*----------------------------.
1112 | Scanning Bison directives. |
1113 `----------------------------*/
1a43c452 1114#line 1115 "scan-gram.c"
e9955c83
AD
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;
1153yy_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];
03cae905 1165 if ( yy_current_state >= 391 )
e9955c83
AD
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 }
03cae905 1171 while ( yy_base[yy_current_state] != 811 );
e9955c83
AD
1172
1173yy_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
1185do_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" );
03cae905 1191 else if ( yy_act < 102 )
e9955c83
AD
1192 fprintf( stderr, "--accepting rule at line %d (\"%s\")\n",
1193 yy_rule_linenum[yy_act], yytext );
03cae905 1194 else if ( yy_act == 102 )
e9955c83
AD
1195 fprintf( stderr, "--accepting default rule (\"%s\")\n",
1196 yytext );
03cae905 1197 else if ( yy_act == 103 )
e9955c83
AD
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
1214case 1:
1215YY_RULE_SETUP
03cae905 1216#line 215 "scan-gram.l"
e9955c83
AD
1217return PERCENT_NONASSOC;
1218 YY_BREAK
1219case 2:
1220YY_RULE_SETUP
03cae905 1221#line 216 "scan-gram.l"
e9955c83
AD
1222return PERCENT_DEBUG;
1223 YY_BREAK
1224case 3:
1225YY_RULE_SETUP
03cae905 1226#line 217 "scan-gram.l"
e9955c83
AD
1227return PERCENT_DEFINE;
1228 YY_BREAK
1229case 4:
1230YY_RULE_SETUP
03cae905 1231#line 218 "scan-gram.l"
e9955c83
AD
1232return PERCENT_DEFINES;
1233 YY_BREAK
1234case 5:
1235YY_RULE_SETUP
03cae905 1236#line 219 "scan-gram.l"
9280d3ef 1237return PERCENT_DESTRUCTOR;
e9955c83
AD
1238 YY_BREAK
1239case 6:
1240YY_RULE_SETUP
03cae905 1241#line 220 "scan-gram.l"
676385e2 1242return PERCENT_DPREC;
e9955c83
AD
1243 YY_BREAK
1244case 7:
1245YY_RULE_SETUP
03cae905 1246#line 221 "scan-gram.l"
676385e2 1247return PERCENT_ERROR_VERBOSE;
e9955c83
AD
1248 YY_BREAK
1249case 8:
1250YY_RULE_SETUP
03cae905 1251#line 222 "scan-gram.l"
676385e2 1252return PERCENT_EXPECT;
e9955c83
AD
1253 YY_BREAK
1254case 9:
1255YY_RULE_SETUP
03cae905 1256#line 223 "scan-gram.l"
676385e2 1257return PERCENT_FILE_PREFIX;
e9955c83
AD
1258 YY_BREAK
1259case 10:
1260YY_RULE_SETUP
03cae905 1261#line 224 "scan-gram.l"
676385e2 1262return PERCENT_YACC;
e9955c83
AD
1263 YY_BREAK
1264case 11:
1265YY_RULE_SETUP
03cae905 1266#line 225 "scan-gram.l"
676385e2 1267return PERCENT_GLR_PARSER;
e9955c83
AD
1268 YY_BREAK
1269case 12:
1270YY_RULE_SETUP
03cae905 1271#line 226 "scan-gram.l"
676385e2 1272return PERCENT_LEFT;
e9955c83
AD
1273 YY_BREAK
1274case 13:
1275YY_RULE_SETUP
03cae905 1276#line 227 "scan-gram.l"
676385e2 1277return PERCENT_LOCATIONS;
e9955c83
AD
1278 YY_BREAK
1279case 14:
1280YY_RULE_SETUP
03cae905 1281#line 228 "scan-gram.l"
676385e2 1282return PERCENT_MERGE;
e9955c83
AD
1283 YY_BREAK
1284case 15:
1285YY_RULE_SETUP
03cae905 1286#line 229 "scan-gram.l"
676385e2 1287return PERCENT_NAME_PREFIX;
e9955c83
AD
1288 YY_BREAK
1289case 16:
1290YY_RULE_SETUP
03cae905 1291#line 230 "scan-gram.l"
676385e2 1292return PERCENT_NO_LINES;
e9955c83
AD
1293 YY_BREAK
1294case 17:
1295YY_RULE_SETUP
03cae905 1296#line 231 "scan-gram.l"
676385e2 1297return PERCENT_NONASSOC;
e9955c83
AD
1298 YY_BREAK
1299case 18:
1300YY_RULE_SETUP
03cae905 1301#line 232 "scan-gram.l"
676385e2 1302return PERCENT_NTERM;
e9955c83
AD
1303 YY_BREAK
1304case 19:
1305YY_RULE_SETUP
03cae905 1306#line 233 "scan-gram.l"
676385e2 1307return PERCENT_OUTPUT;
e9955c83
AD
1308 YY_BREAK
1309case 20:
1310YY_RULE_SETUP
03cae905 1311#line 234 "scan-gram.l"
ae7453f2 1312return PERCENT_PARSE_PARAM;
e9955c83
AD
1313 YY_BREAK
1314case 21:
1315YY_RULE_SETUP
03cae905
PE
1316#line 235 "scan-gram.l"
1317rule_length--; return PERCENT_PREC;
e9955c83
AD
1318 YY_BREAK
1319case 22:
1320YY_RULE_SETUP
03cae905 1321#line 236 "scan-gram.l"
ae7453f2 1322return PERCENT_PRINTER;
e9955c83
AD
1323 YY_BREAK
1324case 23:
1325YY_RULE_SETUP
03cae905 1326#line 237 "scan-gram.l"
ae7453f2 1327return PERCENT_PURE_PARSER;
e9955c83
AD
1328 YY_BREAK
1329case 24:
1330YY_RULE_SETUP
03cae905 1331#line 238 "scan-gram.l"
ae7453f2 1332return PERCENT_RIGHT;
e9955c83
AD
1333 YY_BREAK
1334case 25:
1335YY_RULE_SETUP
03cae905 1336#line 239 "scan-gram.l"
ae7453f2 1337return PERCENT_LEX_PARAM;
e9955c83
AD
1338 YY_BREAK
1339case 26:
1340YY_RULE_SETUP
03cae905 1341#line 240 "scan-gram.l"
ae7453f2 1342return PERCENT_SKELETON;
e9955c83
AD
1343 YY_BREAK
1344case 27:
1345YY_RULE_SETUP
03cae905 1346#line 241 "scan-gram.l"
ae7453f2 1347return PERCENT_START;
e9955c83
AD
1348 YY_BREAK
1349case 28:
1350YY_RULE_SETUP
03cae905 1351#line 242 "scan-gram.l"
ae7453f2 1352return PERCENT_TOKEN;
e9955c83
AD
1353 YY_BREAK
1354case 29:
1355YY_RULE_SETUP
03cae905 1356#line 243 "scan-gram.l"
ae7453f2 1357return PERCENT_TOKEN;
e9955c83
AD
1358 YY_BREAK
1359case 30:
1360YY_RULE_SETUP
03cae905 1361#line 244 "scan-gram.l"
ae7453f2 1362return PERCENT_TOKEN_TABLE;
e9955c83
AD
1363 YY_BREAK
1364case 31:
1365YY_RULE_SETUP
03cae905 1366#line 245 "scan-gram.l"
ae7453f2 1367return PERCENT_TYPE;
e9955c83
AD
1368 YY_BREAK
1369case 32:
1370YY_RULE_SETUP
03cae905 1371#line 246 "scan-gram.l"
ae7453f2 1372return PERCENT_UNION;
e9955c83
AD
1373 YY_BREAK
1374case 33:
1375YY_RULE_SETUP
03cae905 1376#line 247 "scan-gram.l"
ae7453f2 1377return PERCENT_VERBOSE;
e9955c83
AD
1378 YY_BREAK
1379case 34:
1380YY_RULE_SETUP
03cae905 1381#line 248 "scan-gram.l"
ae7453f2 1382return PERCENT_YACC;
9280d3ef
AD
1383 YY_BREAK
1384case 35:
1385YY_RULE_SETUP
03cae905 1386#line 250 "scan-gram.l"
ae7453f2 1387return EQUAL;
676385e2
PH
1388 YY_BREAK
1389case 36:
1390YY_RULE_SETUP
03cae905
PE
1391#line 251 "scan-gram.l"
1392rule_length = 0; return COLON;
676385e2
PH
1393 YY_BREAK
1394case 37:
1395YY_RULE_SETUP
03cae905
PE
1396#line 252 "scan-gram.l"
1397rule_length = 0; return PIPE;
676385e2
PH
1398 YY_BREAK
1399case 38:
1400YY_RULE_SETUP
03cae905 1401#line 253 "scan-gram.l"
ae7453f2
AD
1402return COMMA;
1403 YY_BREAK
1404case 39:
1405YY_RULE_SETUP
03cae905 1406#line 254 "scan-gram.l"
ae7453f2
AD
1407return SEMICOLON;
1408 YY_BREAK
1409case 40:
1410YY_RULE_SETUP
03cae905 1411#line 256 "scan-gram.l"
366eea36
AD
1412YY_STEP;
1413 YY_BREAK
03cae905 1414case 41:
366eea36 1415YY_RULE_SETUP
03cae905 1416#line 258 "scan-gram.l"
e9955c83 1417{
39f41916 1418 yylval->symbol = symbol_get (yytext, *yylloc);
3b7d4eb2 1419 rule_length++;
e9955c83
AD
1420 return ID;
1421 }
1422 YY_BREAK
03cae905 1423case 42:
e9955c83 1424YY_RULE_SETUP
03cae905
PE
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 }
e9955c83
AD
1438 YY_BREAK
1439/* Characters. We don't check there is only one. */
03cae905 1440case 43:
e9955c83 1441YY_RULE_SETUP
03cae905 1442#line 278 "scan-gram.l"
1d6412ad 1443YY_OBS_GROW; yy_push_state (SC_ESCAPED_CHARACTER);
e9955c83
AD
1444 YY_BREAK
1445/* Strings. */
03cae905 1446case 44:
e9955c83 1447YY_RULE_SETUP
03cae905 1448#line 281 "scan-gram.l"
1d6412ad 1449YY_OBS_GROW; yy_push_state (SC_ESCAPED_STRING);
e9955c83
AD
1450 YY_BREAK
1451/* Comments. */
03cae905 1452case 45:
e9955c83 1453YY_RULE_SETUP
03cae905
PE
1454#line 284 "scan-gram.l"
1455BEGIN SC_YACC_COMMENT;
e9955c83 1456 YY_BREAK
03cae905 1457case 46:
e9955c83 1458YY_RULE_SETUP
03cae905 1459#line 285 "scan-gram.l"
e9955c83
AD
1460YY_STEP;
1461 YY_BREAK
1462/* Prologue. */
03cae905 1463case 47:
e9955c83 1464YY_RULE_SETUP
03cae905 1465#line 288 "scan-gram.l"
1d6412ad 1466yy_push_state (SC_PROLOGUE);
e9955c83
AD
1467 YY_BREAK
1468/* Code in between braces. */
03cae905 1469case 48:
e9955c83 1470YY_RULE_SETUP
03cae905 1471#line 291 "scan-gram.l"
1d6412ad 1472YY_OBS_GROW; ++braces_level; yy_push_state (SC_BRACED_CODE);
e9955c83
AD
1473 YY_BREAK
1474/* A type. */
03cae905 1475case 49:
e9955c83 1476YY_RULE_SETUP
03cae905 1477#line 294 "scan-gram.l"
4cdb01db 1478{
4cdb01db
AD
1479 obstack_grow (&string_obstack, yytext + 1, yyleng - 2);
1480 YY_OBS_FINISH;
1481 yylval->string = last_string;
1482 return TYPE;
1483 }
e9955c83 1484 YY_BREAK
03cae905 1485case 50:
e9955c83 1486YY_RULE_SETUP
03cae905 1487#line 302 "scan-gram.l"
e9955c83
AD
1488{
1489 if (++percent_percent_count == 2)
1490 yy_push_state (SC_EPILOGUE);
1491 return PERCENT_PERCENT;
1492 }
1493 YY_BREAK
03cae905 1494case 51:
e9955c83 1495YY_RULE_SETUP
03cae905 1496#line 308 "scan-gram.l"
e9955c83
AD
1497{
1498 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1499 fprintf (stderr, _(": invalid character: `%c'\n"), *yytext);
e9955c83
AD
1500 YY_STEP;
1501 }
1502 YY_BREAK
1503
03cae905
PE
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 `-------------------------------------------------------------------*/
e9955c83
AD
1509
1510
03cae905 1511case 52:
e9955c83 1512YY_RULE_SETUP
03cae905
PE
1513#line 324 "scan-gram.l"
1514obstack_sgrow (&string_obstack, "@<:@");
e9955c83 1515 YY_BREAK
03cae905 1516case 53:
e9955c83 1517YY_RULE_SETUP
03cae905
PE
1518#line 325 "scan-gram.l"
1519obstack_sgrow (&string_obstack, "@:>@");
e9955c83
AD
1520 YY_BREAK
1521
03cae905
PE
1522/*---------------------------------------------------------------.
1523 | Scanning a Yacc comment. The initial `/ *' is already eaten. |
1524 `---------------------------------------------------------------*/
e9955c83
AD
1525
1526
03cae905
PE
1527case 54:
1528YY_RULE_SETUP
1529#line 335 "scan-gram.l"
1530{
1531 YY_STEP;
1532 BEGIN INITIAL;
1533 }
1534 YY_BREAK
ae7453f2 1535case 55:
e9955c83 1536YY_RULE_SETUP
03cae905
PE
1537#line 340 "scan-gram.l"
1538;
1539 YY_BREAK
1540case 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;
e9955c83
AD
1546 }
1547 YY_BREAK
03cae905
PE
1548
1549/*------------------------------------------------------------.
1550 | Scanning a C comment. The initial `/ *' is already eaten. |
1551 `------------------------------------------------------------*/
1552
1553
ae7453f2 1554case 56:
e9955c83 1555YY_RULE_SETUP
03cae905
PE
1556#line 356 "scan-gram.l"
1557YY_OBS_GROW; yy_pop_state ();
e9955c83 1558 YY_BREAK
ae7453f2 1559case 57:
e9955c83 1560YY_RULE_SETUP
03cae905
PE
1561#line 357 "scan-gram.l"
1562YY_OBS_GROW;
e9955c83
AD
1563 YY_BREAK
1564case YY_STATE_EOF(SC_COMMENT):
03cae905 1565#line 359 "scan-gram.l"
e9955c83
AD
1566{
1567 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1568 fprintf (stderr, _(": unexpected end of file in a comment\n"));
e9955c83
AD
1569 yy_pop_state ();
1570 }
1571 YY_BREAK
1572
03cae905
PE
1573/*--------------------------------------------------------------.
1574 | Scanning a line comment. The initial `//' is already eaten. |
1575 `--------------------------------------------------------------*/
1576
1577
1578case 58:
1579YY_RULE_SETUP
1580#line 373 "scan-gram.l"
1581YY_OBS_GROW; yy_pop_state ();
1582 YY_BREAK
1583case 59:
1584YY_RULE_SETUP
1585#line 374 "scan-gram.l"
1586YY_OBS_GROW;
1587 YY_BREAK
1588case YY_STATE_EOF(SC_LINE_COMMENT):
1589#line 375 "scan-gram.l"
1590yy_pop_state ();
1591 YY_BREAK
1592
e9955c83
AD
1593/*----------------------------------------------------------------.
1594 | Scanning a C string, including its escapes. The initial `"' is |
1595 | already eaten. |
1596 `----------------------------------------------------------------*/
1597
1598
03cae905 1599case 60:
e9955c83 1600YY_RULE_SETUP
03cae905 1601#line 386 "scan-gram.l"
e9955c83
AD
1602{
1603 assert (yy_top_state () == INITIAL);
44995b2e
AD
1604 YY_OBS_GROW;
1605 YY_OBS_FINISH;
4cdb01db 1606 yylval->string = last_string;
e9955c83 1607 yy_pop_state ();
3b7d4eb2 1608 rule_length++;
e9955c83
AD
1609 return STRING;
1610 }
1611 YY_BREAK
ae7453f2 1612case 61:
e9955c83 1613YY_RULE_SETUP
03cae905
PE
1614#line 396 "scan-gram.l"
1615YY_OBS_GROW;
e9955c83
AD
1616 YY_BREAK
1617case YY_STATE_EOF(SC_ESCAPED_STRING):
03cae905 1618#line 398 "scan-gram.l"
e9955c83
AD
1619{
1620 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1621 fprintf (stderr, _(": unexpected end of file in a string\n"));
e9955c83 1622 assert (yy_top_state () == INITIAL);
44995b2e 1623 YY_OBS_FINISH;
4cdb01db 1624 yylval->string = last_string;
e9955c83
AD
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
ae7453f2 1636case 62:
e9955c83 1637YY_RULE_SETUP
03cae905 1638#line 416 "scan-gram.l"
e9955c83 1639{
44995b2e 1640 YY_OBS_GROW;
e9955c83
AD
1641 assert (yy_top_state () == INITIAL);
1642 {
44995b2e 1643 YY_OBS_FINISH;
39f41916 1644 yylval->symbol = symbol_get (last_string, *yylloc);
e776192e 1645 symbol_class_set (yylval->symbol, token_sym, *yylloc);
524346a3
AD
1646 symbol_user_token_number_set (yylval->symbol,
1647 (unsigned char) last_string[1], *yylloc);
44995b2e 1648 YY_OBS_FREE;
e9955c83 1649 yy_pop_state ();
3b7d4eb2 1650 rule_length++;
e9955c83
AD
1651 return ID;
1652 }
1653 }
1654 YY_BREAK
ae7453f2 1655case 63:
e9955c83 1656YY_RULE_SETUP
03cae905 1657#line 432 "scan-gram.l"
44995b2e 1658YY_OBS_GROW;
e9955c83 1659 YY_BREAK
e9955c83 1660case YY_STATE_EOF(SC_ESCAPED_CHARACTER):
03cae905 1661#line 434 "scan-gram.l"
e9955c83
AD
1662{
1663 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1664 fprintf (stderr, _(": unexpected end of file in a character\n"));
e9955c83 1665 assert (yy_top_state () == INITIAL);
44995b2e 1666 YY_OBS_FINISH;
4cdb01db 1667 yylval->string = last_string;
e9955c83
AD
1668 yy_pop_state ();
1669 return CHARACTER;
1670 }
1671 YY_BREAK
1672
1673/*----------------------------.
1674 | Decode escaped characters. |
1675 `----------------------------*/
1676
1677
03cae905 1678case 64:
e9955c83 1679YY_RULE_SETUP
03cae905 1680#line 452 "scan-gram.l"
e9955c83 1681{
03cae905
PE
1682 unsigned long c = strtoul (yytext + 1, 0, 8);
1683 if (UCHAR_MAX < c)
e9955c83
AD
1684 {
1685 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1686 fprintf (stderr, _(": invalid escape: %s\n"), quote (yytext));
e9955c83
AD
1687 YY_STEP;
1688 }
1689 else
1690 obstack_1grow (&string_obstack, c);
1691 }
1692 YY_BREAK
03cae905 1693case 65:
e9955c83 1694YY_RULE_SETUP
03cae905 1695#line 464 "scan-gram.l"
e9955c83 1696{
03cae905
PE
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);
e9955c83
AD
1708 }
1709 YY_BREAK
03cae905 1710case 66:
e9955c83 1711YY_RULE_SETUP
03cae905 1712#line 478 "scan-gram.l"
366eea36 1713obstack_1grow (&string_obstack, '\a');
e9955c83 1714 YY_BREAK
03cae905 1715case 67:
e9955c83 1716YY_RULE_SETUP
03cae905 1717#line 479 "scan-gram.l"
366eea36 1718obstack_1grow (&string_obstack, '\b');
e9955c83 1719 YY_BREAK
03cae905 1720case 68:
e9955c83 1721YY_RULE_SETUP
03cae905 1722#line 480 "scan-gram.l"
366eea36 1723obstack_1grow (&string_obstack, '\f');
e9955c83 1724 YY_BREAK
03cae905 1725case 69:
e9955c83 1726YY_RULE_SETUP
03cae905 1727#line 481 "scan-gram.l"
366eea36 1728obstack_1grow (&string_obstack, '\n');
e9955c83 1729 YY_BREAK
03cae905 1730case 70:
e9955c83 1731YY_RULE_SETUP
03cae905 1732#line 482 "scan-gram.l"
366eea36 1733obstack_1grow (&string_obstack, '\r');
e9955c83 1734 YY_BREAK
03cae905 1735case 71:
e9955c83 1736YY_RULE_SETUP
03cae905 1737#line 483 "scan-gram.l"
366eea36 1738obstack_1grow (&string_obstack, '\t');
e9955c83 1739 YY_BREAK
03cae905 1740case 72:
e9955c83 1741YY_RULE_SETUP
03cae905 1742#line 484 "scan-gram.l"
366eea36 1743obstack_1grow (&string_obstack, '\v');
e9955c83 1744 YY_BREAK
03cae905 1745case 73:
e9955c83 1746YY_RULE_SETUP
03cae905 1747#line 485 "scan-gram.l"
366eea36
AD
1748obstack_1grow (&string_obstack, yytext[1]);
1749 YY_BREAK
03cae905
PE
1750case 74:
1751YY_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
ae7453f2 1765case 75:
366eea36 1766YY_RULE_SETUP
03cae905 1767#line 497 "scan-gram.l"
e9955c83
AD
1768{
1769 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1770 fprintf (stderr, _(": unrecognized escape: %s\n"), quote (yytext));
44995b2e 1771 YY_OBS_GROW;
e9955c83
AD
1772 }
1773 YY_BREAK
4f25ebb0 1774/* FLex wants this rule, in case of a `\<<EOF>>'. */
ae7453f2 1775case 76:
4f25ebb0 1776YY_RULE_SETUP
03cae905 1777#line 503 "scan-gram.l"
4f25ebb0
AD
1778YY_OBS_GROW;
1779 YY_BREAK
e9955c83
AD
1780
1781/*----------------------------------------------------------.
1782 | Scanning a C character without decoding its escapes. The |
1783 | initial "'" is already eaten. |
1784 `----------------------------------------------------------*/
1785
1786
ae7453f2 1787case 77:
e9955c83 1788YY_RULE_SETUP
03cae905 1789#line 514 "scan-gram.l"
e9955c83 1790{
44995b2e 1791 YY_OBS_GROW;
e9955c83
AD
1792 assert (yy_top_state () != INITIAL);
1793 yy_pop_state ();
1794 }
1795 YY_BREAK
ae7453f2 1796case 78:
9280d3ef 1797YY_RULE_SETUP
03cae905 1798#line 520 "scan-gram.l"
4f25ebb0
AD
1799YY_OBS_GROW;
1800 YY_BREAK
ae7453f2 1801case 79:
4f25ebb0 1802YY_RULE_SETUP
03cae905 1803#line 521 "scan-gram.l"
4f25ebb0
AD
1804YY_OBS_GROW;
1805 YY_BREAK
ae7453f2 1806case 80:
4f25ebb0 1807YY_RULE_SETUP
03cae905 1808#line 522 "scan-gram.l"
366eea36
AD
1809YY_OBS_GROW;
1810 YY_BREAK
03cae905 1811/* Needed for `\<<EOF>>', `\\<<newline>>[', and `\\<<newline>>]'. */
ae7453f2 1812case 81:
366eea36 1813YY_RULE_SETUP
03cae905
PE
1814#line 524 "scan-gram.l"
1815YY_OBS_GROW;
e9955c83
AD
1816 YY_BREAK
1817case YY_STATE_EOF(SC_CHARACTER):
03cae905 1818#line 526 "scan-gram.l"
e9955c83
AD
1819{
1820 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1821 fprintf (stderr, _(": unexpected end of file in a character\n"));
e9955c83
AD
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
ae7453f2 1833case 82:
e9955c83 1834YY_RULE_SETUP
03cae905 1835#line 542 "scan-gram.l"
e9955c83
AD
1836{
1837 assert (yy_top_state () != INITIAL);
44995b2e 1838 YY_OBS_GROW;
e9955c83
AD
1839 yy_pop_state ();
1840 }
1841 YY_BREAK
ae7453f2 1842case 83:
e9955c83 1843YY_RULE_SETUP
03cae905 1844#line 548 "scan-gram.l"
9280d3ef
AD
1845YY_OBS_GROW;
1846 YY_BREAK
ae7453f2 1847case 84:
4f25ebb0 1848YY_RULE_SETUP
03cae905 1849#line 549 "scan-gram.l"
4f25ebb0
AD
1850YY_OBS_GROW;
1851 YY_BREAK
ae7453f2 1852case 85:
9280d3ef 1853YY_RULE_SETUP
03cae905 1854#line 550 "scan-gram.l"
366eea36
AD
1855YY_OBS_GROW;
1856 YY_BREAK
03cae905 1857/* Needed for `\<<EOF>>', `\\<<newline>>[', and `\\<<newline>>]'. */
ae7453f2 1858case 86:
366eea36 1859YY_RULE_SETUP
03cae905
PE
1860#line 552 "scan-gram.l"
1861YY_OBS_GROW;
e9955c83
AD
1862 YY_BREAK
1863case YY_STATE_EOF(SC_STRING):
03cae905 1864#line 554 "scan-gram.l"
e9955c83
AD
1865{
1866 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1867 fprintf (stderr, _(": unexpected end of file in a string\n"));
e9955c83
AD
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. */
ae7453f2 1879case 87:
e9955c83 1880YY_RULE_SETUP
03cae905 1881#line 570 "scan-gram.l"
44995b2e 1882YY_OBS_GROW; yy_push_state (SC_CHARACTER);
e9955c83
AD
1883 YY_BREAK
1884/* Strings. */
ae7453f2 1885case 88:
e9955c83 1886YY_RULE_SETUP
03cae905 1887#line 573 "scan-gram.l"
44995b2e 1888YY_OBS_GROW; yy_push_state (SC_STRING);
e9955c83
AD
1889 YY_BREAK
1890/* Comments. */
ae7453f2 1891case 89:
e9955c83 1892YY_RULE_SETUP
03cae905 1893#line 576 "scan-gram.l"
44995b2e 1894YY_OBS_GROW; yy_push_state (SC_COMMENT);
e9955c83 1895 YY_BREAK
ae7453f2 1896case 90:
4f25ebb0 1897YY_RULE_SETUP
03cae905
PE
1898#line 577 "scan-gram.l"
1899YY_OBS_GROW; yy_push_state (SC_LINE_COMMENT);
4f25ebb0
AD
1900 YY_BREAK
1901/* Not comments. */
ae7453f2 1902case 91:
e9955c83 1903YY_RULE_SETUP
03cae905 1904#line 580 "scan-gram.l"
44995b2e 1905YY_OBS_GROW;
e9955c83
AD
1906 YY_BREAK
1907
1908/*---------------------------------------------------------------.
1909 | Scanning some code in braces (%union and actions). The initial |
1910 | "{" is already eaten. |
1911 `---------------------------------------------------------------*/
1912
1913
ae7453f2 1914case 92:
e9955c83 1915YY_RULE_SETUP
03cae905 1916#line 591 "scan-gram.l"
e9955c83 1917{
44995b2e 1918 YY_OBS_GROW;
e9955c83
AD
1919 if (--braces_level == 0)
1920 {
1921 yy_pop_state ();
44995b2e 1922 YY_OBS_FINISH;
4cdb01db 1923 yylval->string = last_string;
3b7d4eb2 1924 rule_length++;
e9955c83
AD
1925 return BRACED_CODE;
1926 }
1927 }
1928 YY_BREAK
ae7453f2 1929case 93:
e9955c83 1930YY_RULE_SETUP
03cae905 1931#line 603 "scan-gram.l"
9280d3ef 1932YY_OBS_GROW; braces_level++;
e9955c83 1933 YY_BREAK
ae7453f2 1934case 94:
e9955c83 1935YY_RULE_SETUP
03cae905 1936#line 605 "scan-gram.l"
f25bfb75
AD
1937{ handle_dollar (current_braced_code,
1938 yytext, *yylloc); }
e9955c83 1939 YY_BREAK
ae7453f2 1940case 95:
e9955c83 1941YY_RULE_SETUP
03cae905 1942#line 607 "scan-gram.l"
f25bfb75
AD
1943{ handle_at (current_braced_code,
1944 yytext, *yylloc); }
e9955c83 1945 YY_BREAK
ae7453f2 1946case 96:
e9955c83 1947YY_RULE_SETUP
03cae905 1948#line 610 "scan-gram.l"
9280d3ef
AD
1949YY_OBS_GROW;
1950 YY_BREAK
03cae905 1951/* A stray $, or /, or etc. */
ae7453f2 1952case 97:
9280d3ef 1953YY_RULE_SETUP
03cae905 1954#line 613 "scan-gram.l"
44995b2e 1955YY_OBS_GROW;
e9955c83
AD
1956 YY_BREAK
1957case YY_STATE_EOF(SC_BRACED_CODE):
03cae905 1958#line 615 "scan-gram.l"
e9955c83
AD
1959{
1960 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1961 fprintf (stderr, _(": unexpected end of file in a braced code\n"));
e9955c83 1962 yy_pop_state ();
44995b2e 1963 YY_OBS_FINISH;
4cdb01db
AD
1964 yylval->string = last_string;
1965 return BRACED_CODE;
e9955c83
AD
1966 }
1967 YY_BREAK
1968
1969/*--------------------------------------------------------------.
1970 | Scanning some prologue: from "%{" (already scanned) to "%}". |
1971 `--------------------------------------------------------------*/
1972
1973
03cae905 1974case 98:
e9955c83 1975YY_RULE_SETUP
03cae905 1976#line 633 "scan-gram.l"
e9955c83
AD
1977{
1978 yy_pop_state ();
44995b2e 1979 YY_OBS_FINISH;
4cdb01db 1980 yylval->string = last_string;
e9955c83
AD
1981 return PROLOGUE;
1982 }
1983 YY_BREAK
03cae905 1984case 99:
e9955c83 1985YY_RULE_SETUP
03cae905 1986#line 640 "scan-gram.l"
44995b2e 1987YY_OBS_GROW;
e9955c83 1988 YY_BREAK
03cae905 1989case 100:
e9955c83 1990YY_RULE_SETUP
03cae905 1991#line 641 "scan-gram.l"
366eea36
AD
1992YY_OBS_GROW;
1993 YY_BREAK
e9955c83 1994case YY_STATE_EOF(SC_PROLOGUE):
03cae905 1995#line 643 "scan-gram.l"
e9955c83
AD
1996{
1997 LOCATION_PRINT (stderr, *yylloc);
04b6e11e 1998 fprintf (stderr, _(": unexpected end of file in a prologue\n"));
e9955c83 1999 yy_pop_state ();
44995b2e 2000 YY_OBS_FINISH;
4cdb01db 2001 yylval->string = last_string;
e9955c83
AD
2002 return PROLOGUE;
2003 }
2004 YY_BREAK
2005
2006/*---------------------------------------------------------------.
2007 | Scanning the epilogue (everything after the second "%%", which |
03cae905 2008 | has already been eaten). |
e9955c83
AD
2009 `---------------------------------------------------------------*/
2010
2011
03cae905 2012case 101:
e9955c83 2013YY_RULE_SETUP
03cae905 2014#line 661 "scan-gram.l"
44995b2e 2015YY_OBS_GROW;
e9955c83
AD
2016 YY_BREAK
2017case YY_STATE_EOF(SC_EPILOGUE):
03cae905 2018#line 663 "scan-gram.l"
e9955c83
AD
2019{
2020 yy_pop_state ();
44995b2e 2021 YY_OBS_FINISH;
4cdb01db 2022 yylval->string = last_string;
e9955c83
AD
2023 return EPILOGUE;
2024 }
2025 YY_BREAK
2026
03cae905 2027case 102:
e9955c83 2028YY_RULE_SETUP
03cae905 2029#line 672 "scan-gram.l"
e9955c83
AD
2030YY_FATAL_ERROR( "flex scanner jammed" );
2031 YY_BREAK
1a43c452 2032#line 2033 "scan-gram.c"
e9955c83
AD
2033case 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
2174static 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
2306static 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 {
03cae905 2315 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 53);
e9955c83
AD
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];
03cae905 2324 if ( yy_current_state >= 391 )
e9955c83
AD
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
2341static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2342#else
2343static yy_state_type yy_try_NUL_trans( yy_current_state )
2344yy_state_type yy_current_state;
2345#endif
2346 {
2347 register int yy_is_jam;
2348 register char *yy_cp = yy_c_buf_p;
2349
03cae905 2350 register YY_CHAR yy_c = 53;
e9955c83
AD
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];
03cae905 2359 if ( yy_current_state >= 391 )
e9955c83
AD
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];
03cae905 2363 yy_is_jam = (yy_current_state == 390);
e9955c83
AD
2364
2365 return yy_is_jam ? 0 : yy_current_state;
2366 }
2367
2368
2369#ifndef YY_NO_UNPUT
2370#ifdef YY_USE_PROTOS
2371static void yyunput( int c, register char *yy_bp )
2372#else
2373static void yyunput( c, yy_bp )
2374int c;
2375register 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
2415static int yyinput()
2416#else
2417static 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
2488void yyrestart( FILE *input_file )
2489#else
2490void yyrestart( input_file )
2491FILE *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
2503void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2504#else
2505void yy_switch_to_buffer( new_buffer )
2506YY_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
2533void yy_load_buffer_state( void )
2534#else
2535void 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
2546YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2547#else
2548YY_BUFFER_STATE yy_create_buffer( file, size )
2549FILE *file;
2550int 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
2577void yy_delete_buffer( YY_BUFFER_STATE b )
2578#else
2579void yy_delete_buffer( b )
2580YY_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
1a43c452
AD
2596#ifndef _WIN32
2597#include <unistd.h>
2598#else
e9955c83
AD
2599#ifndef YY_ALWAYS_INTERACTIVE
2600#ifndef YY_NEVER_INTERACTIVE
2601extern int isatty YY_PROTO(( int ));
2602#endif
2603#endif
1a43c452 2604#endif
e9955c83
AD
2605
2606#ifdef YY_USE_PROTOS
2607void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2608#else
2609void yy_init_buffer( b, file )
2610YY_BUFFER_STATE b;
2611FILE *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
2634void yy_flush_buffer( YY_BUFFER_STATE b )
2635#else
2636void yy_flush_buffer( b )
2637YY_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
2665YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
2666#else
2667YY_BUFFER_STATE yy_scan_buffer( base, size )
2668char *base;
2669yy_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
2703YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
2704#else
2705YY_BUFFER_STATE yy_scan_string( yy_str )
2706yyconst 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
2720YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
2721#else
2722YY_BUFFER_STATE yy_scan_bytes( bytes, len )
2723yyconst char *bytes;
2724int 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
2759static void yy_push_state( int new_state )
2760#else
2761static void yy_push_state( new_state )
2762int 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
2792static 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
2803static 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
2814static void yy_fatal_error( yyconst char msg[] )
2815#else
2816static void yy_fatal_error( msg )
2817char 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
2846static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
2847#else
2848static void yy_flex_strncpy( s1, s2, n )
2849char *s1;
2850yyconst char *s2;
2851int 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
2862static int yy_flex_strlen( yyconst char *s )
2863#else
2864static int yy_flex_strlen( s )
2865yyconst 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
2878static void *yy_flex_alloc( yy_size_t size )
2879#else
2880static void *yy_flex_alloc( size )
2881yy_size_t size;
2882#endif
2883 {
2884 return (void *) malloc( size );
2885 }
2886
2887#ifdef YY_USE_PROTOS
2888static void *yy_flex_realloc( void *ptr, yy_size_t size )
2889#else
2890static void *yy_flex_realloc( ptr, size )
2891void *ptr;
2892yy_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
2906static void yy_flex_free( void *ptr )
2907#else
2908static void yy_flex_free( ptr )
2909void *ptr;
2910#endif
2911 {
2912 free( ptr );
2913 }
2914
2915#if YY_MAIN
2916int main()
2917 {
2918 yylex();
2919 return 0;
2920 }
2921#endif
03cae905 2922#line 672 "scan-gram.l"
e9955c83
AD
2923
2924
2925/*------------------------------------------------------------------.
366eea36 2926| TEXT is pointing to a wannabee semantic value (i.e., a `$'). |
e9955c83
AD
2927| |
2928| Possible inputs: $[<TYPENAME>]($|integer) |
2929| |
2930| Output to the STRING_OBSTACK a reference to this semantic value. |
2931`------------------------------------------------------------------*/
2932
f25bfb75 2933static inline void
366eea36 2934handle_action_dollar (char *text, location_t location)
e9955c83
AD
2935{
2936 const char *type_name = NULL;
366eea36 2937 char *cp = text + 1;
e9955c83
AD
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)
56c47203 2952 type_name = symbol_list_n_type_name_get (current_rule, location, 0);
e9955c83 2953 if (!type_name && typed)
56c47203 2954 complain_at (location, _("$$ of `%s' has no declared type"),
97650f4e 2955 current_rule->sym->tag);
e9955c83
AD
2956 if (!type_name)
2957 type_name = "";
2958 obstack_fgrow1 (&string_obstack,
2959 "]b4_lhs_value([%s])[", type_name);
2960 }
03cae905 2961 else
e9955c83 2962 {
03cae905
PE
2963 long num;
2964 errno = 0;
2965 num = strtol (cp, 0, 10);
e9955c83 2966
03cae905 2967 if (INT_MIN <= num && num <= rule_length && ! errno)
e9955c83 2968 {
03cae905 2969 int n = num;
e9955c83 2970 if (!type_name && n > 0)
56c47203
AD
2971 type_name = symbol_list_n_type_name_get (current_rule, location,
2972 n);
e9955c83 2973 if (!type_name && typed)
56c47203 2974 complain_at (location, _("$%d of `%s' has no declared type"),
97650f4e 2975 n, current_rule->sym->tag);
e9955c83
AD
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 }
03cae905
PE
2982 else
2983 complain_at (location, _("invalid value: %s"), text);
9280d3ef
AD
2984 }
2985}
2986
2987
366eea36 2988/*---------------------------------------------------------------.
03cae905 2989| TEXT is expected to be $$ in some code associated to a symbol: |
366eea36
AD
2990| destructor or printer. |
2991`---------------------------------------------------------------*/
9280d3ef 2992
f25bfb75 2993static inline void
366eea36 2994handle_symbol_code_dollar (char *text, location_t location)
9280d3ef 2995{
366eea36 2996 char *cp = text + 1;
9280d3ef 2997 if (*cp == '$')
366eea36 2998 obstack_sgrow (&string_obstack, "]b4_dollar_dollar[");
9280d3ef 2999 else
03cae905 3000 complain_at (location, _("%s is invalid"), quote_n (1, text));
e9955c83
AD
3001}
3002
f25bfb75
AD
3003
3004/*-----------------------------------------------------------------.
3005| Dispatch onto handle_action_dollar, or handle_destructor_dollar, |
3006| depending upon CODE_KIND. |
3007`-----------------------------------------------------------------*/
e9955c83
AD
3008
3009static void
f25bfb75
AD
3010handle_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:
366eea36
AD
3020 case printer_braced_code:
3021 handle_symbol_code_dollar (text, location);
f25bfb75
AD
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
3032static inline void
3033handle_action_at (char *text, location_t location)
e9955c83 3034{
366eea36 3035 char *cp = text + 1;
e9955c83 3036 locations_flag = 1;
e9955c83 3037
366eea36 3038 if (*cp == '$')
e9955c83
AD
3039 {
3040 obstack_sgrow (&string_obstack, "]b4_lhs_location[");
3041 }
03cae905 3042 else
e9955c83 3043 {
03cae905
PE
3044 long num;
3045 errno = 0;
3046 num = strtol (cp, 0, 10);
dafdc66f 3047
03cae905
PE
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 }
e9955c83 3054 else
03cae905 3055 complain_at (location, _("invalid value: %s"), text);
f25bfb75
AD
3056 }
3057}
3058
3059
366eea36 3060/*---------------------------------------------------------------.
03cae905 3061| TEXT is expected to be @$ in some code associated to a symbol: |
366eea36
AD
3062| destructor or printer. |
3063`---------------------------------------------------------------*/
f25bfb75
AD
3064
3065static inline void
366eea36 3066handle_symbol_code_at (char *text, location_t location)
f25bfb75 3067{
366eea36
AD
3068 char *cp = text + 1;
3069 if (*cp == '$')
3070 obstack_sgrow (&string_obstack, "]b4_at_dollar[");
f25bfb75 3071 else
03cae905 3072 complain_at (location, _("%s is invalid"), quote_n (1, text));
e9955c83 3073}
4cdb01db 3074
f25bfb75
AD
3075
3076/*-------------------------------------------------------------------.
3077| Dispatch onto handle_action_at, or handle_destructor_at, depending |
3078| upon CODE_KIND. |
3079`-------------------------------------------------------------------*/
3080
3081static void
3082handle_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:
366eea36
AD
3092 case printer_braced_code:
3093 handle_symbol_code_at (text, location);
f25bfb75
AD
3094 break;
3095 }
3096}
3097
3098
03cae905
PE
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
3105static int
3106convert_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
f25bfb75
AD
3155/*-------------------------.
3156| Initialize the scanner. |
3157`-------------------------*/
3158
1d6412ad
AD
3159void
3160scanner_initialize (void)
3161{
3162 obstack_init (&string_obstack);
3163}
3164
3165
f25bfb75
AD
3166/*-----------------------------------------------.
3167| Free all the memory allocated to the scanner. |
3168`-----------------------------------------------*/
3169
4cdb01db
AD
3170void
3171scanner_free (void)
3172{
3173 obstack_free (&string_obstack, 0);
536545f3
AD
3174 /* Reclaim Flex's buffers. */
3175 yy_delete_buffer (YY_CURRENT_BUFFER);
4cdb01db 3176}