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