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