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