Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: bison/src/bison/2.4.1/bison-2.4.1-src/src/scan-gram.c

Issue 10807020: Add native Windows binary for bison. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 #line 2 "scan-gram.c"
2
3 #line 4 "scan-gram.c"
4
5 #define YY_INT_ALIGNED short int
6
7 /* A lexical scanner generated by flex */
8
9 /* %not-for-header */
10
11 /* %if-c-only */
12 /* %if-not-reentrant */
13 #define yy_create_buffer gram__create_buffer
14 #define yy_delete_buffer gram__delete_buffer
15 #define yy_flex_debug gram__flex_debug
16 #define yy_init_buffer gram__init_buffer
17 #define yy_flush_buffer gram__flush_buffer
18 #define yy_load_buffer_state gram__load_buffer_state
19 #define yy_switch_to_buffer gram__switch_to_buffer
20 #define yyin gram_in
21 #define yyleng gram_leng
22 #define yylex gram_lex
23 #define yylineno gram_lineno
24 #define yyout gram_out
25 #define yyrestart gram_restart
26 #define yytext gram_text
27 #define yywrap gram_wrap
28 #define yyalloc gram_alloc
29 #define yyrealloc gram_realloc
30 #define yyfree gram_free
31
32 /* %endif */
33 /* %endif */
34 /* %ok-for-header */
35
36 #define FLEX_SCANNER
37 #define YY_FLEX_MAJOR_VERSION 2
38 #define YY_FLEX_MINOR_VERSION 5
39 #define YY_FLEX_SUBMINOR_VERSION 35
40 #if YY_FLEX_SUBMINOR_VERSION > 0
41 #define FLEX_BETA
42 #endif
43
44 /* %if-c++-only */
45 /* %endif */
46
47 /* %if-c-only */
48
49 /* %endif */
50
51 /* %if-c-only */
52
53 /* %endif */
54
55 /* First, we deal with platform-specific or compiler-specific issues. */
56
57 /* begin standard C headers. */
58 /* %if-c-only */
59 #include <stdio.h>
60 #include <string.h>
61 #include <errno.h>
62 #include <stdlib.h>
63 /* %endif */
64
65 /* %if-tables-serialization */
66 /* %endif */
67 /* end standard C headers. */
68
69 /* %if-c-or-c++ */
70 /* flex integer type definitions */
71
72 #ifndef FLEXINT_H
73 #define FLEXINT_H
74
75 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
76
77 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
78
79 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
80 * if you want the limit (max/min) macros for int types.
81 */
82 #ifndef __STDC_LIMIT_MACROS
83 #define __STDC_LIMIT_MACROS 1
84 #endif
85
86 #include <inttypes.h>
87 typedef int8_t flex_int8_t;
88 typedef uint8_t flex_uint8_t;
89 typedef int16_t flex_int16_t;
90 typedef uint16_t flex_uint16_t;
91 typedef int32_t flex_int32_t;
92 typedef uint32_t flex_uint32_t;
93 #else
94 typedef signed char flex_int8_t;
95 typedef short int flex_int16_t;
96 typedef int flex_int32_t;
97 typedef unsigned char flex_uint8_t;
98 typedef unsigned short int flex_uint16_t;
99 typedef unsigned int flex_uint32_t;
100 #endif /* ! C99 */
101
102 /* Limits of integral types. */
103 #ifndef INT8_MIN
104 #define INT8_MIN (-128)
105 #endif
106 #ifndef INT16_MIN
107 #define INT16_MIN (-32767-1)
108 #endif
109 #ifndef INT32_MIN
110 #define INT32_MIN (-2147483647-1)
111 #endif
112 #ifndef INT8_MAX
113 #define INT8_MAX (127)
114 #endif
115 #ifndef INT16_MAX
116 #define INT16_MAX (32767)
117 #endif
118 #ifndef INT32_MAX
119 #define INT32_MAX (2147483647)
120 #endif
121 #ifndef UINT8_MAX
122 #define UINT8_MAX (255U)
123 #endif
124 #ifndef UINT16_MAX
125 #define UINT16_MAX (65535U)
126 #endif
127 #ifndef UINT32_MAX
128 #define UINT32_MAX (4294967295U)
129 #endif
130
131 #endif /* ! FLEXINT_H */
132
133 /* %endif */
134
135 /* %if-c++-only */
136 /* %endif */
137
138 #ifdef __cplusplus
139
140 /* The "const" storage-class-modifier is valid. */
141 #define YY_USE_CONST
142
143 #else /* ! __cplusplus */
144
145 /* C99 requires __STDC__ to be defined as 1. */
146 #if defined (__STDC__)
147
148 #define YY_USE_CONST
149
150 #endif /* defined (__STDC__) */
151 #endif /* ! __cplusplus */
152
153 #ifdef YY_USE_CONST
154 #define yyconst const
155 #else
156 #define yyconst
157 #endif
158
159 /* %not-for-header */
160
161 /* Returned upon end-of-file. */
162 #define YY_NULL 0
163 /* %ok-for-header */
164
165 /* %not-for-header */
166
167 /* Promotes a possibly negative, possibly signed char to an unsigned
168 * integer for use as an array index. If the signed char is negative,
169 * we want to instead treat it as an 8-bit unsigned char, hence the
170 * double cast.
171 */
172 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
173 /* %ok-for-header */
174
175 /* %if-reentrant */
176 /* %endif */
177
178 /* %if-not-reentrant */
179
180 /* %endif */
181
182 /* Enter a start condition. This macro really ought to take a parameter,
183 * but we do it the disgusting crufty way forced on us by the ()-less
184 * definition of BEGIN.
185 */
186 #define BEGIN (yy_start) = 1 + 2 *
187
188 /* Translate the current start state into a value that can be later handed
189 * to BEGIN to return to the state. The YYSTATE alias is for lex
190 * compatibility.
191 */
192 #define YY_START (((yy_start) - 1) / 2)
193 #define YYSTATE YY_START
194
195 /* Action number for EOF rule of a given start state. */
196 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
197
198 /* Special action meaning "start processing a new file". */
199 #define YY_NEW_FILE gram_restart(gram_in )
200
201 #define YY_END_OF_BUFFER_CHAR 0
202
203 /* Size of default input buffer. */
204 #ifndef YY_BUF_SIZE
205 #define YY_BUF_SIZE 16384
206 #endif
207
208 /* The state buf must be large enough to hold one state per character in the mai n buffer.
209 */
210 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
211
212 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
213 #define YY_TYPEDEF_YY_BUFFER_STATE
214 typedef struct yy_buffer_state *YY_BUFFER_STATE;
215 #endif
216
217 /* %if-not-reentrant */
218 extern int gram_leng;
219 /* %endif */
220
221 /* %if-c-only */
222 /* %if-not-reentrant */
223 extern FILE *gram_in, *gram_out;
224 /* %endif */
225 /* %endif */
226
227 #define EOB_ACT_CONTINUE_SCAN 0
228 #define EOB_ACT_END_OF_FILE 1
229 #define EOB_ACT_LAST_MATCH 2
230
231 #define YY_LESS_LINENO(n)
232
233 /* Return all but the first "n" matched characters back to the input stream. */
234 #define yyless(n) \
235 do \
236 { \
237 /* Undo effects of setting up gram_text. */ \
238 int yyless_macro_arg = (n); \
239 YY_LESS_LINENO(yyless_macro_arg);\
240 *yy_cp = (yy_hold_char); \
241 YY_RESTORE_YY_MORE_OFFSET \
242 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
243 YY_DO_BEFORE_ACTION; /* set up gram_text again */ \
244 } \
245 while ( 0 )
246
247 #define unput(c) yyunput( c, (yytext_ptr) )
248
249 #ifndef YY_TYPEDEF_YY_SIZE_T
250 #define YY_TYPEDEF_YY_SIZE_T
251 typedef size_t yy_size_t;
252 #endif
253
254 #ifndef YY_STRUCT_YY_BUFFER_STATE
255 #define YY_STRUCT_YY_BUFFER_STATE
256 struct yy_buffer_state
257 {
258 /* %if-c-only */
259 FILE *yy_input_file;
260 /* %endif */
261
262 /* %if-c++-only */
263 /* %endif */
264
265 char *yy_ch_buf; /* input buffer */
266 char *yy_buf_pos; /* current position in input buffer */
267
268 /* Size of input buffer in bytes, not including room for EOB
269 * characters.
270 */
271 yy_size_t yy_buf_size;
272
273 /* Number of characters read into yy_ch_buf, not including EOB
274 * characters.
275 */
276 int yy_n_chars;
277
278 /* Whether we "own" the buffer - i.e., we know we created it,
279 * and can realloc() it to grow it, and should free() it to
280 * delete it.
281 */
282 int yy_is_our_buffer;
283
284 /* Whether this is an "interactive" input source; if so, and
285 * if we're using stdio for input, then we want to use getc()
286 * instead of fread(), to make sure we stop fetching input after
287 * each newline.
288 */
289 int yy_is_interactive;
290
291 /* Whether we're considered to be at the beginning of a line.
292 * If so, '^' rules will be active on the next match, otherwise
293 * not.
294 */
295 int yy_at_bol;
296
297 int yy_bs_lineno; /**< The line count. */
298 int yy_bs_column; /**< The column count. */
299
300 /* Whether to try to fill the input buffer when we reach the
301 * end of it.
302 */
303 int yy_fill_buffer;
304
305 int yy_buffer_status;
306
307 #define YY_BUFFER_NEW 0
308 #define YY_BUFFER_NORMAL 1
309 /* When an EOF's been seen but there's still some text to process
310 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
311 * shouldn't try reading from the input source any more. We might
312 * still have a bunch of tokens to match, though, because of
313 * possible backing-up.
314 *
315 * When we actually see the EOF, we change the status to "new"
316 * (via gram_restart()), so that the user can continue scanning by
317 * just pointing gram_in at a new input file.
318 */
319 #define YY_BUFFER_EOF_PENDING 2
320
321 };
322 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
323
324 /* %if-c-only Standard (non-C++) definition */
325 /* %not-for-header */
326
327 /* %if-not-reentrant */
328
329 /* Stack of input buffers. */
330 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
331 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
332 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
333 /* %endif */
334 /* %ok-for-header */
335
336 /* %endif */
337
338 /* We provide macros for accessing buffer states in case in the
339 * future we want to put the buffer states in a more general
340 * "scanner state".
341 *
342 * Returns the top of the stack, or NULL.
343 */
344 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
345 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
346 : NULL)
347
348 /* Same as previous macro, but useful when we know that the buffer stack is not
349 * NULL or when we need an lvalue. For internal use only.
350 */
351 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
352
353 /* %if-c-only Standard (non-C++) definition */
354
355 /* %if-not-reentrant */
356 /* %not-for-header */
357
358 /* yy_hold_char holds the character lost when gram_text is formed. */
359 static char yy_hold_char;
360 static int yy_n_chars; /* number of characters read into yy_ch_buf */
361 int gram_leng;
362
363 /* Points to current character in buffer. */
364 static char *yy_c_buf_p = (char *) 0;
365 static int yy_init = 0; /* whether we need to initialize */
366 static int yy_start = 0; /* start state number */
367
368 /* Flag which is used to allow gram_wrap()'s to do buffer switches
369 * instead of setting up a fresh gram_in. A bit of a hack ...
370 */
371 static int yy_did_buffer_switch_on_eof;
372 /* %ok-for-header */
373
374 /* %endif */
375
376 void gram_restart (FILE *input_file );
377 void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer );
378 YY_BUFFER_STATE gram__create_buffer (FILE *file,int size );
379 void gram__delete_buffer (YY_BUFFER_STATE b );
380 void gram__flush_buffer (YY_BUFFER_STATE b );
381 void gram_push_buffer_state (YY_BUFFER_STATE new_buffer );
382 void gram_pop_buffer_state (void );
383
384 static void gram_ensure_buffer_stack (void );
385 static void gram__load_buffer_state (void );
386 static void gram__init_buffer (YY_BUFFER_STATE b,FILE *file );
387
388 #define YY_FLUSH_BUFFER gram__flush_buffer(YY_CURRENT_BUFFER )
389
390 YY_BUFFER_STATE gram__scan_buffer (char *base,yy_size_t size );
391 YY_BUFFER_STATE gram__scan_string (yyconst char *yy_str );
392 YY_BUFFER_STATE gram__scan_bytes (yyconst char *bytes,int len );
393
394 /* %endif */
395
396 void *gram_alloc (yy_size_t );
397 void *gram_realloc (void *,yy_size_t );
398 void gram_free (void * );
399
400 #define yy_new_buffer gram__create_buffer
401
402 #define yy_set_interactive(is_interactive) \
403 { \
404 if ( ! YY_CURRENT_BUFFER ){ \
405 gram_ensure_buffer_stack (); \
406 YY_CURRENT_BUFFER_LVALUE = \
407 gram__create_buffer(gram_in,YY_BUF_SIZE ); \
408 } \
409 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
410 }
411
412 #define yy_set_bol(at_bol) \
413 { \
414 if ( ! YY_CURRENT_BUFFER ){\
415 gram_ensure_buffer_stack (); \
416 YY_CURRENT_BUFFER_LVALUE = \
417 gram__create_buffer(gram_in,YY_BUF_SIZE ); \
418 } \
419 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
420 }
421
422 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
423
424 /* %% [1.0] gram_text/gram_in/gram_out/yy_state_type/gram_lineno etc. def's & in it go here */
425 /* Begin user sect3 */
426
427 #define gram_wrap(n) 1
428 #define YY_SKIP_YYWRAP
429
430 #define FLEX_DEBUG
431
432 typedef unsigned char YY_CHAR;
433
434 FILE *gram_in = (FILE *) 0, *gram_out = (FILE *) 0;
435
436 typedef int yy_state_type;
437
438 extern int gram_lineno;
439
440 int gram_lineno = 1;
441
442 extern char *gram_text;
443 #define yytext_ptr gram_text
444
445 /* %if-c-only Standard (non-C++) definition */
446
447 static yy_state_type yy_get_previous_state (void );
448 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
449 static int yy_get_next_buffer (void );
450 static void yy_fatal_error (yyconst char msg[] );
451
452 /* %endif */
453
454 /* Done after the current pattern has been matched and before the
455 * corresponding action - sets up gram_text.
456 */
457 #define YY_DO_BEFORE_ACTION \
458 (yytext_ptr) = yy_bp; \
459 /* %% [2.0] code to fiddle gram_text and gram_leng for yymore() goes here \ */\
460 gram_leng = (size_t) (yy_cp - yy_bp); \
461 (yy_hold_char) = *yy_cp; \
462 *yy_cp = '\0'; \
463 /* %% [3.0] code to copy yytext_ptr to gram_text[] goes here, if %array \ */\
464 (yy_c_buf_p) = yy_cp;
465
466 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
467 #define YY_NUM_RULES 102
468 #define YY_END_OF_BUFFER 103
469 /* This struct is not used in this scanner,
470 but its presence is necessary. */
471 struct yy_trans_info
472 {
473 flex_int32_t yy_verify;
474 flex_int32_t yy_nxt;
475 };
476 static yyconst flex_int16_t yy_accept[453] =
477 { 0,
478 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
479 0, 0, 0, 0, 0, 0, 0, 0, 70, 70,
480 86, 86, 86, 86, 103, 63, 2, 2, 58, 63,
481 57, 1, 54, 63, 55, 55, 51, 63, 49, 60,
482 50, 63, 67, 67, 100, 71, 71, 100, 73, 72,
483 72, 65, 2, 1, 65, 64, 65, 101, 92, 100,
484 91, 100, 100, 100, 95, 97, 100, 69, 100, 90,
485 89, 100, 88, 87, 62, 48, 48, 48, 48, 48,
486 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
487 48, 48, 48, 48, 59, 54, 4, 3, 55, 0,
488
489 0, 0, 53, 0, 66, 85, 83, 74, 85, 76,
490 77, 78, 79, 80, 81, 85, 82, 85, 99, 93,
491 94, 0, 96, 0, 95, 98, 0, 68, 0, 0,
492 70, 86, 86, 86, 86, 48, 48, 48, 48, 48,
493 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
494 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
495 48, 48, 48, 48, 48, 48, 3, 56, 61, 52,
496 0, 74, 0, 0, 75, 0, 0, 0, 0, 0,
497 0, 0, 0, 0, 0, 0, 0, 0, 48, 48,
498 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
499
500 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
501 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
502 48, 48, 48, 48, 0, 74, 0, 0, 48, 7,
503 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
504 48, 48, 22, 48, 48, 48, 48, 48, 48, 48,
505 48, 48, 48, 48, 34, 48, 48, 48, 48, 48,
506 48, 41, 48, 44, 48, 48, 47, 0, 0, 0,
507 48, 8, 48, 48, 48, 13, 48, 48, 48, 48,
508 48, 48, 48, 48, 48, 25, 48, 48, 48, 48,
509 48, 31, 48, 48, 48, 48, 48, 38, 48, 40,
510
511 42, 45, 48, 0, 0, 84, 6, 48, 10, 48,
512 48, 15, 48, 48, 48, 48, 48, 48, 48, 48,
513 48, 48, 48, 48, 32, 48, 48, 48, 48, 48,
514 48, 48, 0, 48, 11, 48, 48, 48, 48, 48,
515 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
516 48, 35, 48, 37, 48, 48, 46, 0, 48, 48,
517 48, 48, 48, 48, 48, 48, 21, 48, 48, 48,
518 48, 28, 29, 48, 48, 48, 39, 48, 0, 48,
519 48, 48, 16, 48, 48, 48, 48, 23, 24, 48,
520 48, 48, 48, 48, 48, 0, 0, 48, 12, 48,
521
522 48, 48, 20, 48, 48, 48, 48, 48, 48, 48,
523 5, 48, 48, 17, 48, 48, 26, 48, 48, 33,
524 36, 43, 9, 48, 48, 48, 48, 48, 14, 48,
525 48, 48, 48, 48, 19, 48, 48, 48, 27, 48,
526 48, 48, 48, 48, 18, 48, 48, 48, 48, 48,
527 30, 0
528 } ;
529
530 static yyconst flex_int32_t yy_ec[256] =
531 { 0,
532 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
533 2, 2, 1, 1, 1, 1, 1, 1, 1, 1,
534 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
535 1, 4, 1, 5, 6, 1, 7, 1, 8, 1,
536 1, 9, 1, 10, 11, 12, 13, 14, 15, 15,
537 15, 15, 15, 15, 15, 16, 16, 17, 18, 19,
538 20, 21, 22, 1, 23, 23, 23, 23, 23, 23,
539 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
540 12, 12, 12, 12, 24, 12, 12, 25, 12, 12,
541 26, 27, 26, 1, 28, 1, 29, 30, 31, 32,
542
543 33, 34, 35, 36, 37, 12, 38, 39, 40, 41,
544 42, 43, 44, 45, 46, 47, 48, 49, 12, 50,
545 51, 12, 52, 53, 54, 1, 1, 1, 1, 1,
546 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
547 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
548 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
549 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
550 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
551 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
552 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
553
554 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
555 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
556 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
557 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
558 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
559 1, 1, 1, 1, 1
560 } ;
561
562 static yyconst flex_int32_t yy_meta[56] =
563 { 0,
564 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
565 3, 4, 1, 5, 5, 5, 1, 1, 1, 1,
566 1, 1, 5, 4, 4, 6, 1, 4, 5, 5,
567 5, 5, 5, 5, 4, 4, 4, 4, 4, 4,
568 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
569 4, 1, 1, 1, 7
570 } ;
571
572 static yyconst flex_int16_t yy_base[473] =
573 { 0,
574 0, 654, 650, 649, 53, 54, 57, 58, 60, 65,
575 83, 90, 97, 112, 119, 125, 80, 98, 84, 91,
576 118, 131, 132, 134, 657, 661, 661, 661, 661, 160,
577 661, 661, 0, 63, 132, 138, 661, 105, 661, 661,
578 661, 617, 661, 642, 661, 661, 661, 208, 661, 661,
579 661, 661, 661, 661, 130, 661, 615, 661, 661, 599,
580 661, 147, 123, 207, 661, 661, 79, 661, 166, 661,
581 661, 216, 661, 661, 661, 0, 615, 609, 122, 29,
582 613, 610, 607, 144, 614, 133, 598, 188, 188, 140,
583 208, 604, 611, 614, 661, 0, 661, 0, 213, 0,
584
585 621, 620, 661, 603, 661, 661, 661, 225, 0, 661,
586 661, 661, 661, 661, 661, 0, 661, 0, 661, 661,
587 661, 242, 661, 258, 661, 661, 261, 661, 264, 267,
588 612, 661, 270, 611, 273, 0, 596, 604, 248, 590,
589 589, 590, 240, 587, 594, 589, 129, 598, 583, 587,
590 269, 593, 578, 579, 214, 578, 578, 586, 587, 590,
591 573, 579, 573, 578, 569, 582, 0, 0, 661, 661,
592 571, 269, 0, 0, 0, 283, 279, 296, 227, 299,
593 286, 305, 268, 312, 315, 318, 321, 301, 582, 577,
594 561, 297, 561, 574, 564, 572, 571, 570, 591, 554,
595
596 565, 552, 587, 568, 561, 562, 192, 298, 549, 550,
597 546, 560, 549, 556, 540, 551, 547, 540, 544, 550,
598 549, 539, 550, 548, 545, 661, 0, 0, 532, 0,
599 541, 527, 533, 528, 541, 526, 539, 558, 536, 524,
600 529, 517, 0, 521, 516, 529, 301, 528, 523, 513,
601 525, 517, 508, 522, 0, 507, 320, 516, 505, 518,
602 503, 0, 508, 0, 507, 505, 0, 542, 0, 0,
603 494, 0, 505, 510, 494, 0, 321, 494, 497, 322,
604 510, 509, 508, 507, 498, 0, 491, 499, 491, 485,
605 483, 0, 482, 517, 494, 483, 480, 0, 477, 0,
606
607 324, 0, 477, 322, 0, 661, 0, 475, 475, 489,
608 470, 328, 473, 475, 471, 476, 479, 468, 470, 466,
609 481, 476, 466, 474, 0, 463, 460, 475, 470, 460,
610 454, 467, 339, 329, 0, 452, 465, 452, 463, 447,
611 448, 482, 459, 462, 449, 456, 440, 441, 455, 440,
612 455, 0, 438, 0, 441, 452, 0, 475, 436, 436,
613 432, 431, 441, 427, 440, 443, 0, 431, 424, 435,
614 429, 0, 0, 427, 421, 419, 0, 434, 458, 417,
615 416, 430, 0, 422, 415, 412, 425, 0, 0, 418,
616 407, 416, 423, 418, 411, 444, 286, 415, 0, 405,
617
618 396, 397, 0, 397, 393, 330, 401, 401, 395, 406,
619 661, 407, 391, 0, 389, 398, 0, 391, 396, 0,
620 0, 0, 0, 399, 331, 389, 385, 383, 0, 394,
621 386, 393, 378, 387, 0, 392, 385, 382, 0, 389,
622 381, 396, 355, 341, 0, 322, 302, 300, 312, 299,
623 0, 661, 359, 366, 373, 377, 382, 388, 395, 400,
624 405, 306, 291, 247, 210, 176, 171, 166, 136, 124,
625 94, 412
626 } ;
627
628 static yyconst flex_int16_t yy_def[473] =
629 { 0,
630 452, 1, 453, 453, 454, 454, 454, 454, 455, 455,
631 454, 454, 454, 454, 454, 454, 454, 454, 454, 454,
632 454, 454, 454, 454, 452, 452, 452, 452, 452, 452,
633 452, 452, 456, 452, 452, 452, 452, 457, 452, 452,
634 452, 452, 452, 452, 452, 452, 452, 458, 452, 452,
635 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
636 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
637 452, 459, 452, 452, 452, 460, 460, 460, 460, 460,
638 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
639 460, 460, 460, 460, 452, 456, 452, 461, 452, 462,
640
641 457, 457, 452, 452, 452, 452, 452, 452, 463, 452,
642 452, 452, 452, 452, 452, 464, 452, 465, 452, 452,
643 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
644 452, 452, 452, 452, 452, 460, 460, 460, 460, 460,
645 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
646 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
647 460, 460, 460, 460, 460, 460, 461, 462, 452, 452,
648 452, 452, 466, 467, 465, 452, 452, 452, 452, 452,
649 452, 452, 452, 452, 452, 452, 452, 459, 460, 460,
650 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
651
652 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
653 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
654 460, 460, 460, 460, 452, 452, 468, 469, 460, 460,
655 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
656 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
657 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
658 460, 460, 460, 460, 460, 460, 460, 452, 470, 471,
659 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
660 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
661 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
662
663 460, 460, 460, 452, 464, 452, 460, 460, 460, 460,
664 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
665 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
666 460, 460, 452, 460, 460, 460, 460, 460, 460, 460,
667 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
668 460, 460, 460, 460, 460, 460, 460, 452, 460, 460,
669 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
670 460, 460, 460, 460, 460, 460, 460, 460, 472, 460,
671 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
672 460, 460, 460, 460, 460, 472, 472, 460, 460, 460,
673
674 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
675 452, 460, 460, 460, 460, 460, 460, 460, 460, 460,
676 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
677 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
678 460, 460, 460, 460, 460, 460, 460, 460, 460, 460,
679 460, 0, 452, 452, 452, 452, 452, 452, 452, 452,
680 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
681 452, 452
682 } ;
683
684 static yyconst flex_int16_t yy_nxt[717] =
685 { 0,
686 26, 27, 28, 27, 29, 26, 30, 31, 26, 32,
687 26, 33, 34, 35, 36, 36, 26, 37, 38, 39,
688 26, 26, 33, 33, 33, 26, 26, 33, 33, 33,
689 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
690 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
691 33, 40, 41, 26, 26, 46, 46, 47, 47, 50,
692 50, 53, 28, 53, 51, 51, 53, 28, 53, 54,
693 57, 97, 55, 141, 54, 98, 56, 55, 142, 48,
694 48, 56, 58, 48, 48, 58, 68, 59, 67, 60,
695 61, 128, 58, 68, 59, 62, 60, 61, 306, 58,
696
697 58, 59, 62, 63, 61, 129, 67, 49, 49, 62,
698 69, 49, 49, 102, 58, 64, 59, 69, 63, 61,
699 70, 58, 71, 59, 62, 103, 61, 58, 305, 59,
700 64, 62, 61, 70, 73, 71, 73, 62, 97, 74,
701 270, 74, 98, 123, 72, 99, 99, 99, 65, 124,
702 66, 99, 99, 99, 139, 120, 100, 72, 72, 121,
703 72, 150, 202, 65, 140, 66, 75, 130, 131, 130,
704 269, 76, 146, 122, 151, 228, 147, 159, 203, 152,
705 227, 100, 76, 76, 76, 148, 160, 76, 76, 77,
706 78, 79, 80, 81, 82, 76, 83, 76, 84, 85,
707
708 86, 87, 88, 76, 89, 90, 91, 92, 93, 76,
709 94, 95, 107, 125, 175, 107, 154, 133, 134, 133,
710 157, 108, 108, 248, 158, 126, 99, 99, 99, 107,
711 249, 109, 155, 127, 107, 156, 110, 111, 172, 172,
712 161, 112, 135, 176, 177, 176, 212, 123, 113, 162,
713 213, 174, 114, 124, 115, 116, 117, 118, 163, 178,
714 179, 178, 180, 181, 180, 182, 183, 182, 130, 131,
715 130, 185, 134, 185, 187, 188, 187, 191, 197, 207,
716 128, 192, 226, 226, 176, 177, 176, 120, 411, 198,
717 397, 121, 125, 193, 129, 173, 207, 178, 179, 178,
718
719 180, 181, 180, 452, 126, 122, 182, 183, 182, 208,
720 168, 287, 127, 130, 131, 130, 185, 134, 185, 185,
721 134, 185, 187, 188, 187, 232, 250, 135, 287, 251,
722 296, 311, 314, 233, 331, 333, 333, 333, 338, 359,
723 418, 430, 358, 451, 450, 449, 448, 296, 311, 314,
724 447, 331, 333, 333, 333, 338, 359, 418, 430, 43,
725 43, 43, 43, 43, 43, 43, 45, 45, 45, 45,
726 45, 45, 45, 52, 52, 52, 52, 52, 52, 52,
727 96, 96, 101, 446, 101, 101, 101, 101, 106, 106,
728 106, 106, 106, 106, 106, 132, 132, 132, 132, 132,
729
730 445, 132, 136, 136, 136, 167, 444, 167, 167, 167,
731 167, 167, 396, 443, 396, 396, 396, 396, 396, 442,
732 441, 440, 439, 438, 437, 436, 435, 434, 433, 432,
733 431, 429, 428, 427, 426, 425, 424, 423, 422, 421,
734 420, 419, 417, 416, 415, 414, 413, 412, 397, 410,
735 409, 408, 407, 406, 405, 404, 403, 402, 401, 400,
736 399, 398, 397, 395, 394, 393, 392, 391, 390, 389,
737 388, 387, 386, 385, 384, 383, 382, 381, 380, 379,
738 378, 377, 376, 375, 374, 373, 372, 371, 370, 369,
739 368, 367, 366, 365, 364, 363, 362, 361, 360, 357,
740
741 356, 355, 354, 353, 352, 351, 350, 349, 348, 347,
742 346, 345, 344, 343, 342, 341, 340, 339, 337, 336,
743 335, 334, 332, 330, 329, 328, 327, 326, 325, 324,
744 323, 322, 321, 320, 319, 318, 317, 316, 315, 313,
745 312, 310, 309, 308, 307, 304, 303, 302, 301, 300,
746 299, 298, 297, 295, 294, 293, 292, 291, 290, 289,
747 288, 286, 285, 284, 283, 282, 281, 280, 279, 278,
748 277, 276, 275, 274, 273, 272, 271, 268, 267, 266,
749 265, 264, 263, 262, 261, 260, 259, 258, 257, 256,
750 255, 254, 253, 252, 247, 246, 245, 244, 243, 242,
751
752 241, 240, 239, 238, 237, 236, 235, 234, 231, 230,
753 229, 225, 224, 223, 222, 221, 220, 219, 218, 217,
754 216, 215, 214, 211, 210, 209, 206, 205, 204, 201,
755 200, 199, 196, 195, 194, 190, 189, 186, 184, 171,
756 170, 169, 166, 165, 164, 153, 149, 145, 144, 143,
757 138, 137, 119, 104, 105, 104, 452, 44, 44, 42,
758 25, 452, 452, 452, 452, 452, 452, 452, 452, 452,
759 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
760 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
761 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
762
763 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
764 452, 452, 452, 452, 452, 452
765 } ;
766
767 static yyconst flex_int16_t yy_chk[717] =
768 { 0,
769 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
770 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
771 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
772 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
773 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
774 1, 1, 1, 1, 1, 5, 6, 5, 6, 7,
775 8, 9, 9, 9, 7, 8, 10, 10, 10, 9,
776 10, 34, 9, 80, 10, 34, 9, 10, 80, 5,
777 6, 10, 17, 7, 8, 11, 19, 11, 17, 11,
778 11, 67, 12, 20, 12, 11, 12, 12, 471, 13,
779
780 18, 13, 12, 13, 13, 67, 18, 5, 6, 13,
781 19, 7, 8, 38, 14, 13, 14, 20, 14, 14,
782 21, 15, 21, 15, 14, 38, 15, 16, 470, 16,
783 14, 15, 16, 22, 23, 22, 24, 16, 55, 23,
784 469, 24, 55, 63, 21, 35, 35, 35, 13, 63,
785 13, 36, 36, 36, 79, 62, 35, 22, 23, 62,
786 24, 86, 147, 14, 79, 14, 30, 69, 69, 69,
787 468, 30, 84, 62, 86, 467, 84, 90, 147, 86,
788 466, 35, 30, 30, 30, 84, 90, 30, 30, 30,
789 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
790
791 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
792 30, 30, 48, 64, 465, 48, 88, 72, 72, 72,
793 89, 48, 48, 207, 89, 64, 99, 99, 99, 48,
794 207, 48, 88, 64, 48, 88, 48, 48, 108, 108,
795 91, 48, 72, 122, 122, 122, 155, 179, 48, 91,
796 155, 464, 48, 179, 48, 48, 48, 48, 91, 124,
797 124, 124, 127, 127, 127, 129, 129, 129, 130, 130,
798 130, 133, 133, 133, 135, 135, 135, 139, 143, 151,
799 183, 139, 172, 172, 176, 176, 176, 177, 397, 143,
800 397, 177, 181, 139, 183, 463, 151, 178, 178, 178,
801
802 180, 180, 180, 188, 181, 177, 182, 182, 182, 151,
803 462, 247, 181, 184, 184, 184, 185, 185, 185, 186,
804 186, 186, 187, 187, 187, 192, 208, 188, 247, 208,
805 257, 277, 280, 192, 301, 304, 304, 304, 312, 334,
806 406, 425, 333, 450, 449, 448, 447, 257, 277, 280,
807 446, 301, 333, 333, 333, 312, 334, 406, 425, 453,
808 453, 453, 453, 453, 453, 453, 454, 454, 454, 454,
809 454, 454, 454, 455, 455, 455, 455, 455, 455, 455,
810 456, 456, 457, 444, 457, 457, 457, 457, 458, 458,
811 458, 458, 458, 458, 458, 459, 459, 459, 459, 459,
812
813 443, 459, 460, 460, 460, 461, 442, 461, 461, 461,
814 461, 461, 472, 441, 472, 472, 472, 472, 472, 440,
815 438, 437, 436, 434, 433, 432, 431, 430, 428, 427,
816 426, 424, 419, 418, 416, 415, 413, 412, 410, 409,
817 408, 407, 405, 404, 402, 401, 400, 398, 396, 395,
818 394, 393, 392, 391, 390, 387, 386, 385, 384, 382,
819 381, 380, 379, 378, 376, 375, 374, 371, 370, 369,
820 368, 366, 365, 364, 363, 362, 361, 360, 359, 358,
821 356, 355, 353, 351, 350, 349, 348, 347, 346, 345,
822 344, 343, 342, 341, 340, 339, 338, 337, 336, 332,
823
824 331, 330, 329, 328, 327, 326, 324, 323, 322, 321,
825 320, 319, 318, 317, 316, 315, 314, 313, 311, 310,
826 309, 308, 303, 299, 297, 296, 295, 294, 293, 291,
827 290, 289, 288, 287, 285, 284, 283, 282, 281, 279,
828 278, 275, 274, 273, 271, 268, 266, 265, 263, 261,
829 260, 259, 258, 256, 254, 253, 252, 251, 250, 249,
830 248, 246, 245, 244, 242, 241, 240, 239, 238, 237,
831 236, 235, 234, 233, 232, 231, 229, 225, 224, 223,
832 222, 221, 220, 219, 218, 217, 216, 215, 214, 213,
833 212, 211, 210, 209, 206, 205, 204, 203, 202, 201,
834
835 200, 199, 198, 197, 196, 195, 194, 193, 191, 190,
836 189, 171, 166, 165, 164, 163, 162, 161, 160, 159,
837 158, 157, 156, 154, 153, 152, 150, 149, 148, 146,
838 145, 144, 142, 141, 140, 138, 137, 134, 131, 104,
839 102, 101, 94, 93, 92, 87, 85, 83, 82, 81,
840 78, 77, 60, 57, 44, 42, 25, 4, 3, 2,
841 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
842 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
843 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
844 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
845
846 452, 452, 452, 452, 452, 452, 452, 452, 452, 452,
847 452, 452, 452, 452, 452, 452
848 } ;
849
850 static yy_state_type yy_last_accepting_state;
851 static char *yy_last_accepting_cpos;
852
853 extern int gram__flex_debug;
854 int gram__flex_debug = 1;
855
856 static yyconst flex_int16_t yy_rule_linenum[102] =
857 { 0,
858 135, 136, 137, 138, 146, 157, 158, 159, 160, 161,
859 162, 163, 164, 165, 166, 167, 168, 169, 170, 171,
860 172, 173, 174, 175, 176, 177, 178, 179, 180, 181,
861 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
862 192, 193, 194, 195, 196, 197, 198, 200, 204, 205,
863 206, 207, 208, 210, 216, 220, 226, 229, 232, 235,
864 243, 251, 258, 275, 280, 301, 302, 313, 324, 325,
865 337, 363, 390, 400, 410, 421, 422, 423, 424, 425,
866 426, 427, 430, 432, 441, 453, 458, 459, 465, 466,
867 477, 483, 489, 495, 511, 512, 513, 529, 548, 588,
868
869 589
870 } ;
871
872 /* The intent behind this definition is that it'll catch
873 * any uses of REJECT which flex missed.
874 */
875 #define REJECT reject_used_but_not_detected
876 #define yymore() yymore_used_but_not_detected
877 #define YY_MORE_ADJ 0
878 #define YY_RESTORE_YY_MORE_OFFSET
879 char *gram_text;
880 #line 1 "scan-gram.l"
881 /* Bison Grammar Scanner -*- C -*-
882
883 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation,
884 Inc.
885
886 This file is part of Bison, the GNU Compiler Compiler.
887
888 This program is free software: you can redistribute it and/or modify
889 it under the terms of the GNU General Public License as published by
890 the Free Software Foundation, either version 3 of the License, or
891 (at your option) any later version.
892
893 This program is distributed in the hope that it will be useful,
894 but WITHOUT ANY WARRANTY; without even the implied warranty of
895 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
896 GNU General Public License for more details.
897
898 You should have received a copy of the GNU General Public License
899 along with this program. If not, see <http://www.gnu.org/licenses/>. */
900 #line 25 "scan-gram.l"
901 /* Work around a bug in flex 2.5.31. See Debian bug 333231
902 <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>. */
903 #undef gram_wrap
904 #define gram_wrap() 1
905
906 #define FLEX_PREFIX(Id) gram_ ## Id
907 #include "flex-scanner.h"
908
909 #include "complain.h"
910 #include "files.h"
911 #include "gram.h"
912 #include "quotearg.h"
913 #include "reader.h"
914 #include "uniqstr.h"
915
916 #include <mbswidth.h>
917 #include <quote.h>
918
919 #include "scan-gram.h"
920
921 #define YY_DECL GRAM_LEX_DECL
922
923 #define YY_USER_INIT \
924 code_start = scanner_cursor = loc->start; \
925
926 /* Location of scanner cursor. */
927 static boundary scanner_cursor;
928
929 #define YY_USER_ACTION location_compute (loc, &scanner_cursor, gram_text, gram_ leng);
930
931 static size_t no_cr_read (FILE *, char *, size_t);
932 #define YY_INPUT(buf, result, size) ((result) = no_cr_read (gram_in, buf, size))
933
934 /* A string representing the most recently saved token. */
935 static char *last_string;
936
937 void
938 gram_scanner_last_string_free (void)
939 {
940 STRING_FREE;
941 }
942
943 static void handle_syncline (char *, location);
944 static unsigned long int scan_integer (char const *p, int base, location loc);
945 static int convert_ucn_to_byte (char const *hex_text);
946 static void unexpected_eof (boundary, char const *);
947 static void unexpected_newline (boundary, char const *);
948
949 /* A C-like comment in directives/rules. */
950
951 /* Strings and characters in directives/rules. */
952
953 /* A identifier was just read in directives/rules. Special state
954 to capture the sequence `identifier :'. */
955
956 /* Three types of user code:
957 - prologue (code between `%{' `%}' in the first section, before %%);
958 - actions, printers, union, etc, (between braced in the middle section);
959 - epilogue (everything after the second %%). */
960
961 /* C and C++ comments in code. */
962
963 /* Strings and characters in code. */
964
965 /* POSIX says that a tag must be both an id and a C union member, but
966 historically almost any character is allowed in a tag. We disallow
967 NUL and newline, as this simplifies our implementation. */
968 /* Zero or more instances of backslash-newline. Following GCC, allow
969 white space between the backslash and the newline. */
970 #line 971 "scan-gram.c"
971
972 #define INITIAL 0
973 #define SC_YACC_COMMENT 1
974 #define SC_ESCAPED_STRING 2
975 #define SC_ESCAPED_CHARACTER 3
976 #define SC_AFTER_IDENTIFIER 4
977 #define SC_PROLOGUE 5
978 #define SC_BRACED_CODE 6
979 #define SC_EPILOGUE 7
980 #define SC_COMMENT 8
981 #define SC_LINE_COMMENT 9
982 #define SC_STRING 10
983 #define SC_CHARACTER 11
984
985 #ifndef YY_NO_UNISTD_H
986 /* Special case for "unistd.h", since it is non-ANSI. We include it way
987 * down here because we want the user's section 1 to have been scanned first.
988 * The user has a chance to override it with an option.
989 */
990 /* %if-c-only */
991 #include <unistd.h>
992 /* %endif */
993 /* %if-c++-only */
994 /* %endif */
995 #endif
996
997 #ifndef YY_EXTRA_TYPE
998 #define YY_EXTRA_TYPE void *
999 #endif
1000
1001 /* %if-c-only Reentrant structure and macros (non-C++). */
1002 /* %if-reentrant */
1003 /* %if-c-only */
1004
1005 static int yy_init_globals (void );
1006
1007 /* %endif */
1008 /* %if-reentrant */
1009 /* %endif */
1010 /* %endif End reentrant structures and macros. */
1011
1012 /* Accessor methods to globals.
1013 These are made visible to non-reentrant scanners for convenience. */
1014
1015 int gram_lex_destroy (void );
1016
1017 int gram_get_debug (void );
1018
1019 void gram_set_debug (int debug_flag );
1020
1021 YY_EXTRA_TYPE gram_get_extra (void );
1022
1023 void gram_set_extra (YY_EXTRA_TYPE user_defined );
1024
1025 FILE *gram_get_in (void );
1026
1027 void gram_set_in (FILE * in_str );
1028
1029 FILE *gram_get_out (void );
1030
1031 void gram_set_out (FILE * out_str );
1032
1033 int gram_get_leng (void );
1034
1035 char *gram_get_text (void );
1036
1037 int gram_get_lineno (void );
1038
1039 void gram_set_lineno (int line_number );
1040
1041 /* %if-bison-bridge */
1042 /* %endif */
1043
1044 /* Macros after this point can all be overridden by user definitions in
1045 * section 1.
1046 */
1047
1048 #ifndef YY_SKIP_YYWRAP
1049 #ifdef __cplusplus
1050 extern "C" int gram_wrap (void );
1051 #else
1052 extern int gram_wrap (void );
1053 #endif
1054 #endif
1055
1056 /* %not-for-header */
1057
1058 /* %ok-for-header */
1059
1060 /* %endif */
1061
1062 #ifndef yytext_ptr
1063 static void yy_flex_strncpy (char *,yyconst char *,int );
1064 #endif
1065
1066 #ifdef YY_NEED_STRLEN
1067 static int yy_flex_strlen (yyconst char * );
1068 #endif
1069
1070 #ifndef YY_NO_INPUT
1071 /* %if-c-only Standard (non-C++) definition */
1072 /* %not-for-header */
1073
1074 #ifdef __cplusplus
1075 static int yyinput (void );
1076 #else
1077 static int input (void );
1078 #endif
1079 /* %ok-for-header */
1080
1081 /* %endif */
1082 #endif
1083
1084 /* %if-c-only */
1085
1086 /* %endif */
1087
1088 /* Amount of stuff to slurp up with each read. */
1089 #ifndef YY_READ_BUF_SIZE
1090 #define YY_READ_BUF_SIZE 8192
1091 #endif
1092
1093 /* Copy whatever the last rule matched to the standard output. */
1094 #ifndef ECHO
1095 /* %if-c-only Standard (non-C++) definition */
1096 /* This used to be an fputs(), but since the string might contain NUL's,
1097 * we now use fwrite().
1098 */
1099 #define ECHO fwrite( gram_text, gram_leng, 1, gram_out )
1100 /* %endif */
1101 /* %if-c++-only C++ definition */
1102 /* %endif */
1103 #endif
1104
1105 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1106 * is returned in "result".
1107 */
1108 #ifndef YY_INPUT
1109 #define YY_INPUT(buf,result,max_size) \
1110 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C ++ \ */\
1111 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
1112 { \
1113 int c = '*'; \
1114 int n; \
1115 for ( n = 0; n < max_size && \
1116 (c = getc( gram_in )) != EOF && c != '\n'; ++n ) \
1117 buf[n] = (char) c; \
1118 if ( c == '\n' ) \
1119 buf[n++] = (char) c; \
1120 if ( c == EOF && ferror( gram_in ) ) \
1121 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1122 result = n; \
1123 } \
1124 else \
1125 { \
1126 errno=0; \
1127 while ( (result = fread(buf, 1, max_size, gram_in))==0 && ferror (gram_in)) \
1128 { \
1129 if( errno != EINTR) \
1130 { \
1131 YY_FATAL_ERROR( "input in flex scanner failed" ) ; \
1132 break; \
1133 } \
1134 errno=0; \
1135 clearerr(gram_in); \
1136 } \
1137 }\
1138 \
1139 /* %if-c++-only C++ definition \ */\
1140 /* %endif */
1141
1142 #endif
1143
1144 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1145 * we don't want an extra ';' after the "return" because that will cause
1146 * some compilers to complain about unreachable statements.
1147 */
1148 #ifndef yyterminate
1149 #define yyterminate() return YY_NULL
1150 #endif
1151
1152 /* Number of entries by which start-condition stack grows. */
1153 #ifndef YY_START_STACK_INCR
1154 #define YY_START_STACK_INCR 25
1155 #endif
1156
1157 /* Report a fatal error. */
1158 #ifndef YY_FATAL_ERROR
1159 /* %if-c-only */
1160 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1161 /* %endif */
1162 /* %if-c++-only */
1163 /* %endif */
1164 #endif
1165
1166 /* %if-tables-serialization structures and prototypes */
1167 /* %not-for-header */
1168
1169 /* %ok-for-header */
1170
1171 /* %not-for-header */
1172
1173 /* %tables-yydmap generated elements */
1174 /* %endif */
1175 /* end tables serialization structures and prototypes */
1176
1177 /* %ok-for-header */
1178
1179 /* Default declaration of generated scanner - a define so the user can
1180 * easily add parameters.
1181 */
1182 #ifndef YY_DECL
1183 #define YY_DECL_IS_OURS 1
1184 /* %if-c-only Standard (non-C++) definition */
1185
1186 extern int gram_lex (void);
1187
1188 #define YY_DECL int gram_lex (void)
1189 /* %endif */
1190 /* %if-c++-only C++ definition */
1191 /* %endif */
1192 #endif /* !YY_DECL */
1193
1194 /* Code executed at the beginning of each rule, after gram_text and gram_leng
1195 * have been set up.
1196 */
1197 #ifndef YY_USER_ACTION
1198 #define YY_USER_ACTION
1199 #endif
1200
1201 /* Code executed at the end of each rule. */
1202 #ifndef YY_BREAK
1203 #define YY_BREAK break;
1204 #endif
1205
1206 /* %% [6.0] YY_RULE_SETUP definition goes here */
1207 #define YY_RULE_SETUP \
1208 if ( gram_leng > 0 ) \
1209 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
1210 (gram_text[gram_leng - 1] == '\n'); \
1211 YY_USER_ACTION
1212
1213 /* %not-for-header */
1214
1215 /** The main scanner function which does all the work.
1216 */
1217 YY_DECL
1218 {
1219 register yy_state_type yy_current_state;
1220 register char *yy_cp, *yy_bp;
1221 register int yy_act;
1222
1223 /* %% [7.0] user's declarations go here */
1224 #line 106 "scan-gram.l"
1225
1226
1227 /* Nesting level of the current code in braces. */
1228 int braces_level IF_LINT (= 0);
1229
1230 /* Parent context state, when applicable. */
1231 int context_state IF_LINT (= 0);
1232
1233 /* Location of most recent identifier, when applicable. */
1234 location id_loc IF_LINT (= empty_location);
1235
1236 /* Where containing code started, when applicable. Its initial
1237 value is relevant only when gram_lex is invoked in the SC_EPILOGUE
1238 start condition. */
1239 boundary code_start = scanner_cursor;
1240
1241 /* Where containing comment or string or character literal started,
1242 when applicable. */
1243 boundary token_start IF_LINT (= scanner_cursor);
1244
1245
1246
1247 /*-----------------------.
1248 | Scanning white space. |
1249 `-----------------------*/
1250
1251 #line 1252 "scan-gram.c"
1252
1253 if ( !(yy_init) )
1254 {
1255 (yy_init) = 1;
1256
1257 #ifdef YY_USER_INIT
1258 YY_USER_INIT;
1259 #endif
1260
1261 if ( ! (yy_start) )
1262 (yy_start) = 1; /* first start state */
1263
1264 if ( ! gram_in )
1265 /* %if-c-only */
1266 gram_in = stdin;
1267 /* %endif */
1268 /* %if-c++-only */
1269 /* %endif */
1270
1271 if ( ! gram_out )
1272 /* %if-c-only */
1273 gram_out = stdout;
1274 /* %endif */
1275 /* %if-c++-only */
1276 /* %endif */
1277
1278 if ( ! YY_CURRENT_BUFFER ) {
1279 gram_ensure_buffer_stack ();
1280 YY_CURRENT_BUFFER_LVALUE =
1281 gram__create_buffer(gram_in,YY_BUF_SIZE );
1282 }
1283
1284 gram__load_buffer_state( );
1285 }
1286
1287 while ( 1 ) /* loops until end-of-file is reached */
1288 {
1289 /* %% [8.0] yymore()-related code goes here */
1290 yy_cp = (yy_c_buf_p);
1291
1292 /* Support of gram_text. */
1293 *yy_cp = (yy_hold_char);
1294
1295 /* yy_bp points to the position in yy_ch_buf of the start of
1296 * the current run.
1297 */
1298 yy_bp = yy_cp;
1299
1300 /* %% [9.0] code to set up and find next match goes here */
1301 yy_current_state = (yy_start);
1302 yy_current_state += YY_AT_BOL();
1303 yy_match:
1304 do
1305 {
1306 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1307 if ( yy_accept[yy_current_state] )
1308 {
1309 (yy_last_accepting_state) = yy_current_state;
1310 (yy_last_accepting_cpos) = yy_cp;
1311 }
1312 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_c urrent_state )
1313 {
1314 yy_current_state = (int) yy_def[yy_current_state ];
1315 if ( yy_current_state >= 453 )
1316 yy_c = yy_meta[(unsigned int) yy_c];
1317 }
1318 yy_current_state = yy_nxt[yy_base[yy_current_state] + (u nsigned int) yy_c];
1319 ++yy_cp;
1320 }
1321 while ( yy_current_state != 452 );
1322 yy_cp = (yy_last_accepting_cpos);
1323 yy_current_state = (yy_last_accepting_state);
1324
1325 yy_find_action:
1326 /* %% [10.0] code to find the action number goes here */
1327 yy_act = yy_accept[yy_current_state];
1328
1329 YY_DO_BEFORE_ACTION;
1330
1331 /* %% [11.0] code for gram_lineno update goes here */
1332
1333 do_action: /* This label is used only to access EOF actions. */
1334
1335 /* %% [12.0] debug code goes here */
1336 if ( gram__flex_debug )
1337 {
1338 if ( yy_act == 0 )
1339 fprintf( stderr, "--scanner backing up\n" );
1340 else if ( yy_act < 102 )
1341 fprintf( stderr, "--accepting rule at line %ld ( \"%s\")\n",
1342 (long)yy_rule_linenum[yy_act], gram_tex t );
1343 else if ( yy_act == 102 )
1344 fprintf( stderr, "--accepting default rule (\"%s \")\n",
1345 gram_text );
1346 else if ( yy_act == 103 )
1347 fprintf( stderr, "--(end of buffer or a NUL)\n" );
1348 else
1349 fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
1350 }
1351
1352 switch ( yy_act )
1353 { /* beginning of action switch */
1354 /* %% [13.0] actions go here */
1355 case 0: /* must back up */
1356 /* undo the effects of YY_DO_BEFORE_ACTION */
1357 *yy_cp = (yy_hold_char);
1358 yy_cp = (yy_last_accepting_cpos);
1359 yy_current_state = (yy_last_accepting_state);
1360 goto yy_find_action;
1361
1362 /* Comments and white space. */
1363 case 1:
1364 YY_RULE_SETUP
1365 #line 135 "scan-gram.l"
1366 warn_at (*loc, _("stray `,' treated as white space"));
1367 YY_BREAK
1368 case 2:
1369 /* rule 2 can match eol */
1370 #line 137 "scan-gram.l"
1371 case 3:
1372 /* rule 3 can match eol */
1373 YY_RULE_SETUP
1374 #line 137 "scan-gram.l"
1375 ;
1376 YY_BREAK
1377 case 4:
1378 YY_RULE_SETUP
1379 #line 138 "scan-gram.l"
1380 {
1381 token_start = loc->start;
1382 context_state = YY_START;
1383 BEGIN SC_YACC_COMMENT;
1384 }
1385 YY_BREAK
1386 /* #line directives are not documented, and may be withdrawn or
1387 modified in future versions of Bison. */
1388 case 5:
1389 /* rule 5 can match eol */
1390 YY_RULE_SETUP
1391 #line 146 "scan-gram.l"
1392 {
1393 handle_syncline (gram_text + sizeof "#line " - 1, *loc);
1394 }
1395 YY_BREAK
1396
1397 /*----------------------------.
1398 | Scanning Bison directives. |
1399 `----------------------------*/
1400
1401
1402 case 6:
1403 YY_RULE_SETUP
1404 #line 157 "scan-gram.l"
1405 return PERCENT_NONASSOC;
1406 YY_BREAK
1407 case 7:
1408 YY_RULE_SETUP
1409 #line 158 "scan-gram.l"
1410 return PERCENT_CODE;
1411 YY_BREAK
1412 case 8:
1413 YY_RULE_SETUP
1414 #line 159 "scan-gram.l"
1415 return PERCENT_DEBUG;
1416 YY_BREAK
1417 case 9:
1418 YY_RULE_SETUP
1419 #line 160 "scan-gram.l"
1420 return PERCENT_DEFAULT_PREC;
1421 YY_BREAK
1422 case 10:
1423 YY_RULE_SETUP
1424 #line 161 "scan-gram.l"
1425 return PERCENT_DEFINE;
1426 YY_BREAK
1427 case 11:
1428 YY_RULE_SETUP
1429 #line 162 "scan-gram.l"
1430 return PERCENT_DEFINES;
1431 YY_BREAK
1432 case 12:
1433 YY_RULE_SETUP
1434 #line 163 "scan-gram.l"
1435 return PERCENT_DESTRUCTOR;
1436 YY_BREAK
1437 case 13:
1438 YY_RULE_SETUP
1439 #line 164 "scan-gram.l"
1440 return PERCENT_DPREC;
1441 YY_BREAK
1442 case 14:
1443 YY_RULE_SETUP
1444 #line 165 "scan-gram.l"
1445 return PERCENT_ERROR_VERBOSE;
1446 YY_BREAK
1447 case 15:
1448 YY_RULE_SETUP
1449 #line 166 "scan-gram.l"
1450 return PERCENT_EXPECT;
1451 YY_BREAK
1452 case 16:
1453 YY_RULE_SETUP
1454 #line 167 "scan-gram.l"
1455 return PERCENT_EXPECT_RR;
1456 YY_BREAK
1457 case 17:
1458 YY_RULE_SETUP
1459 #line 168 "scan-gram.l"
1460 return PERCENT_FILE_PREFIX;
1461 YY_BREAK
1462 case 18:
1463 YY_RULE_SETUP
1464 #line 169 "scan-gram.l"
1465 return PERCENT_YACC;
1466 YY_BREAK
1467 case 19:
1468 YY_RULE_SETUP
1469 #line 170 "scan-gram.l"
1470 return PERCENT_INITIAL_ACTION;
1471 YY_BREAK
1472 case 20:
1473 YY_RULE_SETUP
1474 #line 171 "scan-gram.l"
1475 return PERCENT_GLR_PARSER;
1476 YY_BREAK
1477 case 21:
1478 YY_RULE_SETUP
1479 #line 172 "scan-gram.l"
1480 return PERCENT_LANGUAGE;
1481 YY_BREAK
1482 case 22:
1483 YY_RULE_SETUP
1484 #line 173 "scan-gram.l"
1485 return PERCENT_LEFT;
1486 YY_BREAK
1487 case 23:
1488 YY_RULE_SETUP
1489 #line 174 "scan-gram.l"
1490 return PERCENT_LEX_PARAM;
1491 YY_BREAK
1492 case 24:
1493 YY_RULE_SETUP
1494 #line 175 "scan-gram.l"
1495 return PERCENT_LOCATIONS;
1496 YY_BREAK
1497 case 25:
1498 YY_RULE_SETUP
1499 #line 176 "scan-gram.l"
1500 return PERCENT_MERGE;
1501 YY_BREAK
1502 case 26:
1503 YY_RULE_SETUP
1504 #line 177 "scan-gram.l"
1505 return PERCENT_NAME_PREFIX;
1506 YY_BREAK
1507 case 27:
1508 YY_RULE_SETUP
1509 #line 178 "scan-gram.l"
1510 return PERCENT_NO_DEFAULT_PREC;
1511 YY_BREAK
1512 case 28:
1513 YY_RULE_SETUP
1514 #line 179 "scan-gram.l"
1515 return PERCENT_NO_LINES;
1516 YY_BREAK
1517 case 29:
1518 YY_RULE_SETUP
1519 #line 180 "scan-gram.l"
1520 return PERCENT_NONASSOC;
1521 YY_BREAK
1522 case 30:
1523 YY_RULE_SETUP
1524 #line 181 "scan-gram.l"
1525 return PERCENT_NONDETERMINISTIC_PARSER;
1526 YY_BREAK
1527 case 31:
1528 YY_RULE_SETUP
1529 #line 182 "scan-gram.l"
1530 return PERCENT_NTERM;
1531 YY_BREAK
1532 case 32:
1533 YY_RULE_SETUP
1534 #line 183 "scan-gram.l"
1535 return PERCENT_OUTPUT;
1536 YY_BREAK
1537 case 33:
1538 YY_RULE_SETUP
1539 #line 184 "scan-gram.l"
1540 return PERCENT_PARSE_PARAM;
1541 YY_BREAK
1542 case 34:
1543 YY_RULE_SETUP
1544 #line 185 "scan-gram.l"
1545 return PERCENT_PREC;
1546 YY_BREAK
1547 case 35:
1548 YY_RULE_SETUP
1549 #line 186 "scan-gram.l"
1550 return PERCENT_PRINTER;
1551 YY_BREAK
1552 case 36:
1553 YY_RULE_SETUP
1554 #line 187 "scan-gram.l"
1555 return PERCENT_PURE_PARSER;
1556 YY_BREAK
1557 case 37:
1558 YY_RULE_SETUP
1559 #line 188 "scan-gram.l"
1560 return PERCENT_REQUIRE;
1561 YY_BREAK
1562 case 38:
1563 YY_RULE_SETUP
1564 #line 189 "scan-gram.l"
1565 return PERCENT_RIGHT;
1566 YY_BREAK
1567 case 39:
1568 YY_RULE_SETUP
1569 #line 190 "scan-gram.l"
1570 return PERCENT_SKELETON;
1571 YY_BREAK
1572 case 40:
1573 YY_RULE_SETUP
1574 #line 191 "scan-gram.l"
1575 return PERCENT_START;
1576 YY_BREAK
1577 case 41:
1578 YY_RULE_SETUP
1579 #line 192 "scan-gram.l"
1580 return PERCENT_TOKEN;
1581 YY_BREAK
1582 case 42:
1583 YY_RULE_SETUP
1584 #line 193 "scan-gram.l"
1585 return PERCENT_TOKEN;
1586 YY_BREAK
1587 case 43:
1588 YY_RULE_SETUP
1589 #line 194 "scan-gram.l"
1590 return PERCENT_TOKEN_TABLE;
1591 YY_BREAK
1592 case 44:
1593 YY_RULE_SETUP
1594 #line 195 "scan-gram.l"
1595 return PERCENT_TYPE;
1596 YY_BREAK
1597 case 45:
1598 YY_RULE_SETUP
1599 #line 196 "scan-gram.l"
1600 return PERCENT_UNION;
1601 YY_BREAK
1602 case 46:
1603 YY_RULE_SETUP
1604 #line 197 "scan-gram.l"
1605 return PERCENT_VERBOSE;
1606 YY_BREAK
1607 case 47:
1608 YY_RULE_SETUP
1609 #line 198 "scan-gram.l"
1610 return PERCENT_YACC;
1611 YY_BREAK
1612 case 48:
1613 YY_RULE_SETUP
1614 #line 200 "scan-gram.l"
1615 {
1616 complain_at (*loc, _("invalid directive: %s"), quote (gram_text));
1617 }
1618 YY_BREAK
1619 case 49:
1620 YY_RULE_SETUP
1621 #line 204 "scan-gram.l"
1622 return EQUAL;
1623 YY_BREAK
1624 case 50:
1625 YY_RULE_SETUP
1626 #line 205 "scan-gram.l"
1627 return PIPE;
1628 YY_BREAK
1629 case 51:
1630 YY_RULE_SETUP
1631 #line 206 "scan-gram.l"
1632 return SEMICOLON;
1633 YY_BREAK
1634 case 52:
1635 YY_RULE_SETUP
1636 #line 207 "scan-gram.l"
1637 return TYPE_TAG_ANY;
1638 YY_BREAK
1639 case 53:
1640 YY_RULE_SETUP
1641 #line 208 "scan-gram.l"
1642 return TYPE_TAG_NONE;
1643 YY_BREAK
1644 case 54:
1645 YY_RULE_SETUP
1646 #line 210 "scan-gram.l"
1647 {
1648 val->uniqstr = uniqstr_new (gram_text);
1649 id_loc = *loc;
1650 BEGIN SC_AFTER_IDENTIFIER;
1651 }
1652 YY_BREAK
1653 case 55:
1654 YY_RULE_SETUP
1655 #line 216 "scan-gram.l"
1656 {
1657 val->integer = scan_integer (gram_text, 10, *loc);
1658 return INT;
1659 }
1660 YY_BREAK
1661 case 56:
1662 YY_RULE_SETUP
1663 #line 220 "scan-gram.l"
1664 {
1665 val->integer = scan_integer (gram_text, 16, *loc);
1666 return INT;
1667 }
1668 YY_BREAK
1669 /* Characters. We don't check there is only one. */
1670 case 57:
1671 YY_RULE_SETUP
1672 #line 226 "scan-gram.l"
1673 STRING_GROW; token_start = loc->start; BEGIN SC_ESCAPED_CHARACTER;
1674 YY_BREAK
1675 /* Strings. */
1676 case 58:
1677 YY_RULE_SETUP
1678 #line 229 "scan-gram.l"
1679 token_start = loc->start; BEGIN SC_ESCAPED_STRING;
1680 YY_BREAK
1681 /* Prologue. */
1682 case 59:
1683 YY_RULE_SETUP
1684 #line 232 "scan-gram.l"
1685 code_start = loc->start; BEGIN SC_PROLOGUE;
1686 YY_BREAK
1687 /* Code in between braces. */
1688 case 60:
1689 YY_RULE_SETUP
1690 #line 235 "scan-gram.l"
1691 {
1692 STRING_GROW;
1693 braces_level = 0;
1694 code_start = loc->start;
1695 BEGIN SC_BRACED_CODE;
1696 }
1697 YY_BREAK
1698 /* A type. */
1699 case 61:
1700 YY_RULE_SETUP
1701 #line 243 "scan-gram.l"
1702 {
1703 obstack_grow (&obstack_for_string, gram_text + 1, gram_leng - 2);
1704 STRING_FINISH;
1705 val->uniqstr = uniqstr_new (last_string);
1706 STRING_FREE;
1707 return TYPE;
1708 }
1709 YY_BREAK
1710 case 62:
1711 YY_RULE_SETUP
1712 #line 251 "scan-gram.l"
1713 {
1714 static int percent_percent_count;
1715 if (++percent_percent_count == 2)
1716 BEGIN SC_EPILOGUE;
1717 return PERCENT_PERCENT;
1718 }
1719 YY_BREAK
1720 case 63:
1721 YY_RULE_SETUP
1722 #line 258 "scan-gram.l"
1723 {
1724 complain_at (*loc, _("invalid character: %s"), quote (gram_text));
1725 }
1726 YY_BREAK
1727 case YY_STATE_EOF(INITIAL):
1728 #line 262 "scan-gram.l"
1729 {
1730 loc->start = loc->end = scanner_cursor;
1731 yyterminate ();
1732 }
1733 YY_BREAK
1734
1735 /*-----------------------------------------------------------------.
1736 | Scanning after an identifier, checking whether a colon is next. |
1737 `-----------------------------------------------------------------*/
1738
1739
1740 case 64:
1741 YY_RULE_SETUP
1742 #line 275 "scan-gram.l"
1743 {
1744 *loc = id_loc;
1745 BEGIN INITIAL;
1746 return ID_COLON;
1747 }
1748 YY_BREAK
1749 case 65:
1750 YY_RULE_SETUP
1751 #line 280 "scan-gram.l"
1752 {
1753 scanner_cursor.column -= mbsnwidth (gram_text, gram_leng, 0);
1754 yyless (0);
1755 *loc = id_loc;
1756 BEGIN INITIAL;
1757 return ID;
1758 }
1759 YY_BREAK
1760 case YY_STATE_EOF(SC_AFTER_IDENTIFIER):
1761 #line 287 "scan-gram.l"
1762 {
1763 *loc = id_loc;
1764 BEGIN INITIAL;
1765 return ID;
1766 }
1767 YY_BREAK
1768
1769 /*---------------------------------------------------------------.
1770 | Scanning a Yacc comment. The initial `/ *' is already eaten. |
1771 `---------------------------------------------------------------*/
1772
1773
1774 case 66:
1775 YY_RULE_SETUP
1776 #line 301 "scan-gram.l"
1777 BEGIN context_state;
1778 YY_BREAK
1779 case 67:
1780 /* rule 67 can match eol */
1781 YY_RULE_SETUP
1782 #line 302 "scan-gram.l"
1783 ;
1784 YY_BREAK
1785 case YY_STATE_EOF(SC_YACC_COMMENT):
1786 #line 303 "scan-gram.l"
1787 unexpected_eof (token_start, "*/"); BEGIN context_state;
1788 YY_BREAK
1789
1790 /*------------------------------------------------------------.
1791 | Scanning a C comment. The initial `/ *' is already eaten. |
1792 `------------------------------------------------------------*/
1793
1794
1795 case 68:
1796 /* rule 68 can match eol */
1797 YY_RULE_SETUP
1798 #line 313 "scan-gram.l"
1799 STRING_GROW; BEGIN context_state;
1800 YY_BREAK
1801 case YY_STATE_EOF(SC_COMMENT):
1802 #line 314 "scan-gram.l"
1803 unexpected_eof (token_start, "*/"); BEGIN context_state;
1804 YY_BREAK
1805
1806 /*--------------------------------------------------------------.
1807 | Scanning a line comment. The initial `//' is already eaten. |
1808 `--------------------------------------------------------------*/
1809
1810
1811 case 69:
1812 /* rule 69 can match eol */
1813 YY_RULE_SETUP
1814 #line 324 "scan-gram.l"
1815 STRING_GROW; BEGIN context_state;
1816 YY_BREAK
1817 case 70:
1818 /* rule 70 can match eol */
1819 YY_RULE_SETUP
1820 #line 325 "scan-gram.l"
1821 STRING_GROW;
1822 YY_BREAK
1823 case YY_STATE_EOF(SC_LINE_COMMENT):
1824 #line 326 "scan-gram.l"
1825 BEGIN context_state;
1826 YY_BREAK
1827
1828 /*------------------------------------------------.
1829 | Scanning a Bison string, including its escapes. |
1830 | The initial quote is already eaten. |
1831 `------------------------------------------------*/
1832
1833
1834 case 71:
1835 /* rule 71 can match eol */
1836 YY_RULE_SETUP
1837 #line 337 "scan-gram.l"
1838 {
1839 if (gram_text[0] == '\n')
1840 unexpected_newline (token_start, "\"");
1841 STRING_FINISH;
1842 loc->start = token_start;
1843 val->chars = last_string;
1844 BEGIN INITIAL;
1845 return STRING;
1846 }
1847 YY_BREAK
1848 case YY_STATE_EOF(SC_ESCAPED_STRING):
1849 #line 346 "scan-gram.l"
1850 {
1851 unexpected_eof (token_start, "\"");
1852 STRING_FINISH;
1853 loc->start = token_start;
1854 val->chars = last_string;
1855 BEGIN INITIAL;
1856 return STRING;
1857 }
1858 YY_BREAK
1859
1860 /*----------------------------------------------------------.
1861 | Scanning a Bison character literal, decoding its escapes. |
1862 | The initial quote is already eaten. |
1863 `----------------------------------------------------------*/
1864
1865
1866 case 72:
1867 /* rule 72 can match eol */
1868 YY_RULE_SETUP
1869 #line 363 "scan-gram.l"
1870 {
1871 if (gram_text[0] == '\n')
1872 unexpected_newline (token_start, "'");
1873 STRING_GROW;
1874 STRING_FINISH;
1875 loc->start = token_start;
1876 val->character = last_string[1];
1877 STRING_FREE;
1878 BEGIN INITIAL;
1879 return CHAR;
1880 }
1881 YY_BREAK
1882 case YY_STATE_EOF(SC_ESCAPED_CHARACTER):
1883 #line 374 "scan-gram.l"
1884 {
1885 unexpected_eof (token_start, "'");
1886 STRING_FINISH;
1887 loc->start = token_start;
1888 if (strlen(last_string) > 1)
1889 val->character = last_string[1];
1890 else
1891 val->character = last_string[0];
1892 STRING_FREE;
1893 BEGIN INITIAL;
1894 return CHAR;
1895 }
1896 YY_BREAK
1897
1898
1899
1900 case 73:
1901 YY_RULE_SETUP
1902 #line 390 "scan-gram.l"
1903 complain_at (*loc, _("invalid null character"));
1904 YY_BREAK
1905
1906 /*----------------------------.
1907 | Decode escaped characters. |
1908 `----------------------------*/
1909
1910
1911 case 74:
1912 YY_RULE_SETUP
1913 #line 400 "scan-gram.l"
1914 {
1915 unsigned long int c = strtoul (gram_text + 1, NULL, 8);
1916 if (UCHAR_MAX < c)
1917 complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text));
1918 else if (! c)
1919 complain_at (*loc, _("invalid null character: %s"), quote (gram_text));
1920 else
1921 obstack_1grow (&obstack_for_string, c);
1922 }
1923 YY_BREAK
1924 case 75:
1925 YY_RULE_SETUP
1926 #line 410 "scan-gram.l"
1927 {
1928 verify (UCHAR_MAX < ULONG_MAX);
1929 unsigned long int c = strtoul (gram_text + 2, NULL, 16);
1930 if (UCHAR_MAX < c)
1931 complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text));
1932 else if (! c)
1933 complain_at (*loc, _("invalid null character: %s"), quote (gram_text));
1934 else
1935 obstack_1grow (&obstack_for_string, c);
1936 }
1937 YY_BREAK
1938 case 76:
1939 YY_RULE_SETUP
1940 #line 421 "scan-gram.l"
1941 obstack_1grow (&obstack_for_string, '\a');
1942 YY_BREAK
1943 case 77:
1944 YY_RULE_SETUP
1945 #line 422 "scan-gram.l"
1946 obstack_1grow (&obstack_for_string, '\b');
1947 YY_BREAK
1948 case 78:
1949 YY_RULE_SETUP
1950 #line 423 "scan-gram.l"
1951 obstack_1grow (&obstack_for_string, '\f');
1952 YY_BREAK
1953 case 79:
1954 YY_RULE_SETUP
1955 #line 424 "scan-gram.l"
1956 obstack_1grow (&obstack_for_string, '\n');
1957 YY_BREAK
1958 case 80:
1959 YY_RULE_SETUP
1960 #line 425 "scan-gram.l"
1961 obstack_1grow (&obstack_for_string, '\r');
1962 YY_BREAK
1963 case 81:
1964 YY_RULE_SETUP
1965 #line 426 "scan-gram.l"
1966 obstack_1grow (&obstack_for_string, '\t');
1967 YY_BREAK
1968 case 82:
1969 YY_RULE_SETUP
1970 #line 427 "scan-gram.l"
1971 obstack_1grow (&obstack_for_string, '\v');
1972 YY_BREAK
1973 /* \\[\"\'?\\] would be shorter, but it confuses xgettext. */
1974 case 83:
1975 YY_RULE_SETUP
1976 #line 430 "scan-gram.l"
1977 obstack_1grow (&obstack_for_string, gram_text[1]);
1978 YY_BREAK
1979 case 84:
1980 YY_RULE_SETUP
1981 #line 432 "scan-gram.l"
1982 {
1983 int c = convert_ucn_to_byte (gram_text);
1984 if (c < 0)
1985 complain_at (*loc, _("invalid escape sequence: %s"), quote (gram_text));
1986 else if (! c)
1987 complain_at (*loc, _("invalid null character: %s"), quote (gram_text));
1988 else
1989 obstack_1grow (&obstack_for_string, c);
1990 }
1991 YY_BREAK
1992 case 85:
1993 /* rule 85 can match eol */
1994 YY_RULE_SETUP
1995 #line 441 "scan-gram.l"
1996 {
1997 complain_at (*loc, _("unrecognized escape sequence: %s"), quote (gram_text)) ;
1998 STRING_GROW;
1999 }
2000 YY_BREAK
2001
2002 /*--------------------------------------------.
2003 | Scanning user-code characters and strings. |
2004 `--------------------------------------------*/
2005
2006
2007 case 86:
2008 /* rule 86 can match eol */
2009 YY_RULE_SETUP
2010 #line 453 "scan-gram.l"
2011 STRING_GROW;
2012 YY_BREAK
2013
2014
2015
2016 case 87:
2017 YY_RULE_SETUP
2018 #line 458 "scan-gram.l"
2019 STRING_GROW; BEGIN context_state;
2020 YY_BREAK
2021 case 88:
2022 /* rule 88 can match eol */
2023 YY_RULE_SETUP
2024 #line 459 "scan-gram.l"
2025 unexpected_newline (token_start, "'"); BEGIN context_state;
2026 YY_BREAK
2027 case YY_STATE_EOF(SC_CHARACTER):
2028 #line 460 "scan-gram.l"
2029 unexpected_eof (token_start, "'"); BEGIN context_state;
2030 YY_BREAK
2031
2032
2033
2034 case 89:
2035 YY_RULE_SETUP
2036 #line 465 "scan-gram.l"
2037 STRING_GROW; BEGIN context_state;
2038 YY_BREAK
2039 case 90:
2040 /* rule 90 can match eol */
2041 YY_RULE_SETUP
2042 #line 466 "scan-gram.l"
2043 unexpected_newline (token_start, "\""); BEGIN context_state;
2044 YY_BREAK
2045 case YY_STATE_EOF(SC_STRING):
2046 #line 467 "scan-gram.l"
2047 unexpected_eof (token_start, "\""); BEGIN context_state;
2048 YY_BREAK
2049
2050 /*---------------------------------------------------.
2051 | Strings, comments etc. can be found in user code. |
2052 `---------------------------------------------------*/
2053
2054
2055 case 91:
2056 YY_RULE_SETUP
2057 #line 477 "scan-gram.l"
2058 {
2059 STRING_GROW;
2060 context_state = YY_START;
2061 token_start = loc->start;
2062 BEGIN SC_CHARACTER;
2063 }
2064 YY_BREAK
2065 case 92:
2066 YY_RULE_SETUP
2067 #line 483 "scan-gram.l"
2068 {
2069 STRING_GROW;
2070 context_state = YY_START;
2071 token_start = loc->start;
2072 BEGIN SC_STRING;
2073 }
2074 YY_BREAK
2075 case 93:
2076 /* rule 93 can match eol */
2077 YY_RULE_SETUP
2078 #line 489 "scan-gram.l"
2079 {
2080 STRING_GROW;
2081 context_state = YY_START;
2082 token_start = loc->start;
2083 BEGIN SC_COMMENT;
2084 }
2085 YY_BREAK
2086 case 94:
2087 /* rule 94 can match eol */
2088 YY_RULE_SETUP
2089 #line 495 "scan-gram.l"
2090 {
2091 STRING_GROW;
2092 context_state = YY_START;
2093 BEGIN SC_LINE_COMMENT;
2094 }
2095 YY_BREAK
2096
2097 /*-----------------------------------------------------------.
2098 | Scanning some code in braces (actions). The initial "{" is |
2099 | already eaten. |
2100 `-----------------------------------------------------------*/
2101
2102
2103 case 95:
2104 /* rule 95 can match eol */
2105 YY_RULE_SETUP
2106 #line 511 "scan-gram.l"
2107 STRING_GROW; braces_level++;
2108 YY_BREAK
2109 case 96:
2110 /* rule 96 can match eol */
2111 YY_RULE_SETUP
2112 #line 512 "scan-gram.l"
2113 STRING_GROW; braces_level--;
2114 YY_BREAK
2115 case 97:
2116 YY_RULE_SETUP
2117 #line 513 "scan-gram.l"
2118 {
2119 obstack_1grow (&obstack_for_string, '}');
2120
2121 --braces_level;
2122 if (braces_level < 0)
2123 {
2124 STRING_FINISH;
2125 loc->start = code_start;
2126 val->code = last_string;
2127 BEGIN INITIAL;
2128 return BRACED_CODE;
2129 }
2130 }
2131 YY_BREAK
2132 /* Tokenize `<<%' correctly (as `<<' `%') rather than incorrrectly
2133 (as `<' `<%'). */
2134 case 98:
2135 /* rule 98 can match eol */
2136 YY_RULE_SETUP
2137 #line 529 "scan-gram.l"
2138 STRING_GROW;
2139 YY_BREAK
2140 case YY_STATE_EOF(SC_BRACED_CODE):
2141 #line 531 "scan-gram.l"
2142 {
2143 unexpected_eof (code_start, "}");
2144 STRING_FINISH;
2145 loc->start = code_start;
2146 val->code = last_string;
2147 BEGIN INITIAL;
2148 return BRACED_CODE;
2149 }
2150 YY_BREAK
2151
2152 /*--------------------------------------------------------------.
2153 | Scanning some prologue: from "%{" (already scanned) to "%}". |
2154 `--------------------------------------------------------------*/
2155
2156
2157 case 99:
2158 YY_RULE_SETUP
2159 #line 548 "scan-gram.l"
2160 {
2161 STRING_FINISH;
2162 loc->start = code_start;
2163 val->chars = last_string;
2164 BEGIN INITIAL;
2165 return PROLOGUE;
2166 }
2167 YY_BREAK
2168 case YY_STATE_EOF(SC_PROLOGUE):
2169 #line 556 "scan-gram.l"
2170 {
2171 unexpected_eof (code_start, "%}");
2172 STRING_FINISH;
2173 loc->start = code_start;
2174 val->chars = last_string;
2175 BEGIN INITIAL;
2176 return PROLOGUE;
2177 }
2178 YY_BREAK
2179
2180 /*---------------------------------------------------------------.
2181 | Scanning the epilogue (everything after the second "%%", which |
2182 | has already been eaten). |
2183 `---------------------------------------------------------------*/
2184
2185
2186 case YY_STATE_EOF(SC_EPILOGUE):
2187 #line 574 "scan-gram.l"
2188 {
2189 STRING_FINISH;
2190 loc->start = code_start;
2191 val->chars = last_string;
2192 BEGIN INITIAL;
2193 return EPILOGUE;
2194 }
2195 YY_BREAK
2196
2197 /*-----------------------------------------------------.
2198 | By default, grow the string obstack with the input. |
2199 `-----------------------------------------------------*/
2200 case 100:
2201 #line 589 "scan-gram.l"
2202 case 101:
2203 /* rule 101 can match eol */
2204 YY_RULE_SETUP
2205 #line 589 "scan-gram.l"
2206 STRING_GROW;
2207 YY_BREAK
2208 case 102:
2209 YY_RULE_SETUP
2210 #line 591 "scan-gram.l"
2211 YY_FATAL_ERROR( "flex scanner jammed" );
2212 YY_BREAK
2213 #line 2214 "scan-gram.c"
2214
2215 case YY_END_OF_BUFFER:
2216 {
2217 /* Amount of text matched not including the EOB char. */
2218 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1 ;
2219
2220 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2221 *yy_cp = (yy_hold_char);
2222 YY_RESTORE_YY_MORE_OFFSET
2223
2224 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
2225 {
2226 /* We're scanning a new file or input source. It's
2227 * possible that this happened because the user
2228 * just pointed gram_in at a new source and called
2229 * gram_lex(). If so, then we have to assure
2230 * consistency between YY_CURRENT_BUFFER and our
2231 * globals. Here is the right place to do so, because
2232 * this is the first action (other than possibly a
2233 * back-up) that will match for the new input source.
2234 */
2235 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2236 YY_CURRENT_BUFFER_LVALUE->yy_input_file = gram_in;
2237 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_N ORMAL;
2238 }
2239
2240 /* Note that here we test for yy_c_buf_p "<=" to the position
2241 * of the first EOB in the buffer, since yy_c_buf_p will
2242 * already have been incremented past the NUL character
2243 * (since all states make transitions on EOB to the
2244 * end-of-buffer state). Contrast this with the test
2245 * in input().
2246 */
2247 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_ chars)] )
2248 { /* This was really a NUL. */
2249 yy_state_type yy_next_state;
2250
2251 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
2252
2253 yy_current_state = yy_get_previous_state( );
2254
2255 /* Okay, we're now positioned to make the NUL
2256 * transition. We couldn't have
2257 * yy_get_previous_state() go ahead and do it
2258 * for us because it doesn't know how to deal
2259 * with the possibility of jamming (and we don't
2260 * want to build jamming into it because then it
2261 * will run more slowly).
2262 */
2263
2264 yy_next_state = yy_try_NUL_trans( yy_current_state );
2265
2266 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2267
2268 if ( yy_next_state )
2269 {
2270 /* Consume the NUL. */
2271 yy_cp = ++(yy_c_buf_p);
2272 yy_current_state = yy_next_state;
2273 goto yy_match;
2274 }
2275
2276 else
2277 {
2278 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
2279 yy_cp = (yy_last_accepting_cpos);
2280 yy_current_state = (yy_last_accepting_state);
2281 goto yy_find_action;
2282 }
2283 }
2284
2285 else switch ( yy_get_next_buffer( ) )
2286 {
2287 case EOB_ACT_END_OF_FILE:
2288 {
2289 (yy_did_buffer_switch_on_eof) = 0;
2290
2291 if ( gram_wrap( ) )
2292 {
2293 /* Note: because we've taken care in
2294 * yy_get_next_buffer() to have set up
2295 * gram_text, we can now set up
2296 * yy_c_buf_p so that if some total
2297 * hoser (like flex itself) wants to
2298 * call the scanner after we return the
2299 * YY_NULL, it'll still work - another
2300 * YY_NULL will get returned.
2301 */
2302 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_AD J;
2303
2304 yy_act = YY_STATE_EOF(YY_START);
2305 goto do_action;
2306 }
2307
2308 else
2309 {
2310 if ( ! (yy_did_buffer_switch_on_eof) )
2311 YY_NEW_FILE;
2312 }
2313 break;
2314 }
2315
2316 case EOB_ACT_CONTINUE_SCAN:
2317 (yy_c_buf_p) =
2318 (yytext_ptr) + yy_amount_of_matched_text ;
2319
2320 yy_current_state = yy_get_previous_state( );
2321
2322 yy_cp = (yy_c_buf_p);
2323 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2324 goto yy_match;
2325
2326 case EOB_ACT_LAST_MATCH:
2327 (yy_c_buf_p) =
2328 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars )];
2329
2330 yy_current_state = yy_get_previous_state( );
2331
2332 yy_cp = (yy_c_buf_p);
2333 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
2334 goto yy_find_action;
2335 }
2336 break;
2337 }
2338
2339 default:
2340 YY_FATAL_ERROR(
2341 "fatal flex scanner internal error--no action found" );
2342 } /* end of action switch */
2343 } /* end of scanning one token */
2344 } /* end of gram_lex */
2345 /* %ok-for-header */
2346
2347 /* %if-c++-only */
2348 /* %not-for-header */
2349
2350 /* %ok-for-header */
2351
2352 /* %endif */
2353
2354 /* yy_get_next_buffer - try to read in a new buffer
2355 *
2356 * Returns a code representing an action:
2357 * EOB_ACT_LAST_MATCH -
2358 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2359 * EOB_ACT_END_OF_FILE - end of file
2360 */
2361 /* %if-c-only */
2362 static int yy_get_next_buffer (void)
2363 /* %endif */
2364 /* %if-c++-only */
2365 /* %endif */
2366 {
2367 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
2368 register char *source = (yytext_ptr);
2369 register int number_to_move, i;
2370 int ret_val;
2371
2372 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
2373 YY_FATAL_ERROR(
2374 "fatal flex scanner internal error--end of buffer missed" );
2375
2376 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
2377 { /* Don't try to fill the buffer, so this is an EOF. */
2378 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
2379 {
2380 /* We matched a single character, the EOB, so
2381 * treat this as a final EOF.
2382 */
2383 return EOB_ACT_END_OF_FILE;
2384 }
2385
2386 else
2387 {
2388 /* We matched some text prior to the EOB, first
2389 * process it.
2390 */
2391 return EOB_ACT_LAST_MATCH;
2392 }
2393 }
2394
2395 /* Try to read more data. */
2396
2397 /* First move last chars to start of buffer. */
2398 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
2399
2400 for ( i = 0; i < number_to_move; ++i )
2401 *(dest++) = *(source++);
2402
2403 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2404 /* don't do the read, it's not guaranteed to return an EOF,
2405 * just force an EOF
2406 */
2407 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
2408
2409 else
2410 {
2411 int num_to_read =
2412 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
2413
2414 while ( num_to_read <= 0 )
2415 { /* Not enough room in the buffer - grow it. */
2416
2417 /* just a shorter name for the current buffer */
2418 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2419
2420 int yy_c_buf_p_offset =
2421 (int) ((yy_c_buf_p) - b->yy_ch_buf);
2422
2423 if ( b->yy_is_our_buffer )
2424 {
2425 int new_size = b->yy_buf_size * 2;
2426
2427 if ( new_size <= 0 )
2428 b->yy_buf_size += b->yy_buf_size / 8;
2429 else
2430 b->yy_buf_size *= 2;
2431
2432 b->yy_ch_buf = (char *)
2433 /* Include room in for 2 EOB chars. */
2434 gram_realloc((void *) b->yy_ch_buf,b->yy _buf_size + 2 );
2435 }
2436 else
2437 /* Can't grow it, we don't own it. */
2438 b->yy_ch_buf = 0;
2439
2440 if ( ! b->yy_ch_buf )
2441 YY_FATAL_ERROR(
2442 "fatal error - scanner input buffer overflow" );
2443
2444 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
2445
2446 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
2447 number_to_move - 1;
2448
2449 }
2450
2451 if ( num_to_read > YY_READ_BUF_SIZE )
2452 num_to_read = YY_READ_BUF_SIZE;
2453
2454 /* Read in more data. */
2455 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]) ,
2456 (yy_n_chars), (size_t) num_to_read );
2457
2458 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2459 }
2460
2461 if ( (yy_n_chars) == 0 )
2462 {
2463 if ( number_to_move == YY_MORE_ADJ )
2464 {
2465 ret_val = EOB_ACT_END_OF_FILE;
2466 gram_restart(gram_in );
2467 }
2468
2469 else
2470 {
2471 ret_val = EOB_ACT_LAST_MATCH;
2472 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
2473 YY_BUFFER_EOF_PENDING;
2474 }
2475 }
2476
2477 else
2478 ret_val = EOB_ACT_CONTINUE_SCAN;
2479
2480 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVAL UE->yy_buf_size) {
2481 /* Extend the array by 50%, plus the number we really need. */
2482 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_char s) >> 1);
2483 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) gram_realloc((voi d *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
2484 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
2485 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_bu ffer()" );
2486 }
2487
2488 (yy_n_chars) += number_to_move;
2489 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHA R;
2490 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER _CHAR;
2491
2492 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
2493
2494 return ret_val;
2495 }
2496
2497 /* yy_get_previous_state - get the state just before the EOB char was reached */
2498
2499 /* %if-c-only */
2500 /* %not-for-header */
2501
2502 static yy_state_type yy_get_previous_state (void)
2503 /* %endif */
2504 /* %if-c++-only */
2505 /* %endif */
2506 {
2507 register yy_state_type yy_current_state;
2508 register char *yy_cp;
2509
2510 /* %% [15.0] code to get the start state into yy_current_state goes here */
2511 yy_current_state = (yy_start);
2512 yy_current_state += YY_AT_BOL();
2513
2514 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
2515 {
2516 /* %% [16.0] code to find the next state goes here */
2517 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 5 5);
2518 if ( yy_accept[yy_current_state] )
2519 {
2520 (yy_last_accepting_state) = yy_current_state;
2521 (yy_last_accepting_cpos) = yy_cp;
2522 }
2523 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_s tate )
2524 {
2525 yy_current_state = (int) yy_def[yy_current_state];
2526 if ( yy_current_state >= 453 )
2527 yy_c = yy_meta[(unsigned int) yy_c];
2528 }
2529 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2530 }
2531
2532 return yy_current_state;
2533 }
2534
2535 /* yy_try_NUL_trans - try to make a transition on the NUL character
2536 *
2537 * synopsis
2538 * next_state = yy_try_NUL_trans( current_state );
2539 */
2540 /* %if-c-only */
2541 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
2542 /* %endif */
2543 /* %if-c++-only */
2544 /* %endif */
2545 {
2546 register int yy_is_jam;
2547 /* %% [17.0] code to find the next state, and perhaps do backing up, goes he re */
2548 register char *yy_cp = (yy_c_buf_p);
2549
2550 register YY_CHAR yy_c = 55;
2551 if ( yy_accept[yy_current_state] )
2552 {
2553 (yy_last_accepting_state) = yy_current_state;
2554 (yy_last_accepting_cpos) = yy_cp;
2555 }
2556 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2557 {
2558 yy_current_state = (int) yy_def[yy_current_state];
2559 if ( yy_current_state >= 453 )
2560 yy_c = yy_meta[(unsigned int) yy_c];
2561 }
2562 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_ c];
2563 yy_is_jam = (yy_current_state == 452);
2564
2565 return yy_is_jam ? 0 : yy_current_state;
2566 }
2567
2568 /* %if-c-only */
2569
2570 /* %endif */
2571
2572 /* %if-c-only */
2573 #ifndef YY_NO_INPUT
2574 #ifdef __cplusplus
2575 static int yyinput (void)
2576 #else
2577 static int input (void)
2578 #endif
2579
2580 /* %endif */
2581 /* %if-c++-only */
2582 /* %endif */
2583 {
2584 int c;
2585
2586 *(yy_c_buf_p) = (yy_hold_char);
2587
2588 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
2589 {
2590 /* yy_c_buf_p now points to the character we want to return.
2591 * If this occurs *before* the EOB characters, then it's a
2592 * valid NUL; if not, then we've hit the end of the buffer.
2593 */
2594 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_c hars)] )
2595 /* This was really a NUL. */
2596 *(yy_c_buf_p) = '\0';
2597
2598 else
2599 { /* need more input */
2600 int offset = (yy_c_buf_p) - (yytext_ptr);
2601 ++(yy_c_buf_p);
2602
2603 switch ( yy_get_next_buffer( ) )
2604 {
2605 case EOB_ACT_LAST_MATCH:
2606 /* This happens because yy_g_n_b()
2607 * sees that we've accumulated a
2608 * token and flags that we need to
2609 * try matching the token before
2610 * proceeding. But for input(),
2611 * there's no matching to consider.
2612 * So convert the EOB_ACT_LAST_MATCH
2613 * to EOB_ACT_END_OF_FILE.
2614 */
2615
2616 /* Reset buffer status. */
2617 gram_restart(gram_in );
2618
2619 /*FALLTHROUGH*/
2620
2621 case EOB_ACT_END_OF_FILE:
2622 {
2623 if ( gram_wrap( ) )
2624 return EOF;
2625
2626 if ( ! (yy_did_buffer_switch_on_eof) )
2627 YY_NEW_FILE;
2628 #ifdef __cplusplus
2629 return yyinput();
2630 #else
2631 return input();
2632 #endif
2633 }
2634
2635 case EOB_ACT_CONTINUE_SCAN:
2636 (yy_c_buf_p) = (yytext_ptr) + offset;
2637 break;
2638 }
2639 }
2640 }
2641
2642 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
2643 *(yy_c_buf_p) = '\0'; /* preserve gram_text */
2644 (yy_hold_char) = *++(yy_c_buf_p);
2645
2646 /* %% [19.0] update BOL and gram_lineno */
2647 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
2648
2649 return c;
2650 }
2651 /* %if-c-only */
2652 #endif /* ifndef YY_NO_INPUT */
2653 /* %endif */
2654
2655 /** Immediately switch to a different input stream.
2656 * @param input_file A readable stream.
2657 *
2658 * @note This function does not reset the start condition to @c INITIAL .
2659 */
2660 /* %if-c-only */
2661 void gram_restart (FILE * input_file )
2662 /* %endif */
2663 /* %if-c++-only */
2664 /* %endif */
2665 {
2666
2667 if ( ! YY_CURRENT_BUFFER ){
2668 gram_ensure_buffer_stack ();
2669 YY_CURRENT_BUFFER_LVALUE =
2670 gram__create_buffer(gram_in,YY_BUF_SIZE );
2671 }
2672
2673 gram__init_buffer(YY_CURRENT_BUFFER,input_file );
2674 gram__load_buffer_state( );
2675 }
2676
2677 /** Switch to a different input buffer.
2678 * @param new_buffer The new input buffer.
2679 *
2680 */
2681 /* %if-c-only */
2682 void gram__switch_to_buffer (YY_BUFFER_STATE new_buffer )
2683 /* %endif */
2684 /* %if-c++-only */
2685 /* %endif */
2686 {
2687
2688 /* TODO. We should be able to replace this entire function body
2689 * with
2690 * gram_pop_buffer_state();
2691 * gram_push_buffer_state(new_buffer);
2692 */
2693 gram_ensure_buffer_stack ();
2694 if ( YY_CURRENT_BUFFER == new_buffer )
2695 return;
2696
2697 if ( YY_CURRENT_BUFFER )
2698 {
2699 /* Flush out information for old buffer. */
2700 *(yy_c_buf_p) = (yy_hold_char);
2701 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2702 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2703 }
2704
2705 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2706 gram__load_buffer_state( );
2707
2708 /* We don't actually know whether we did this switch during
2709 * EOF (gram_wrap()) processing, but the only time this flag
2710 * is looked at is after gram_wrap() is called, so it's safe
2711 * to go ahead and always set it.
2712 */
2713 (yy_did_buffer_switch_on_eof) = 1;
2714 }
2715
2716 /* %if-c-only */
2717 static void gram__load_buffer_state (void)
2718 /* %endif */
2719 /* %if-c++-only */
2720 /* %endif */
2721 {
2722 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
2723 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
2724 gram_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
2725 (yy_hold_char) = *(yy_c_buf_p);
2726 }
2727
2728 /** Allocate and initialize an input buffer state.
2729 * @param file A readable stream.
2730 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_ SIZE.
2731 *
2732 * @return the allocated buffer state.
2733 */
2734 /* %if-c-only */
2735 YY_BUFFER_STATE gram__create_buffer (FILE * file, int size )
2736 /* %endif */
2737 /* %if-c++-only */
2738 /* %endif */
2739 {
2740 YY_BUFFER_STATE b;
2741
2742 b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) );
2743 if ( ! b )
2744 YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" );
2745
2746 b->yy_buf_size = size;
2747
2748 /* yy_ch_buf has to be 2 characters longer than the size given because
2749 * we need to put in 2 end-of-buffer characters.
2750 */
2751 b->yy_ch_buf = (char *) gram_alloc(b->yy_buf_size + 2 );
2752 if ( ! b->yy_ch_buf )
2753 YY_FATAL_ERROR( "out of dynamic memory in gram__create_buffer()" );
2754
2755 b->yy_is_our_buffer = 1;
2756
2757 gram__init_buffer(b,file );
2758
2759 return b;
2760 }
2761
2762 /** Destroy the buffer.
2763 * @param b a buffer created with gram__create_buffer()
2764 *
2765 */
2766 /* %if-c-only */
2767 void gram__delete_buffer (YY_BUFFER_STATE b )
2768 /* %endif */
2769 /* %if-c++-only */
2770 /* %endif */
2771 {
2772
2773 if ( ! b )
2774 return;
2775
2776 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
2777 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
2778
2779 if ( b->yy_is_our_buffer )
2780 gram_free((void *) b->yy_ch_buf );
2781
2782 gram_free((void *) b );
2783 }
2784
2785 /* %if-c-only */
2786
2787 /* %endif */
2788
2789 /* %if-c++-only */
2790 /* %endif */
2791
2792 /* Initializes or reinitializes a buffer.
2793 * This function is sometimes called more than once on the same buffer,
2794 * such as during a gram_restart() or at EOF.
2795 */
2796 /* %if-c-only */
2797 static void gram__init_buffer (YY_BUFFER_STATE b, FILE * file )
2798 /* %endif */
2799 /* %if-c++-only */
2800 /* %endif */
2801
2802 {
2803 int oerrno = errno;
2804
2805 gram__flush_buffer(b );
2806
2807 b->yy_input_file = file;
2808 b->yy_fill_buffer = 1;
2809
2810 /* If b is the current buffer, then gram__init_buffer was _probably_
2811 * called from gram_restart() or through yy_get_next_buffer.
2812 * In that case, we don't want to reset the lineno or column.
2813 */
2814 if (b != YY_CURRENT_BUFFER){
2815 b->yy_bs_lineno = 1;
2816 b->yy_bs_column = 0;
2817 }
2818
2819 /* %if-c-only */
2820
2821 b->yy_is_interactive = 0;
2822
2823 /* %endif */
2824 /* %if-c++-only */
2825 /* %endif */
2826 errno = oerrno;
2827 }
2828
2829 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
2830 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
2831 *
2832 */
2833 /* %if-c-only */
2834 void gram__flush_buffer (YY_BUFFER_STATE b )
2835 /* %endif */
2836 /* %if-c++-only */
2837 /* %endif */
2838 {
2839 if ( ! b )
2840 return;
2841
2842 b->yy_n_chars = 0;
2843
2844 /* We always need two end-of-buffer characters. The first causes
2845 * a transition to the end-of-buffer state. The second causes
2846 * a jam in that state.
2847 */
2848 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
2849 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
2850
2851 b->yy_buf_pos = &b->yy_ch_buf[0];
2852
2853 b->yy_at_bol = 1;
2854 b->yy_buffer_status = YY_BUFFER_NEW;
2855
2856 if ( b == YY_CURRENT_BUFFER )
2857 gram__load_buffer_state( );
2858 }
2859
2860 /* %if-c-or-c++ */
2861 /** Pushes the new state onto the stack. The new state becomes
2862 * the current state. This function will allocate the stack
2863 * if necessary.
2864 * @param new_buffer The new state.
2865 *
2866 */
2867 /* %if-c-only */
2868 void gram_push_buffer_state (YY_BUFFER_STATE new_buffer )
2869 /* %endif */
2870 /* %if-c++-only */
2871 /* %endif */
2872 {
2873 if (new_buffer == NULL)
2874 return;
2875
2876 gram_ensure_buffer_stack();
2877
2878 /* This block is copied from gram__switch_to_buffer. */
2879 if ( YY_CURRENT_BUFFER )
2880 {
2881 /* Flush out information for old buffer. */
2882 *(yy_c_buf_p) = (yy_hold_char);
2883 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2884 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2885 }
2886
2887 /* Only push if top exists. Otherwise, replace top. */
2888 if (YY_CURRENT_BUFFER)
2889 (yy_buffer_stack_top)++;
2890 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2891
2892 /* copied from gram__switch_to_buffer. */
2893 gram__load_buffer_state( );
2894 (yy_did_buffer_switch_on_eof) = 1;
2895 }
2896 /* %endif */
2897
2898 /* %if-c-or-c++ */
2899 /** Removes and deletes the top of the stack, if present.
2900 * The next element becomes the new top.
2901 *
2902 */
2903 /* %if-c-only */
2904 void gram_pop_buffer_state (void)
2905 /* %endif */
2906 /* %if-c++-only */
2907 /* %endif */
2908 {
2909 if (!YY_CURRENT_BUFFER)
2910 return;
2911
2912 gram__delete_buffer(YY_CURRENT_BUFFER );
2913 YY_CURRENT_BUFFER_LVALUE = NULL;
2914 if ((yy_buffer_stack_top) > 0)
2915 --(yy_buffer_stack_top);
2916
2917 if (YY_CURRENT_BUFFER) {
2918 gram__load_buffer_state( );
2919 (yy_did_buffer_switch_on_eof) = 1;
2920 }
2921 }
2922 /* %endif */
2923
2924 /* %if-c-or-c++ */
2925 /* Allocates the stack if it does not exist.
2926 * Guarantees space for at least one push.
2927 */
2928 /* %if-c-only */
2929 static void gram_ensure_buffer_stack (void)
2930 /* %endif */
2931 /* %if-c++-only */
2932 /* %endif */
2933 {
2934 int num_to_alloc;
2935
2936 if (!(yy_buffer_stack)) {
2937
2938 /* First allocation is just for 2 elements, since we don't know if this
2939 * scanner will even need a stack. We use 2 instead of 1 to avoi d an
2940 * immediate realloc on the next call.
2941 */
2942 num_to_alloc = 1;
2943 (yy_buffer_stack) = (struct yy_buffer_state**)gram_alloc
2944 (num_to_alloc * sizeof(struct yy_buffer_state*)
2945 );
2946 if ( ! (yy_buffer_stack) )
2947 YY_FATAL_ERROR( "out of dynamic memory in gram_ensure_bu ffer_stack()" );
2948
2949 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buf fer_state*));
2950
2951 (yy_buffer_stack_max) = num_to_alloc;
2952 (yy_buffer_stack_top) = 0;
2953 return;
2954 }
2955
2956 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2957
2958 /* Increase the buffer to prepare for a possible push. */
2959 int grow_size = 8 /* arbitrary grow size */;
2960
2961 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2962 (yy_buffer_stack) = (struct yy_buffer_state**)gram_realloc
2963 ((yy_buffer_stac k),
2964 num_to_alloc * s izeof(struct yy_buffer_state*)
2965 );
2966 if ( ! (yy_buffer_stack) )
2967 YY_FATAL_ERROR( "out of dynamic memory in gram_ensure_bu ffer_stack()" );
2968
2969 /* zero only the new slots.*/
2970 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2971 (yy_buffer_stack_max) = num_to_alloc;
2972 }
2973 }
2974 /* %endif */
2975
2976 /* %if-c-only */
2977 /** Setup the input buffer state to scan directly from a user-specified characte r buffer.
2978 * @param base the character buffer
2979 * @param size the size in bytes of the character buffer
2980 *
2981 * @return the newly allocated buffer state object.
2982 */
2983 YY_BUFFER_STATE gram__scan_buffer (char * base, yy_size_t size )
2984 {
2985 YY_BUFFER_STATE b;
2986
2987 if ( size < 2 ||
2988 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2989 base[size-1] != YY_END_OF_BUFFER_CHAR )
2990 /* They forgot to leave room for the EOB's. */
2991 return 0;
2992
2993 b = (YY_BUFFER_STATE) gram_alloc(sizeof( struct yy_buffer_state ) );
2994 if ( ! b )
2995 YY_FATAL_ERROR( "out of dynamic memory in gram__scan_buffer()" ) ;
2996
2997 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2998 b->yy_buf_pos = b->yy_ch_buf = base;
2999 b->yy_is_our_buffer = 0;
3000 b->yy_input_file = 0;
3001 b->yy_n_chars = b->yy_buf_size;
3002 b->yy_is_interactive = 0;
3003 b->yy_at_bol = 1;
3004 b->yy_fill_buffer = 0;
3005 b->yy_buffer_status = YY_BUFFER_NEW;
3006
3007 gram__switch_to_buffer(b );
3008
3009 return b;
3010 }
3011 /* %endif */
3012
3013 /* %if-c-only */
3014 /** Setup the input buffer state to scan a string. The next call to gram_lex() w ill
3015 * scan from a @e copy of @a str.
3016 * @param yystr a NUL-terminated string to scan
3017 *
3018 * @return the newly allocated buffer state object.
3019 * @note If you want to scan bytes that may contain NUL values, then use
3020 * gram__scan_bytes() instead.
3021 */
3022 YY_BUFFER_STATE gram__scan_string (yyconst char * yystr )
3023 {
3024
3025 return gram__scan_bytes(yystr,strlen(yystr) );
3026 }
3027 /* %endif */
3028
3029 /* %if-c-only */
3030 /** Setup the input buffer state to scan the given bytes. The next call to gram_ lex() will
3031 * scan from a @e copy of @a bytes.
3032 * @param bytes the byte buffer to scan
3033 * @param len the number of bytes in the buffer pointed to by @a bytes.
3034 *
3035 * @return the newly allocated buffer state object.
3036 */
3037 YY_BUFFER_STATE gram__scan_bytes (yyconst char * yybytes, int _yybytes_len )
3038 {
3039 YY_BUFFER_STATE b;
3040 char *buf;
3041 yy_size_t n;
3042 int i;
3043
3044 /* Get memory for full buffer, including space for trailing EOB's. */
3045 n = _yybytes_len + 2;
3046 buf = (char *) gram_alloc(n );
3047 if ( ! buf )
3048 YY_FATAL_ERROR( "out of dynamic memory in gram__scan_bytes()" );
3049
3050 for ( i = 0; i < _yybytes_len; ++i )
3051 buf[i] = yybytes[i];
3052
3053 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
3054
3055 b = gram__scan_buffer(buf,n );
3056 if ( ! b )
3057 YY_FATAL_ERROR( "bad buffer in gram__scan_bytes()" );
3058
3059 /* It's okay to grow etc. this buffer, and we should throw it
3060 * away when we're done.
3061 */
3062 b->yy_is_our_buffer = 1;
3063
3064 return b;
3065 }
3066 /* %endif */
3067
3068 #ifndef YY_EXIT_FAILURE
3069 #define YY_EXIT_FAILURE 2
3070 #endif
3071
3072 /* %if-c-only */
3073 static void yy_fatal_error (yyconst char* msg )
3074 {
3075 (void) fprintf( stderr, "%s\n", msg );
3076 exit( YY_EXIT_FAILURE );
3077 }
3078 /* %endif */
3079 /* %if-c++-only */
3080 /* %endif */
3081
3082 /* Redefine yyless() so it works in section 3 code. */
3083
3084 #undef yyless
3085 #define yyless(n) \
3086 do \
3087 { \
3088 /* Undo effects of setting up gram_text. */ \
3089 int yyless_macro_arg = (n); \
3090 YY_LESS_LINENO(yyless_macro_arg);\
3091 gram_text[gram_leng] = (yy_hold_char); \
3092 (yy_c_buf_p) = gram_text + yyless_macro_arg; \
3093 (yy_hold_char) = *(yy_c_buf_p); \
3094 *(yy_c_buf_p) = '\0'; \
3095 gram_leng = yyless_macro_arg; \
3096 } \
3097 while ( 0 )
3098
3099 /* Accessor methods (get/set functions) to struct members. */
3100
3101 /* %if-c-only */
3102 /* %if-reentrant */
3103 /* %endif */
3104
3105 /** Get the current line number.
3106 *
3107 */
3108 int gram_get_lineno (void)
3109 {
3110
3111 return gram_lineno;
3112 }
3113
3114 /** Get the input stream.
3115 *
3116 */
3117 FILE *gram_get_in (void)
3118 {
3119 return gram_in;
3120 }
3121
3122 /** Get the output stream.
3123 *
3124 */
3125 FILE *gram_get_out (void)
3126 {
3127 return gram_out;
3128 }
3129
3130 /** Get the length of the current token.
3131 *
3132 */
3133 int gram_get_leng (void)
3134 {
3135 return gram_leng;
3136 }
3137
3138 /** Get the current token.
3139 *
3140 */
3141
3142 char *gram_get_text (void)
3143 {
3144 return gram_text;
3145 }
3146
3147 /* %if-reentrant */
3148 /* %endif */
3149
3150 /** Set the current line number.
3151 * @param line_number
3152 *
3153 */
3154 void gram_set_lineno (int line_number )
3155 {
3156
3157 gram_lineno = line_number;
3158 }
3159
3160 /** Set the input stream. This does not discard the current
3161 * input buffer.
3162 * @param in_str A readable stream.
3163 *
3164 * @see gram__switch_to_buffer
3165 */
3166 void gram_set_in (FILE * in_str )
3167 {
3168 gram_in = in_str ;
3169 }
3170
3171 void gram_set_out (FILE * out_str )
3172 {
3173 gram_out = out_str ;
3174 }
3175
3176 int gram_get_debug (void)
3177 {
3178 return gram__flex_debug;
3179 }
3180
3181 void gram_set_debug (int bdebug )
3182 {
3183 gram__flex_debug = bdebug ;
3184 }
3185
3186 /* %endif */
3187
3188 /* %if-reentrant */
3189 /* %if-bison-bridge */
3190 /* %endif */
3191 /* %endif if-c-only */
3192
3193 /* %if-c-only */
3194 static int yy_init_globals (void)
3195 {
3196 /* Initialization is the same as for the non-reentrant scanner.
3197 * This function is called from gram_lex_destroy(), so don't allocate here.
3198 */
3199
3200 (yy_buffer_stack) = 0;
3201 (yy_buffer_stack_top) = 0;
3202 (yy_buffer_stack_max) = 0;
3203 (yy_c_buf_p) = (char *) 0;
3204 (yy_init) = 0;
3205 (yy_start) = 0;
3206
3207 /* Defined in main.c */
3208 #ifdef YY_STDINIT
3209 gram_in = stdin;
3210 gram_out = stdout;
3211 #else
3212 gram_in = (FILE *) 0;
3213 gram_out = (FILE *) 0;
3214 #endif
3215
3216 /* For future reference: Set errno on error, since we are called by
3217 * gram_lex_init()
3218 */
3219 return 0;
3220 }
3221 /* %endif */
3222
3223 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
3224 /* gram_lex_destroy is for both reentrant and non-reentrant scanners. */
3225 int gram_lex_destroy (void)
3226 {
3227
3228 /* Pop the buffer stack, destroying each element. */
3229 while(YY_CURRENT_BUFFER){
3230 gram__delete_buffer(YY_CURRENT_BUFFER );
3231 YY_CURRENT_BUFFER_LVALUE = NULL;
3232 gram_pop_buffer_state();
3233 }
3234
3235 /* Destroy the stack itself. */
3236 gram_free((yy_buffer_stack) );
3237 (yy_buffer_stack) = NULL;
3238
3239 /* Reset the globals. This is important in a non-reentrant scanner so the ne xt time
3240 * gram_lex() is called, initialization will occur. */
3241 yy_init_globals( );
3242
3243 /* %if-reentrant */
3244 /* %endif */
3245 return 0;
3246 }
3247 /* %endif */
3248
3249 /*
3250 * Internal utility routines.
3251 */
3252
3253 #ifndef yytext_ptr
3254 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
3255 {
3256 register int i;
3257 for ( i = 0; i < n; ++i )
3258 s1[i] = s2[i];
3259 }
3260 #endif
3261
3262 #ifdef YY_NEED_STRLEN
3263 static int yy_flex_strlen (yyconst char * s )
3264 {
3265 register int n;
3266 for ( n = 0; s[n]; ++n )
3267 ;
3268
3269 return n;
3270 }
3271 #endif
3272
3273 void *gram_alloc (yy_size_t size )
3274 {
3275 return (void *) malloc( size );
3276 }
3277
3278 void *gram_realloc (void * ptr, yy_size_t size )
3279 {
3280 /* The cast to (char *) in the following accommodates both
3281 * implementations that use char* generic pointers, and those
3282 * that use void* generic pointers. It works with the latter
3283 * because both ANSI C and C++ allow castless assignment from
3284 * any pointer type to void*, and deal with argument conversions
3285 * as though doing an assignment.
3286 */
3287 return (void *) realloc( (char *) ptr, size );
3288 }
3289
3290 void gram_free (void * ptr )
3291 {
3292 free( (char *) ptr ); /* see gram_realloc() for (char *) cast */
3293 }
3294
3295 /* %if-tables-serialization definitions */
3296 /* %define-yytables The name for this specific scanner's tables. */
3297 #define YYTABLES_NAME "yytables"
3298 /* %endif */
3299
3300 /* %ok-for-header */
3301
3302 #line 591 "scan-gram.l"
3303
3304
3305
3306 /* Read bytes from FP into buffer BUF of size SIZE. Return the
3307 number of bytes read. Remove '\r' from input, treating \r\n
3308 and isolated \r as \n. */
3309
3310 static size_t
3311 no_cr_read (FILE *fp, char *buf, size_t size)
3312 {
3313 size_t bytes_read = fread (buf, 1, size, fp);
3314 if (bytes_read)
3315 {
3316 char *w = memchr (buf, '\r', bytes_read);
3317 if (w)
3318 {
3319 char const *r = ++w;
3320 char const *lim = buf + bytes_read;
3321
3322 for (;;)
3323 {
3324 /* Found an '\r'. Treat it like '\n', but ignore any
3325 '\n' that immediately follows. */
3326 w[-1] = '\n';
3327 if (r == lim)
3328 {
3329 int ch = getc (fp);
3330 if (ch != '\n' && ungetc (ch, fp) != ch)
3331 break;
3332 }
3333 else if (*r == '\n')
3334 r++;
3335
3336 /* Copy until the next '\r'. */
3337 do
3338 {
3339 if (r == lim)
3340 return w - buf;
3341 }
3342 while ((*w++ = *r++) != '\r');
3343 }
3344
3345 return w - buf;
3346 }
3347 }
3348
3349 return bytes_read;
3350 }
3351
3352
3353
3354 /*------------------------------------------------------.
3355 | Scan NUMBER for a base-BASE integer at location LOC. |
3356 `------------------------------------------------------*/
3357
3358 static unsigned long int
3359 scan_integer (char const *number, int base, location loc)
3360 {
3361 verify (INT_MAX < ULONG_MAX);
3362 unsigned long int num = strtoul (number, NULL, base);
3363
3364 if (INT_MAX < num)
3365 {
3366 complain_at (loc, _("integer out of range: %s"), quote (number));
3367 num = INT_MAX;
3368 }
3369
3370 return num;
3371 }
3372
3373
3374 /*------------------------------------------------------------------.
3375 | Convert universal character name UCN to a single-byte character, |
3376 | and return that character. Return -1 if UCN does not correspond |
3377 | to a single-byte character. |
3378 `------------------------------------------------------------------*/
3379
3380 static int
3381 convert_ucn_to_byte (char const *ucn)
3382 {
3383 verify (UCHAR_MAX <= INT_MAX);
3384 unsigned long int code = strtoul (ucn + 2, NULL, 16);
3385
3386 /* FIXME: Currently we assume Unicode-compatible unibyte characters
3387 on ASCII hosts (i.e., Latin-1 on hosts with 8-bit bytes). On
3388 non-ASCII hosts we support only the portable C character set.
3389 These limitations should be removed once we add support for
3390 multibyte characters. */
3391
3392 if (UCHAR_MAX < code)
3393 return -1;
3394
3395 #if ! ('$' == 0x24 && '@' == 0x40 && '`' == 0x60 && '~' == 0x7e)
3396 {
3397 /* A non-ASCII host. Use CODE to index into a table of the C
3398 basic execution character set, which is guaranteed to exist on
3399 all Standard C platforms. This table also includes '$', '@',
3400 and '`', which are not in the basic execution character set but
3401 which are unibyte characters on all the platforms that we know
3402 about. */
3403 static signed char const table[] =
3404 {
3405 '\0', -1, -1, -1, -1, -1, -1, '\a',
3406 '\b', '\t', '\n', '\v', '\f', '\r', -1, -1,
3407 -1, -1, -1, -1, -1, -1, -1, -1,
3408 -1, -1, -1, -1, -1, -1, -1, -1,
3409 ' ', '!', '"', '#', '$', '%', '&', '\'',
3410 '(', ')', '*', '+', ',', '-', '.', '/',
3411 '0', '1', '2', '3', '4', '5', '6', '7',
3412 '8', '9', ':', ';', '<', '=', '>', '?',
3413 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
3414 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
3415 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
3416 'X', 'Y', 'Z', '[', '\\', ']', '^', '_',
3417 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
3418 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o',
3419 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
3420 'x', 'y', 'z', '{', '|', '}', '~'
3421 };
3422
3423 code = code < sizeof table ? table[code] : -1;
3424 }
3425 #endif
3426
3427 return code;
3428 }
3429
3430
3431 /*----------------------------------------------------------------.
3432 | Handle `#line INT "FILE"'. ARGS has already skipped `#line '. |
3433 `----------------------------------------------------------------*/
3434
3435 static void
3436 handle_syncline (char *args, location loc)
3437 {
3438 char *after_num;
3439 unsigned long int lineno = strtoul (args, &after_num, 10);
3440 char *file = strchr (after_num, '"') + 1;
3441 *strchr (file, '"') = '\0';
3442 if (INT_MAX <= lineno)
3443 {
3444 warn_at (loc, _("line number overflow"));
3445 lineno = INT_MAX;
3446 }
3447 current_file = uniqstr_new (file);
3448 boundary_set (&scanner_cursor, current_file, lineno, 1);
3449 }
3450
3451
3452 /*----------------------------------------------------------------.
3453 | For a token or comment starting at START, report message MSGID, |
3454 | which should say that an end marker was found before |
3455 | the expected TOKEN_END. |
3456 `----------------------------------------------------------------*/
3457
3458 static void
3459 unexpected_end (boundary start, char const *msgid, char const *token_end)
3460 {
3461 location loc;
3462 loc.start = start;
3463 loc.end = scanner_cursor;
3464 complain_at (loc, _(msgid), token_end);
3465 }
3466
3467
3468 /*------------------------------------------------------------------------.
3469 | Report an unexpected EOF in a token or comment starting at START. |
3470 | An end of file was encountered and the expected TOKEN_END was missing. |
3471 `------------------------------------------------------------------------*/
3472
3473 static void
3474 unexpected_eof (boundary start, char const *token_end)
3475 {
3476 unexpected_end (start, N_("missing `%s' at end of file"), token_end);
3477 }
3478
3479
3480 /*----------------------------------------.
3481 | Likewise, but for unexpected newlines. |
3482 `----------------------------------------*/
3483
3484 static void
3485 unexpected_newline (boundary start, char const *token_end)
3486 {
3487 unexpected_end (start, N_("missing `%s' at end of line"), token_end);
3488 }
3489
3490
3491 /*-------------------------.
3492 | Initialize the scanner. |
3493 `-------------------------*/
3494
3495 void
3496 gram_scanner_initialize (void)
3497 {
3498 obstack_init (&obstack_for_string);
3499 }
3500
3501
3502 /*-----------------------------------------------.
3503 | Free all the memory allocated to the scanner. |
3504 `-----------------------------------------------*/
3505
3506 void
3507 gram_scanner_free (void)
3508 {
3509 obstack_free (&obstack_for_string, 0);
3510 /* Reclaim Flex's buffers. */
3511 gram_lex_destroy ();
3512 }
3513
OLDNEW
« no previous file with comments | « bison/src/bison/2.4.1/bison-2.4.1-src/src/scan-gram.h ('k') | bison/src/bison/2.4.1/bison-2.4.1-src/src/scan-gram.l » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698