1 /* A lexical scanner generated by flex */
3 /* Scanner skeleton version:
4 * $Header: /u/mtr/own/CVS/enscript/states/lex.c,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
27 /* Use prototypes in function declarations. */
30 /* The "const" storage-class-modifier is valid. */
33 #else /* ! __cplusplus */
41 #endif /* ! __cplusplus */
60 #define YY_PROTO(proto) proto
62 #define YY_PROTO(proto) ()
65 /* Returned upon end-of-file. */
68 /* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
75 /* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
79 #define BEGIN yy_start = 1 + 2 *
81 /* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
94 #define YY_END_OF_BUFFER_CHAR 0
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
102 extern FILE *yyin, *yyout;
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
108 /* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
112 * if ( condition_holds )
115 * do_something_else();
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
122 /* Return all but the first 'n' matched characters back to the input stream. */
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 YY_RESTORE_YY_MORE_OFFSET \
130 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
131 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
135 #define unput(c) yyunput( c, yytext_ptr )
137 /* The following is because we cannot portably get our hands on size_t
138 * (without autoconf's help, which isn't available because we want
139 * flex-generated scanners to compile on their own).
141 typedef unsigned int yy_size_t;
144 struct yy_buffer_state
148 char *yy_ch_buf; /* input buffer */
149 char *yy_buf_pos; /* current position in input buffer */
151 /* Size of input buffer in bytes, not including room for EOB
154 yy_size_t yy_buf_size;
156 /* Number of characters read into yy_ch_buf, not including EOB
161 /* Whether we "own" the buffer - i.e., we know we created it,
162 * and can realloc() it to grow it, and should free() it to
165 int yy_is_our_buffer;
167 /* Whether this is an "interactive" input source; if so, and
168 * if we're using stdio for input, then we want to use getc()
169 * instead of fread(), to make sure we stop fetching input after
172 int yy_is_interactive;
174 /* Whether we're considered to be at the beginning of a line.
175 * If so, '^' rules will be active on the next match, otherwise
180 /* Whether to try to fill the input buffer when we reach the
185 int yy_buffer_status;
186 #define YY_BUFFER_NEW 0
187 #define YY_BUFFER_NORMAL 1
188 /* When an EOF's been seen but there's still some text to process
189 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
190 * shouldn't try reading from the input source any more. We might
191 * still have a bunch of tokens to match, though, because of
192 * possible backing-up.
194 * When we actually see the EOF, we change the status to "new"
195 * (via yyrestart()), so that the user can continue scanning by
196 * just pointing yyin at a new input file.
198 #define YY_BUFFER_EOF_PENDING 2
201 static YY_BUFFER_STATE yy_current_buffer = 0;
203 /* We provide macros for accessing buffer states in case in the
204 * future we want to put the buffer states in a more general
207 #define YY_CURRENT_BUFFER yy_current_buffer
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
213 static int yy_n_chars; /* number of characters read into yy_ch_buf */
218 /* Points to current character in buffer. */
219 static char *yy_c_buf_p = (char *) 0;
220 static int yy_init = 1; /* whether we need to initialize */
221 static int yy_start = 0; /* start state number */
223 /* Flag which is used to allow yywrap()'s to do buffer switches
224 * instead of setting up a fresh yyin. A bit of a hack ...
226 static int yy_did_buffer_switch_on_eof;
228 void yyrestart YY_PROTO(( FILE *input_file ));
230 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
231 void yy_load_buffer_state YY_PROTO(( void ));
232 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
233 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
234 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
235 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
236 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
238 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
239 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
240 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
242 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
243 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
244 static void yy_flex_free YY_PROTO(( void * ));
246 #define yy_new_buffer yy_create_buffer
248 #define yy_set_interactive(is_interactive) \
250 if ( ! yy_current_buffer ) \
251 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
252 yy_current_buffer->yy_is_interactive = is_interactive; \
255 #define yy_set_bol(at_bol) \
257 if ( ! yy_current_buffer ) \
258 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
259 yy_current_buffer->yy_at_bol = at_bol; \
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
264 typedef unsigned char YY_CHAR;
265 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
266 typedef int yy_state_type;
268 #define yytext_ptr yytext
270 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
271 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
272 static int yy_get_next_buffer YY_PROTO(( void ));
273 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
275 /* Done after the current pattern has been matched and before the
276 * corresponding action - sets up yytext.
278 #define YY_DO_BEFORE_ACTION \
279 yytext_ptr = yy_bp; \
280 yyleng = (int) (yy_cp - yy_bp); \
281 yy_hold_char = *yy_cp; \
285 #define YY_NUM_RULES 39
286 #define YY_END_OF_BUFFER 40
287 static yyconst short int yy_accept[114] =
289 0, 0, 40, 38, 2, 3, 38, 4, 38, 38,
290 38, 38, 38, 38, 38, 7, 36, 38, 38, 38,
291 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
292 37, 37, 38, 24, 37, 27, 0, 0, 33, 29,
293 0, 36, 31, 30, 32, 35, 1, 35, 25, 23,
294 26, 37, 37, 37, 37, 37, 37, 37, 14, 37,
295 37, 37, 37, 37, 37, 28, 5, 0, 35, 37,
296 9, 10, 37, 37, 13, 37, 37, 37, 37, 21,
297 37, 6, 37, 34, 11, 37, 37, 37, 37, 37,
298 37, 37, 8, 37, 15, 37, 37, 18, 20, 22,
300 37, 37, 17, 37, 12, 37, 37, 37, 37, 16,
304 static yyconst int yy_ec[256] =
306 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
307 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
308 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
309 1, 2, 4, 5, 1, 6, 1, 7, 8, 1,
310 1, 9, 10, 1, 11, 12, 13, 14, 14, 14,
311 14, 14, 14, 14, 14, 14, 14, 1, 1, 15,
312 16, 17, 1, 1, 18, 19, 18, 20, 21, 18,
313 22, 18, 23, 18, 18, 18, 18, 24, 18, 18,
314 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
315 1, 25, 1, 1, 18, 1, 26, 27, 28, 29,
317 30, 31, 18, 32, 33, 18, 18, 34, 35, 36,
318 37, 18, 18, 38, 39, 40, 41, 42, 43, 44,
319 18, 18, 1, 45, 1, 1, 1, 1, 1, 1,
320 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
321 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
322 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
323 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
324 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
325 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
326 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
328 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
329 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
330 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
331 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
332 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
336 static yyconst int yy_meta[46] =
338 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
339 1, 1, 1, 3, 1, 1, 1, 3, 3, 3,
340 3, 3, 3, 3, 1, 3, 3, 3, 3, 3,
341 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
345 static yyconst short int yy_base[118] =
347 0, 0, 137, 138, 138, 138, 120, 138, 0, 128,
348 109, 117, 36, 42, 118, 122, 35, 114, 113, 112,
349 0, 106, 102, 92, 17, 87, 92, 85, 95, 90,
350 19, 87, 73, 138, 138, 138, 109, 0, 138, 138,
351 102, 43, 138, 138, 138, 101, 138, 100, 138, 138,
352 138, 0, 91, 92, 69, 71, 69, 70, 0, 79,
353 71, 65, 78, 76, 69, 138, 138, 93, 86, 76,
354 0, 82, 67, 66, 0, 69, 64, 52, 24, 0,
355 58, 138, 67, 138, 0, 54, 55, 50, 49, 46,
356 55, 54, 0, 54, 0, 41, 45, 42, 0, 0,
358 40, 44, 0, 36, 0, 46, 41, 35, 42, 0,
359 27, 0, 138, 64, 67, 60, 70
362 static yyconst short int yy_def[118] =
364 113, 1, 113, 113, 113, 113, 113, 113, 114, 113,
365 115, 113, 113, 113, 113, 113, 113, 113, 113, 113,
366 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
367 116, 116, 113, 113, 113, 113, 113, 117, 113, 113,
368 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
369 113, 116, 116, 116, 116, 116, 116, 116, 116, 116,
370 116, 116, 116, 116, 116, 113, 113, 113, 113, 116,
371 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
372 116, 113, 116, 113, 116, 116, 116, 116, 116, 116,
373 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
375 116, 116, 116, 116, 116, 116, 116, 116, 116, 116,
376 116, 116, 0, 113, 113, 113, 113
379 static yyconst short int yy_nxt[184] =
381 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
382 14, 15, 16, 17, 18, 19, 20, 21, 22, 21,
383 23, 21, 21, 21, 4, 21, 21, 21, 24, 25,
384 26, 21, 27, 28, 21, 29, 21, 30, 31, 21,
385 21, 21, 32, 21, 33, 40, 48, 41, 42, 42,
386 56, 43, 44, 41, 48, 42, 42, 45, 63, 64,
387 57, 90, 52, 91, 35, 112, 35, 37, 37, 37,
388 68, 111, 68, 110, 109, 108, 107, 106, 105, 104,
389 103, 102, 101, 100, 99, 98, 97, 96, 95, 94,
390 93, 92, 89, 88, 87, 86, 85, 84, 83, 69,
392 82, 81, 80, 79, 78, 77, 76, 75, 74, 73,
393 72, 71, 70, 69, 46, 46, 67, 66, 65, 62,
394 61, 60, 59, 58, 55, 54, 53, 51, 50, 49,
395 47, 46, 39, 38, 36, 34, 113, 3, 113, 113,
396 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
397 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
398 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
399 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
403 static yyconst short int yy_chk[184] =
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 13, 17, 13, 17, 13,
410 25, 13, 14, 14, 42, 14, 42, 14, 31, 31,
411 25, 79, 116, 79, 114, 111, 114, 115, 115, 115,
412 117, 109, 117, 108, 107, 106, 104, 102, 101, 98,
413 97, 96, 94, 92, 91, 90, 89, 88, 87, 86,
414 83, 81, 78, 77, 76, 74, 73, 72, 70, 69,
416 68, 65, 64, 63, 62, 61, 60, 58, 57, 56,
417 55, 54, 53, 48, 46, 41, 37, 33, 32, 30,
418 29, 28, 27, 26, 24, 23, 22, 20, 19, 18,
419 16, 15, 12, 11, 10, 7, 3, 113, 113, 113,
420 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
421 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
422 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
423 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
427 static yy_state_type yy_last_accepting_state;
428 static char *yy_last_accepting_cpos;
430 /* The intent behind this definition is that it'll catch
431 * any uses of REJECT which flex missed.
433 #define REJECT reject_used_but_not_detected
434 #define yymore() yymore_used_but_not_detected
435 #define YY_MORE_ADJ 0
436 #define YY_RESTORE_YY_MORE_OFFSET
443 * Copyright (c) 1997-1998 Markku Rossi.
445 * Author: Markku Rossi <mtr@iki.fi>
449 * This file is part of GNU Enscript.
451 * Enscript is free software: you can redistribute it and/or modify
452 * it under the terms of the GNU General Public License as published by
453 * the Free Software Foundation, either version 3 of the License, or
454 * (at your option) any later version.
456 * Enscript is distributed in the hope that it will be useful,
457 * but WITHOUT ANY WARRANTY; without even the implied warranty of
458 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
459 * GNU General Public License for more details.
461 * You should have received a copy of the GNU General Public License
462 * along with Enscript. If not, see <http://www.gnu.org/licenses/>.
466 * $Id: lex.c,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
472 static void eat_comment ();
473 static char *read_string ___P ((unsigned int *len_return));
474 static void read_regexp ___P ((Node *node));
477 /* Macros after this point can all be overridden by user definitions in
481 #ifndef YY_SKIP_YYWRAP
483 extern "C" int yywrap YY_PROTO(( void ));
485 extern int yywrap YY_PROTO(( void ));
490 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
494 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
497 #ifdef YY_NEED_STRLEN
498 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
503 static int yyinput YY_PROTO(( void ));
505 static int input YY_PROTO(( void ));
510 static int yy_start_stack_ptr = 0;
511 static int yy_start_stack_depth = 0;
512 static int *yy_start_stack = 0;
513 #ifndef YY_NO_PUSH_STATE
514 static void yy_push_state YY_PROTO(( int new_state ));
516 #ifndef YY_NO_POP_STATE
517 static void yy_pop_state YY_PROTO(( void ));
519 #ifndef YY_NO_TOP_STATE
520 static int yy_top_state YY_PROTO(( void ));
524 #define YY_NO_PUSH_STATE 1
525 #define YY_NO_POP_STATE 1
526 #define YY_NO_TOP_STATE 1
529 #ifdef YY_MALLOC_DECL
537 /* Just try to get by without declaring the routines. This will fail
538 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
539 * or sizeof(void*) != sizeof(int).
544 /* Amount of stuff to slurp up with each read. */
545 #ifndef YY_READ_BUF_SIZE
546 #define YY_READ_BUF_SIZE 8192
549 /* Copy whatever the last rule matched to the standard output. */
552 /* This used to be an fputs(), but since the string might contain NUL's,
553 * we now use fwrite().
555 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
558 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
559 * is returned in "result".
562 #define YY_INPUT(buf,result,max_size) \
563 if ( yy_current_buffer->yy_is_interactive ) \
566 for ( n = 0; n < max_size && \
567 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
570 buf[n++] = (char) c; \
571 if ( c == EOF && ferror( yyin ) ) \
572 YY_FATAL_ERROR( "input in flex scanner failed" ); \
575 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
576 && ferror( yyin ) ) \
577 YY_FATAL_ERROR( "input in flex scanner failed" );
580 /* No semi-colon after return; correct usage is to write "yyterminate();" -
581 * we don't want an extra ';' after the "return" because that will cause
582 * some compilers to complain about unreachable statements.
585 #define yyterminate() return YY_NULL
588 /* Number of entries by which start-condition stack grows. */
589 #ifndef YY_START_STACK_INCR
590 #define YY_START_STACK_INCR 25
593 /* Report a fatal error. */
594 #ifndef YY_FATAL_ERROR
595 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
598 /* Default declaration of generated scanner - a define so the user can
599 * easily add parameters.
602 #define YY_DECL int yylex YY_PROTO(( void ))
605 /* Code executed at the beginning of each rule, after yytext and yyleng
608 #ifndef YY_USER_ACTION
609 #define YY_USER_ACTION
612 /* Code executed at the end of each rule. */
614 #define YY_BREAK break;
617 #define YY_RULE_SETUP \
622 register yy_state_type yy_current_state;
623 register char *yy_cp, *yy_bp;
640 yy_start = 1; /* first start state */
648 if ( ! yy_current_buffer )
650 yy_create_buffer( yyin, YY_BUF_SIZE );
652 yy_load_buffer_state();
655 while ( 1 ) /* loops until end-of-file is reached */
659 /* Support of yytext. */
660 *yy_cp = yy_hold_char;
662 /* yy_bp points to the position in yy_ch_buf of the start of
667 yy_current_state = yy_start;
671 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
672 if ( yy_accept[yy_current_state] )
674 yy_last_accepting_state = yy_current_state;
675 yy_last_accepting_cpos = yy_cp;
677 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
679 yy_current_state = (int) yy_def[yy_current_state];
680 if ( yy_current_state >= 114 )
681 yy_c = yy_meta[(unsigned int) yy_c];
683 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
686 while ( yy_base[yy_current_state] != 138 );
689 yy_act = yy_accept[yy_current_state];
691 { /* have to back up */
692 yy_cp = yy_last_accepting_cpos;
693 yy_current_state = yy_last_accepting_state;
694 yy_act = yy_accept[yy_current_state];
700 do_action: /* This label is used only to access EOF actions. */
704 { /* beginning of action switch */
705 case 0: /* must back up */
706 /* undo the effects of YY_DO_BEFORE_ACTION */
707 *yy_cp = yy_hold_char;
708 yy_cp = yy_last_accepting_cpos;
709 yy_current_state = yy_last_accepting_state;
730 { yylval.node = node_alloc (nSTRING);
731 yylval.node->u.str.data
732 = read_string (&yylval.node->u.str.len);
739 { yylval.node = node_alloc (nINTEGER);
740 yylval.node->u.integer = yytext[1];
747 { yylval.node = node_alloc (nINTEGER);
751 yylval.node->u.integer = '\n';
755 yylval.node->u.integer = '\t';
759 yylval.node->u.integer = '\v';
763 yylval.node->u.integer = '\b';
767 yylval.node->u.integer = '\r';
771 yylval.node->u.integer = '\f';
775 yylval.node->u.integer = '\a';
779 yylval.node->u.integer = yytext[2];
789 { yylval.node = node_alloc (nREGEXP);
790 read_regexp (yylval.node);
837 { return tNAMERULES; }
852 { return tSTARTRULES; }
902 { return tPLUSPLUS; }
907 { return tMINUSMINUS; }
912 { return tADDASSIGN; }
917 { return tSUBASSIGN; }
922 { return tMULASSIGN; }
927 { return tDIVASSIGN; }
932 { yylval.node = node_alloc (nREAL);
933 yylval.node->u.real = atof (yytext);
940 { yylval.node = node_alloc (nINTEGER);
941 yylval.node->u.integer = atoi (yytext);
948 { yylval.node = node_alloc (nSYMBOL);
949 yylval.node->u.sym = xstrdup (yytext);
956 { return yytext[0]; }
964 case YY_STATE_EOF(INITIAL):
967 case YY_END_OF_BUFFER:
969 /* Amount of text matched not including the EOB char. */
970 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
972 /* Undo the effects of YY_DO_BEFORE_ACTION. */
973 *yy_cp = yy_hold_char;
974 YY_RESTORE_YY_MORE_OFFSET
976 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
978 /* We're scanning a new file or input source. It's
979 * possible that this happened because the user
980 * just pointed yyin at a new source and called
981 * yylex(). If so, then we have to assure
982 * consistency between yy_current_buffer and our
983 * globals. Here is the right place to do so, because
984 * this is the first action (other than possibly a
985 * back-up) that will match for the new input source.
987 yy_n_chars = yy_current_buffer->yy_n_chars;
988 yy_current_buffer->yy_input_file = yyin;
989 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
992 /* Note that here we test for yy_c_buf_p "<=" to the position
993 * of the first EOB in the buffer, since yy_c_buf_p will
994 * already have been incremented past the NUL character
995 * (since all states make transitions on EOB to the
996 * end-of-buffer state). Contrast this with the test
999 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1000 { /* This was really a NUL. */
1001 yy_state_type yy_next_state;
1003 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1005 yy_current_state = yy_get_previous_state();
1007 /* Okay, we're now positioned to make the NUL
1008 * transition. We couldn't have
1009 * yy_get_previous_state() go ahead and do it
1010 * for us because it doesn't know how to deal
1011 * with the possibility of jamming (and we don't
1012 * want to build jamming into it because then it
1013 * will run more slowly).
1016 yy_next_state = yy_try_NUL_trans( yy_current_state );
1018 yy_bp = yytext_ptr + YY_MORE_ADJ;
1020 if ( yy_next_state )
1022 /* Consume the NUL. */
1023 yy_cp = ++yy_c_buf_p;
1024 yy_current_state = yy_next_state;
1031 goto yy_find_action;
1035 else switch ( yy_get_next_buffer() )
1037 case EOB_ACT_END_OF_FILE:
1039 yy_did_buffer_switch_on_eof = 0;
1043 /* Note: because we've taken care in
1044 * yy_get_next_buffer() to have set up
1045 * yytext, we can now set up
1046 * yy_c_buf_p so that if some total
1047 * hoser (like flex itself) wants to
1048 * call the scanner after we return the
1049 * YY_NULL, it'll still work - another
1050 * YY_NULL will get returned.
1052 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1054 yy_act = YY_STATE_EOF(YY_START);
1060 if ( ! yy_did_buffer_switch_on_eof )
1066 case EOB_ACT_CONTINUE_SCAN:
1068 yytext_ptr + yy_amount_of_matched_text;
1070 yy_current_state = yy_get_previous_state();
1073 yy_bp = yytext_ptr + YY_MORE_ADJ;
1076 case EOB_ACT_LAST_MATCH:
1078 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1080 yy_current_state = yy_get_previous_state();
1083 yy_bp = yytext_ptr + YY_MORE_ADJ;
1084 goto yy_find_action;
1091 "fatal flex scanner internal error--no action found" );
1092 } /* end of action switch */
1093 } /* end of scanning one token */
1094 } /* end of yylex */
1097 /* yy_get_next_buffer - try to read in a new buffer
1099 * Returns a code representing an action:
1100 * EOB_ACT_LAST_MATCH -
1101 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1102 * EOB_ACT_END_OF_FILE - end of file
1105 static int yy_get_next_buffer()
1107 register char *dest = yy_current_buffer->yy_ch_buf;
1108 register char *source = yytext_ptr;
1109 register int number_to_move, i;
1112 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1114 "fatal flex scanner internal error--end of buffer missed" );
1116 if ( yy_current_buffer->yy_fill_buffer == 0 )
1117 { /* Don't try to fill the buffer, so this is an EOF. */
1118 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1120 /* We matched a single character, the EOB, so
1121 * treat this as a final EOF.
1123 return EOB_ACT_END_OF_FILE;
1128 /* We matched some text prior to the EOB, first
1131 return EOB_ACT_LAST_MATCH;
1135 /* Try to read more data. */
1137 /* First move last chars to start of buffer. */
1138 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1140 for ( i = 0; i < number_to_move; ++i )
1141 *(dest++) = *(source++);
1143 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1144 /* don't do the read, it's not guaranteed to return an EOF,
1147 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1152 yy_current_buffer->yy_buf_size - number_to_move - 1;
1154 while ( num_to_read <= 0 )
1155 { /* Not enough room in the buffer - grow it. */
1156 #ifdef YY_USES_REJECT
1158 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1161 /* just a shorter name for the current buffer */
1162 YY_BUFFER_STATE b = yy_current_buffer;
1164 int yy_c_buf_p_offset =
1165 (int) (yy_c_buf_p - b->yy_ch_buf);
1167 if ( b->yy_is_our_buffer )
1169 int new_size = b->yy_buf_size * 2;
1171 if ( new_size <= 0 )
1172 b->yy_buf_size += b->yy_buf_size / 8;
1174 b->yy_buf_size *= 2;
1176 b->yy_ch_buf = (char *)
1177 /* Include room in for 2 EOB chars. */
1178 yy_flex_realloc( (void *) b->yy_ch_buf,
1179 b->yy_buf_size + 2 );
1182 /* Can't grow it, we don't own it. */
1185 if ( ! b->yy_ch_buf )
1187 "fatal error - scanner input buffer overflow" );
1189 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1191 num_to_read = yy_current_buffer->yy_buf_size -
1196 if ( num_to_read > YY_READ_BUF_SIZE )
1197 num_to_read = YY_READ_BUF_SIZE;
1199 /* Read in more data. */
1200 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1201 yy_n_chars, num_to_read );
1203 yy_current_buffer->yy_n_chars = yy_n_chars;
1206 if ( yy_n_chars == 0 )
1208 if ( number_to_move == YY_MORE_ADJ )
1210 ret_val = EOB_ACT_END_OF_FILE;
1216 ret_val = EOB_ACT_LAST_MATCH;
1217 yy_current_buffer->yy_buffer_status =
1218 YY_BUFFER_EOF_PENDING;
1223 ret_val = EOB_ACT_CONTINUE_SCAN;
1225 yy_n_chars += number_to_move;
1226 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1227 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1229 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1235 /* yy_get_previous_state - get the state just before the EOB char was reached */
1237 static yy_state_type yy_get_previous_state()
1239 register yy_state_type yy_current_state;
1240 register char *yy_cp;
1242 yy_current_state = yy_start;
1244 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1246 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1247 if ( yy_accept[yy_current_state] )
1249 yy_last_accepting_state = yy_current_state;
1250 yy_last_accepting_cpos = yy_cp;
1252 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1254 yy_current_state = (int) yy_def[yy_current_state];
1255 if ( yy_current_state >= 114 )
1256 yy_c = yy_meta[(unsigned int) yy_c];
1258 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1261 return yy_current_state;
1265 /* yy_try_NUL_trans - try to make a transition on the NUL character
1268 * next_state = yy_try_NUL_trans( current_state );
1271 #ifdef YY_USE_PROTOS
1272 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1274 static yy_state_type yy_try_NUL_trans( yy_current_state )
1275 yy_state_type yy_current_state;
1278 register int yy_is_jam;
1279 register char *yy_cp = yy_c_buf_p;
1281 register YY_CHAR yy_c = 1;
1282 if ( yy_accept[yy_current_state] )
1284 yy_last_accepting_state = yy_current_state;
1285 yy_last_accepting_cpos = yy_cp;
1287 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1289 yy_current_state = (int) yy_def[yy_current_state];
1290 if ( yy_current_state >= 114 )
1291 yy_c = yy_meta[(unsigned int) yy_c];
1293 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1294 yy_is_jam = (yy_current_state == 113);
1296 return yy_is_jam ? 0 : yy_current_state;
1301 #ifdef YY_USE_PROTOS
1302 static void yyunput( int c, register char *yy_bp )
1304 static void yyunput( c, yy_bp )
1306 register char *yy_bp;
1309 register char *yy_cp = yy_c_buf_p;
1311 /* undo effects of setting up yytext */
1312 *yy_cp = yy_hold_char;
1314 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1315 { /* need to shift things up to make room */
1316 /* +2 for EOB chars. */
1317 register int number_to_move = yy_n_chars + 2;
1318 register char *dest = &yy_current_buffer->yy_ch_buf[
1319 yy_current_buffer->yy_buf_size + 2];
1320 register char *source =
1321 &yy_current_buffer->yy_ch_buf[number_to_move];
1323 while ( source > yy_current_buffer->yy_ch_buf )
1324 *--dest = *--source;
1326 yy_cp += (int) (dest - source);
1327 yy_bp += (int) (dest - source);
1328 yy_current_buffer->yy_n_chars =
1329 yy_n_chars = yy_current_buffer->yy_buf_size;
1331 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1332 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1335 *--yy_cp = (char) c;
1339 yy_hold_char = *yy_cp;
1342 #endif /* ifndef YY_NO_UNPUT */
1346 static int yyinput()
1353 *yy_c_buf_p = yy_hold_char;
1355 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1357 /* yy_c_buf_p now points to the character we want to return.
1358 * If this occurs *before* the EOB characters, then it's a
1359 * valid NUL; if not, then we've hit the end of the buffer.
1361 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1362 /* This was really a NUL. */
1366 { /* need more input */
1367 int offset = yy_c_buf_p - yytext_ptr;
1370 switch ( yy_get_next_buffer() )
1372 case EOB_ACT_LAST_MATCH:
1373 /* This happens because yy_g_n_b()
1374 * sees that we've accumulated a
1375 * token and flags that we need to
1376 * try matching the token before
1377 * proceeding. But for input(),
1378 * there's no matching to consider.
1379 * So convert the EOB_ACT_LAST_MATCH
1380 * to EOB_ACT_END_OF_FILE.
1383 /* Reset buffer status. */
1388 case EOB_ACT_END_OF_FILE:
1393 if ( ! yy_did_buffer_switch_on_eof )
1402 case EOB_ACT_CONTINUE_SCAN:
1403 yy_c_buf_p = yytext_ptr + offset;
1409 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1410 *yy_c_buf_p = '\0'; /* preserve yytext */
1411 yy_hold_char = *++yy_c_buf_p;
1418 #ifdef YY_USE_PROTOS
1419 void yyrestart( FILE *input_file )
1421 void yyrestart( input_file )
1425 if ( ! yy_current_buffer )
1426 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1428 yy_init_buffer( yy_current_buffer, input_file );
1429 yy_load_buffer_state();
1433 #ifdef YY_USE_PROTOS
1434 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1436 void yy_switch_to_buffer( new_buffer )
1437 YY_BUFFER_STATE new_buffer;
1440 if ( yy_current_buffer == new_buffer )
1443 if ( yy_current_buffer )
1445 /* Flush out information for old buffer. */
1446 *yy_c_buf_p = yy_hold_char;
1447 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1448 yy_current_buffer->yy_n_chars = yy_n_chars;
1451 yy_current_buffer = new_buffer;
1452 yy_load_buffer_state();
1454 /* We don't actually know whether we did this switch during
1455 * EOF (yywrap()) processing, but the only time this flag
1456 * is looked at is after yywrap() is called, so it's safe
1457 * to go ahead and always set it.
1459 yy_did_buffer_switch_on_eof = 1;
1463 #ifdef YY_USE_PROTOS
1464 void yy_load_buffer_state( void )
1466 void yy_load_buffer_state()
1469 yy_n_chars = yy_current_buffer->yy_n_chars;
1470 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1471 yyin = yy_current_buffer->yy_input_file;
1472 yy_hold_char = *yy_c_buf_p;
1476 #ifdef YY_USE_PROTOS
1477 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1479 YY_BUFFER_STATE yy_create_buffer( file, size )
1486 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1488 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1490 b->yy_buf_size = size;
1492 /* yy_ch_buf has to be 2 characters longer than the size given because
1493 * we need to put in 2 end-of-buffer characters.
1495 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1496 if ( ! b->yy_ch_buf )
1497 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1499 b->yy_is_our_buffer = 1;
1501 yy_init_buffer( b, file );
1507 #ifdef YY_USE_PROTOS
1508 void yy_delete_buffer( YY_BUFFER_STATE b )
1510 void yy_delete_buffer( b )
1517 if ( b == yy_current_buffer )
1518 yy_current_buffer = (YY_BUFFER_STATE) 0;
1520 if ( b->yy_is_our_buffer )
1521 yy_flex_free( (void *) b->yy_ch_buf );
1523 yy_flex_free( (void *) b );
1527 #ifndef YY_ALWAYS_INTERACTIVE
1528 #ifndef YY_NEVER_INTERACTIVE
1529 extern int isatty YY_PROTO(( int ));
1533 #ifdef YY_USE_PROTOS
1534 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1536 void yy_init_buffer( b, file )
1543 yy_flush_buffer( b );
1545 b->yy_input_file = file;
1546 b->yy_fill_buffer = 1;
1548 #if YY_ALWAYS_INTERACTIVE
1549 b->yy_is_interactive = 1;
1551 #if YY_NEVER_INTERACTIVE
1552 b->yy_is_interactive = 0;
1554 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1560 #ifdef YY_USE_PROTOS
1561 void yy_flush_buffer( YY_BUFFER_STATE b )
1563 void yy_flush_buffer( b )
1573 /* We always need two end-of-buffer characters. The first causes
1574 * a transition to the end-of-buffer state. The second causes
1575 * a jam in that state.
1577 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1578 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1580 b->yy_buf_pos = &b->yy_ch_buf[0];
1583 b->yy_buffer_status = YY_BUFFER_NEW;
1585 if ( b == yy_current_buffer )
1586 yy_load_buffer_state();
1590 #ifndef YY_NO_SCAN_BUFFER
1591 #ifdef YY_USE_PROTOS
1592 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1594 YY_BUFFER_STATE yy_scan_buffer( base, size )
1602 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1603 base[size-1] != YY_END_OF_BUFFER_CHAR )
1604 /* They forgot to leave room for the EOB's. */
1607 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1609 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1611 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1612 b->yy_buf_pos = b->yy_ch_buf = base;
1613 b->yy_is_our_buffer = 0;
1614 b->yy_input_file = 0;
1615 b->yy_n_chars = b->yy_buf_size;
1616 b->yy_is_interactive = 0;
1618 b->yy_fill_buffer = 0;
1619 b->yy_buffer_status = YY_BUFFER_NEW;
1621 yy_switch_to_buffer( b );
1628 #ifndef YY_NO_SCAN_STRING
1629 #ifdef YY_USE_PROTOS
1630 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1632 YY_BUFFER_STATE yy_scan_string( yy_str )
1633 yyconst char *yy_str;
1637 for ( len = 0; yy_str[len]; ++len )
1640 return yy_scan_bytes( yy_str, len );
1645 #ifndef YY_NO_SCAN_BYTES
1646 #ifdef YY_USE_PROTOS
1647 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1649 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1650 yyconst char *bytes;
1659 /* Get memory for full buffer, including space for trailing EOB's. */
1661 buf = (char *) yy_flex_alloc( n );
1663 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1665 for ( i = 0; i < len; ++i )
1668 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1670 b = yy_scan_buffer( buf, n );
1672 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1674 /* It's okay to grow etc. this buffer, and we should throw it
1675 * away when we're done.
1677 b->yy_is_our_buffer = 1;
1684 #ifndef YY_NO_PUSH_STATE
1685 #ifdef YY_USE_PROTOS
1686 static void yy_push_state( int new_state )
1688 static void yy_push_state( new_state )
1692 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1696 yy_start_stack_depth += YY_START_STACK_INCR;
1697 new_size = yy_start_stack_depth * sizeof( int );
1699 if ( ! yy_start_stack )
1700 yy_start_stack = (int *) yy_flex_alloc( new_size );
1703 yy_start_stack = (int *) yy_flex_realloc(
1704 (void *) yy_start_stack, new_size );
1706 if ( ! yy_start_stack )
1708 "out of memory expanding start-condition stack" );
1711 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1718 #ifndef YY_NO_POP_STATE
1719 static void yy_pop_state()
1721 if ( --yy_start_stack_ptr < 0 )
1722 YY_FATAL_ERROR( "start-condition stack underflow" );
1724 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1729 #ifndef YY_NO_TOP_STATE
1730 static int yy_top_state()
1732 return yy_start_stack[yy_start_stack_ptr - 1];
1736 #ifndef YY_EXIT_FAILURE
1737 #define YY_EXIT_FAILURE 2
1740 #ifdef YY_USE_PROTOS
1741 static void yy_fatal_error( yyconst char msg[] )
1743 static void yy_fatal_error( msg )
1747 (void) fprintf( stderr, "%s\n", msg );
1748 exit( YY_EXIT_FAILURE );
1753 /* Redefine yyless() so it works in section 3 code. */
1759 /* Undo effects of setting up yytext. */ \
1760 yytext[yyleng] = yy_hold_char; \
1761 yy_c_buf_p = yytext + n; \
1762 yy_hold_char = *yy_c_buf_p; \
1763 *yy_c_buf_p = '\0'; \
1769 /* Internal utility routines. */
1772 #ifdef YY_USE_PROTOS
1773 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1775 static void yy_flex_strncpy( s1, s2, n )
1782 for ( i = 0; i < n; ++i )
1787 #ifdef YY_NEED_STRLEN
1788 #ifdef YY_USE_PROTOS
1789 static int yy_flex_strlen( yyconst char *s )
1791 static int yy_flex_strlen( s )
1796 for ( n = 0; s[n]; ++n )
1804 #ifdef YY_USE_PROTOS
1805 static void *yy_flex_alloc( yy_size_t size )
1807 static void *yy_flex_alloc( size )
1811 return (void *) malloc( size );
1814 #ifdef YY_USE_PROTOS
1815 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1817 static void *yy_flex_realloc( ptr, size )
1822 /* The cast to (char *) in the following accommodates both
1823 * implementations that use char* generic pointers, and those
1824 * that use void* generic pointers. It works with the latter
1825 * because both ANSI C and C++ allow castless assignment from
1826 * any pointer type to void*, and deal with argument conversions
1827 * as though doing an assignment.
1829 return (void *) realloc( (char *) ptr, size );
1832 #ifdef YY_USE_PROTOS
1833 static void yy_flex_free( void *ptr )
1835 static void yy_flex_free( ptr )
1857 while ((c = input ()) != EOF)
1870 yyerror (_("error: EOF in comment"));
1876 yyerror (_("error: EOF in comment"));
1887 read_string (len_return)
1888 unsigned int *len_return;
1907 yyerror (_("error: EOF in string constant"));
1948 goto unexpected_eof;
1957 for (i = 0; i < 3; i++)
1960 if ('0' <= ch && ch <= '7')
1961 val = val * 8 + ch - '0';
1975 if (bufpos >= buflen)
1978 buf = (char *) xrealloc (buf, buflen);
1985 buf2 = (char *) xmalloc (bufpos + 1);
1986 memcpy (buf2, buf, bufpos);
1987 buf2[bufpos] = '\0';
1990 *len_return = bufpos;
2014 yyerror (_("error: EOF in regular expression"));
2054 goto unexpected_eof;
2063 for (i = 0; i < 3; i++)
2066 if ('0' <= ch && ch <= '7')
2067 val = val * 8 + ch - '0';
2078 /* Pass it through. */
2087 if (bufpos >= buflen)
2090 buf = (char *) xrealloc (buf, buflen);
2097 /* Possible options. */
2105 /* Case-insensitive regular expression. */
2106 node->u.re.flags |= fRE_CASE_INSENSITIVE;
2110 /* Unknown option => this belongs to the next token. */
2117 buf2 = (char *) xmalloc (bufpos + 1);
2118 memcpy (buf2, buf, bufpos);
2119 buf2[bufpos] = '\0';
2122 node->u.re.data = buf2;
2123 node->u.re.len = bufpos;