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