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 * This program 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 2, or (at your option)
456 * This program 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 this program; see the file COPYING. If not, write to
463 * the Free Software Foundation, 51 Franklin Street, Fifth Floor,
464 * Boston, MA 02110-1301, USA.
468 * $Id: lex.c,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
474 static void eat_comment ();
475 static char *read_string ___P ((unsigned int *len_return));
476 static void read_regexp ___P ((Node *node));
479 /* Macros after this point can all be overridden by user definitions in
483 #ifndef YY_SKIP_YYWRAP
485 extern "C" int yywrap YY_PROTO(( void ));
487 extern int yywrap YY_PROTO(( void ));
492 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
496 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
499 #ifdef YY_NEED_STRLEN
500 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
505 static int yyinput YY_PROTO(( void ));
507 static int input YY_PROTO(( void ));
512 static int yy_start_stack_ptr = 0;
513 static int yy_start_stack_depth = 0;
514 static int *yy_start_stack = 0;
515 #ifndef YY_NO_PUSH_STATE
516 static void yy_push_state YY_PROTO(( int new_state ));
518 #ifndef YY_NO_POP_STATE
519 static void yy_pop_state YY_PROTO(( void ));
521 #ifndef YY_NO_TOP_STATE
522 static int yy_top_state YY_PROTO(( void ));
526 #define YY_NO_PUSH_STATE 1
527 #define YY_NO_POP_STATE 1
528 #define YY_NO_TOP_STATE 1
531 #ifdef YY_MALLOC_DECL
539 /* Just try to get by without declaring the routines. This will fail
540 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
541 * or sizeof(void*) != sizeof(int).
546 /* Amount of stuff to slurp up with each read. */
547 #ifndef YY_READ_BUF_SIZE
548 #define YY_READ_BUF_SIZE 8192
551 /* Copy whatever the last rule matched to the standard output. */
554 /* This used to be an fputs(), but since the string might contain NUL's,
555 * we now use fwrite().
557 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
560 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
561 * is returned in "result".
564 #define YY_INPUT(buf,result,max_size) \
565 if ( yy_current_buffer->yy_is_interactive ) \
568 for ( n = 0; n < max_size && \
569 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
572 buf[n++] = (char) c; \
573 if ( c == EOF && ferror( yyin ) ) \
574 YY_FATAL_ERROR( "input in flex scanner failed" ); \
577 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
578 && ferror( yyin ) ) \
579 YY_FATAL_ERROR( "input in flex scanner failed" );
582 /* No semi-colon after return; correct usage is to write "yyterminate();" -
583 * we don't want an extra ';' after the "return" because that will cause
584 * some compilers to complain about unreachable statements.
587 #define yyterminate() return YY_NULL
590 /* Number of entries by which start-condition stack grows. */
591 #ifndef YY_START_STACK_INCR
592 #define YY_START_STACK_INCR 25
595 /* Report a fatal error. */
596 #ifndef YY_FATAL_ERROR
597 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
600 /* Default declaration of generated scanner - a define so the user can
601 * easily add parameters.
604 #define YY_DECL int yylex YY_PROTO(( void ))
607 /* Code executed at the beginning of each rule, after yytext and yyleng
610 #ifndef YY_USER_ACTION
611 #define YY_USER_ACTION
614 /* Code executed at the end of each rule. */
616 #define YY_BREAK break;
619 #define YY_RULE_SETUP \
624 register yy_state_type yy_current_state;
625 register char *yy_cp, *yy_bp;
642 yy_start = 1; /* first start state */
650 if ( ! yy_current_buffer )
652 yy_create_buffer( yyin, YY_BUF_SIZE );
654 yy_load_buffer_state();
657 while ( 1 ) /* loops until end-of-file is reached */
661 /* Support of yytext. */
662 *yy_cp = yy_hold_char;
664 /* yy_bp points to the position in yy_ch_buf of the start of
669 yy_current_state = yy_start;
673 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
674 if ( yy_accept[yy_current_state] )
676 yy_last_accepting_state = yy_current_state;
677 yy_last_accepting_cpos = yy_cp;
679 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
681 yy_current_state = (int) yy_def[yy_current_state];
682 if ( yy_current_state >= 114 )
683 yy_c = yy_meta[(unsigned int) yy_c];
685 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
688 while ( yy_base[yy_current_state] != 138 );
691 yy_act = yy_accept[yy_current_state];
693 { /* have to back up */
694 yy_cp = yy_last_accepting_cpos;
695 yy_current_state = yy_last_accepting_state;
696 yy_act = yy_accept[yy_current_state];
702 do_action: /* This label is used only to access EOF actions. */
706 { /* beginning of action switch */
707 case 0: /* must back up */
708 /* undo the effects of YY_DO_BEFORE_ACTION */
709 *yy_cp = yy_hold_char;
710 yy_cp = yy_last_accepting_cpos;
711 yy_current_state = yy_last_accepting_state;
732 { yylval.node = node_alloc (nSTRING);
733 yylval.node->u.str.data
734 = read_string (&yylval.node->u.str.len);
741 { yylval.node = node_alloc (nINTEGER);
742 yylval.node->u.integer = yytext[1];
749 { yylval.node = node_alloc (nINTEGER);
753 yylval.node->u.integer = '\n';
757 yylval.node->u.integer = '\t';
761 yylval.node->u.integer = '\v';
765 yylval.node->u.integer = '\b';
769 yylval.node->u.integer = '\r';
773 yylval.node->u.integer = '\f';
777 yylval.node->u.integer = '\a';
781 yylval.node->u.integer = yytext[2];
791 { yylval.node = node_alloc (nREGEXP);
792 read_regexp (yylval.node);
839 { return tNAMERULES; }
854 { return tSTARTRULES; }
904 { return tPLUSPLUS; }
909 { return tMINUSMINUS; }
914 { return tADDASSIGN; }
919 { return tSUBASSIGN; }
924 { return tMULASSIGN; }
929 { return tDIVASSIGN; }
934 { yylval.node = node_alloc (nREAL);
935 yylval.node->u.real = atof (yytext);
942 { yylval.node = node_alloc (nINTEGER);
943 yylval.node->u.integer = atoi (yytext);
950 { yylval.node = node_alloc (nSYMBOL);
951 yylval.node->u.sym = xstrdup (yytext);
958 { return yytext[0]; }
966 case YY_STATE_EOF(INITIAL):
969 case YY_END_OF_BUFFER:
971 /* Amount of text matched not including the EOB char. */
972 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
974 /* Undo the effects of YY_DO_BEFORE_ACTION. */
975 *yy_cp = yy_hold_char;
976 YY_RESTORE_YY_MORE_OFFSET
978 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
980 /* We're scanning a new file or input source. It's
981 * possible that this happened because the user
982 * just pointed yyin at a new source and called
983 * yylex(). If so, then we have to assure
984 * consistency between yy_current_buffer and our
985 * globals. Here is the right place to do so, because
986 * this is the first action (other than possibly a
987 * back-up) that will match for the new input source.
989 yy_n_chars = yy_current_buffer->yy_n_chars;
990 yy_current_buffer->yy_input_file = yyin;
991 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
994 /* Note that here we test for yy_c_buf_p "<=" to the position
995 * of the first EOB in the buffer, since yy_c_buf_p will
996 * already have been incremented past the NUL character
997 * (since all states make transitions on EOB to the
998 * end-of-buffer state). Contrast this with the test
1001 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1002 { /* This was really a NUL. */
1003 yy_state_type yy_next_state;
1005 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1007 yy_current_state = yy_get_previous_state();
1009 /* Okay, we're now positioned to make the NUL
1010 * transition. We couldn't have
1011 * yy_get_previous_state() go ahead and do it
1012 * for us because it doesn't know how to deal
1013 * with the possibility of jamming (and we don't
1014 * want to build jamming into it because then it
1015 * will run more slowly).
1018 yy_next_state = yy_try_NUL_trans( yy_current_state );
1020 yy_bp = yytext_ptr + YY_MORE_ADJ;
1022 if ( yy_next_state )
1024 /* Consume the NUL. */
1025 yy_cp = ++yy_c_buf_p;
1026 yy_current_state = yy_next_state;
1033 goto yy_find_action;
1037 else switch ( yy_get_next_buffer() )
1039 case EOB_ACT_END_OF_FILE:
1041 yy_did_buffer_switch_on_eof = 0;
1045 /* Note: because we've taken care in
1046 * yy_get_next_buffer() to have set up
1047 * yytext, we can now set up
1048 * yy_c_buf_p so that if some total
1049 * hoser (like flex itself) wants to
1050 * call the scanner after we return the
1051 * YY_NULL, it'll still work - another
1052 * YY_NULL will get returned.
1054 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1056 yy_act = YY_STATE_EOF(YY_START);
1062 if ( ! yy_did_buffer_switch_on_eof )
1068 case EOB_ACT_CONTINUE_SCAN:
1070 yytext_ptr + yy_amount_of_matched_text;
1072 yy_current_state = yy_get_previous_state();
1075 yy_bp = yytext_ptr + YY_MORE_ADJ;
1078 case EOB_ACT_LAST_MATCH:
1080 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1082 yy_current_state = yy_get_previous_state();
1085 yy_bp = yytext_ptr + YY_MORE_ADJ;
1086 goto yy_find_action;
1093 "fatal flex scanner internal error--no action found" );
1094 } /* end of action switch */
1095 } /* end of scanning one token */
1096 } /* end of yylex */
1099 /* yy_get_next_buffer - try to read in a new buffer
1101 * Returns a code representing an action:
1102 * EOB_ACT_LAST_MATCH -
1103 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1104 * EOB_ACT_END_OF_FILE - end of file
1107 static int yy_get_next_buffer()
1109 register char *dest = yy_current_buffer->yy_ch_buf;
1110 register char *source = yytext_ptr;
1111 register int number_to_move, i;
1114 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1116 "fatal flex scanner internal error--end of buffer missed" );
1118 if ( yy_current_buffer->yy_fill_buffer == 0 )
1119 { /* Don't try to fill the buffer, so this is an EOF. */
1120 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1122 /* We matched a single character, the EOB, so
1123 * treat this as a final EOF.
1125 return EOB_ACT_END_OF_FILE;
1130 /* We matched some text prior to the EOB, first
1133 return EOB_ACT_LAST_MATCH;
1137 /* Try to read more data. */
1139 /* First move last chars to start of buffer. */
1140 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1142 for ( i = 0; i < number_to_move; ++i )
1143 *(dest++) = *(source++);
1145 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1146 /* don't do the read, it's not guaranteed to return an EOF,
1149 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1154 yy_current_buffer->yy_buf_size - number_to_move - 1;
1156 while ( num_to_read <= 0 )
1157 { /* Not enough room in the buffer - grow it. */
1158 #ifdef YY_USES_REJECT
1160 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1163 /* just a shorter name for the current buffer */
1164 YY_BUFFER_STATE b = yy_current_buffer;
1166 int yy_c_buf_p_offset =
1167 (int) (yy_c_buf_p - b->yy_ch_buf);
1169 if ( b->yy_is_our_buffer )
1171 int new_size = b->yy_buf_size * 2;
1173 if ( new_size <= 0 )
1174 b->yy_buf_size += b->yy_buf_size / 8;
1176 b->yy_buf_size *= 2;
1178 b->yy_ch_buf = (char *)
1179 /* Include room in for 2 EOB chars. */
1180 yy_flex_realloc( (void *) b->yy_ch_buf,
1181 b->yy_buf_size + 2 );
1184 /* Can't grow it, we don't own it. */
1187 if ( ! b->yy_ch_buf )
1189 "fatal error - scanner input buffer overflow" );
1191 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1193 num_to_read = yy_current_buffer->yy_buf_size -
1198 if ( num_to_read > YY_READ_BUF_SIZE )
1199 num_to_read = YY_READ_BUF_SIZE;
1201 /* Read in more data. */
1202 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1203 yy_n_chars, num_to_read );
1205 yy_current_buffer->yy_n_chars = yy_n_chars;
1208 if ( yy_n_chars == 0 )
1210 if ( number_to_move == YY_MORE_ADJ )
1212 ret_val = EOB_ACT_END_OF_FILE;
1218 ret_val = EOB_ACT_LAST_MATCH;
1219 yy_current_buffer->yy_buffer_status =
1220 YY_BUFFER_EOF_PENDING;
1225 ret_val = EOB_ACT_CONTINUE_SCAN;
1227 yy_n_chars += number_to_move;
1228 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1229 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1231 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1237 /* yy_get_previous_state - get the state just before the EOB char was reached */
1239 static yy_state_type yy_get_previous_state()
1241 register yy_state_type yy_current_state;
1242 register char *yy_cp;
1244 yy_current_state = yy_start;
1246 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1248 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1249 if ( yy_accept[yy_current_state] )
1251 yy_last_accepting_state = yy_current_state;
1252 yy_last_accepting_cpos = yy_cp;
1254 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1256 yy_current_state = (int) yy_def[yy_current_state];
1257 if ( yy_current_state >= 114 )
1258 yy_c = yy_meta[(unsigned int) yy_c];
1260 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1263 return yy_current_state;
1267 /* yy_try_NUL_trans - try to make a transition on the NUL character
1270 * next_state = yy_try_NUL_trans( current_state );
1273 #ifdef YY_USE_PROTOS
1274 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1276 static yy_state_type yy_try_NUL_trans( yy_current_state )
1277 yy_state_type yy_current_state;
1280 register int yy_is_jam;
1281 register char *yy_cp = yy_c_buf_p;
1283 register YY_CHAR yy_c = 1;
1284 if ( yy_accept[yy_current_state] )
1286 yy_last_accepting_state = yy_current_state;
1287 yy_last_accepting_cpos = yy_cp;
1289 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1291 yy_current_state = (int) yy_def[yy_current_state];
1292 if ( yy_current_state >= 114 )
1293 yy_c = yy_meta[(unsigned int) yy_c];
1295 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1296 yy_is_jam = (yy_current_state == 113);
1298 return yy_is_jam ? 0 : yy_current_state;
1303 #ifdef YY_USE_PROTOS
1304 static void yyunput( int c, register char *yy_bp )
1306 static void yyunput( c, yy_bp )
1308 register char *yy_bp;
1311 register char *yy_cp = yy_c_buf_p;
1313 /* undo effects of setting up yytext */
1314 *yy_cp = yy_hold_char;
1316 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1317 { /* need to shift things up to make room */
1318 /* +2 for EOB chars. */
1319 register int number_to_move = yy_n_chars + 2;
1320 register char *dest = &yy_current_buffer->yy_ch_buf[
1321 yy_current_buffer->yy_buf_size + 2];
1322 register char *source =
1323 &yy_current_buffer->yy_ch_buf[number_to_move];
1325 while ( source > yy_current_buffer->yy_ch_buf )
1326 *--dest = *--source;
1328 yy_cp += (int) (dest - source);
1329 yy_bp += (int) (dest - source);
1330 yy_current_buffer->yy_n_chars =
1331 yy_n_chars = yy_current_buffer->yy_buf_size;
1333 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1334 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1337 *--yy_cp = (char) c;
1341 yy_hold_char = *yy_cp;
1344 #endif /* ifndef YY_NO_UNPUT */
1348 static int yyinput()
1355 *yy_c_buf_p = yy_hold_char;
1357 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1359 /* yy_c_buf_p now points to the character we want to return.
1360 * If this occurs *before* the EOB characters, then it's a
1361 * valid NUL; if not, then we've hit the end of the buffer.
1363 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1364 /* This was really a NUL. */
1368 { /* need more input */
1369 int offset = yy_c_buf_p - yytext_ptr;
1372 switch ( yy_get_next_buffer() )
1374 case EOB_ACT_LAST_MATCH:
1375 /* This happens because yy_g_n_b()
1376 * sees that we've accumulated a
1377 * token and flags that we need to
1378 * try matching the token before
1379 * proceeding. But for input(),
1380 * there's no matching to consider.
1381 * So convert the EOB_ACT_LAST_MATCH
1382 * to EOB_ACT_END_OF_FILE.
1385 /* Reset buffer status. */
1390 case EOB_ACT_END_OF_FILE:
1395 if ( ! yy_did_buffer_switch_on_eof )
1404 case EOB_ACT_CONTINUE_SCAN:
1405 yy_c_buf_p = yytext_ptr + offset;
1411 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
1412 *yy_c_buf_p = '\0'; /* preserve yytext */
1413 yy_hold_char = *++yy_c_buf_p;
1420 #ifdef YY_USE_PROTOS
1421 void yyrestart( FILE *input_file )
1423 void yyrestart( input_file )
1427 if ( ! yy_current_buffer )
1428 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1430 yy_init_buffer( yy_current_buffer, input_file );
1431 yy_load_buffer_state();
1435 #ifdef YY_USE_PROTOS
1436 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1438 void yy_switch_to_buffer( new_buffer )
1439 YY_BUFFER_STATE new_buffer;
1442 if ( yy_current_buffer == new_buffer )
1445 if ( yy_current_buffer )
1447 /* Flush out information for old buffer. */
1448 *yy_c_buf_p = yy_hold_char;
1449 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1450 yy_current_buffer->yy_n_chars = yy_n_chars;
1453 yy_current_buffer = new_buffer;
1454 yy_load_buffer_state();
1456 /* We don't actually know whether we did this switch during
1457 * EOF (yywrap()) processing, but the only time this flag
1458 * is looked at is after yywrap() is called, so it's safe
1459 * to go ahead and always set it.
1461 yy_did_buffer_switch_on_eof = 1;
1465 #ifdef YY_USE_PROTOS
1466 void yy_load_buffer_state( void )
1468 void yy_load_buffer_state()
1471 yy_n_chars = yy_current_buffer->yy_n_chars;
1472 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1473 yyin = yy_current_buffer->yy_input_file;
1474 yy_hold_char = *yy_c_buf_p;
1478 #ifdef YY_USE_PROTOS
1479 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1481 YY_BUFFER_STATE yy_create_buffer( file, size )
1488 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1490 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1492 b->yy_buf_size = size;
1494 /* yy_ch_buf has to be 2 characters longer than the size given because
1495 * we need to put in 2 end-of-buffer characters.
1497 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1498 if ( ! b->yy_ch_buf )
1499 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1501 b->yy_is_our_buffer = 1;
1503 yy_init_buffer( b, file );
1509 #ifdef YY_USE_PROTOS
1510 void yy_delete_buffer( YY_BUFFER_STATE b )
1512 void yy_delete_buffer( b )
1519 if ( b == yy_current_buffer )
1520 yy_current_buffer = (YY_BUFFER_STATE) 0;
1522 if ( b->yy_is_our_buffer )
1523 yy_flex_free( (void *) b->yy_ch_buf );
1525 yy_flex_free( (void *) b );
1529 #ifndef YY_ALWAYS_INTERACTIVE
1530 #ifndef YY_NEVER_INTERACTIVE
1531 extern int isatty YY_PROTO(( int ));
1535 #ifdef YY_USE_PROTOS
1536 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1538 void yy_init_buffer( b, file )
1545 yy_flush_buffer( b );
1547 b->yy_input_file = file;
1548 b->yy_fill_buffer = 1;
1550 #if YY_ALWAYS_INTERACTIVE
1551 b->yy_is_interactive = 1;
1553 #if YY_NEVER_INTERACTIVE
1554 b->yy_is_interactive = 0;
1556 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1562 #ifdef YY_USE_PROTOS
1563 void yy_flush_buffer( YY_BUFFER_STATE b )
1565 void yy_flush_buffer( b )
1575 /* We always need two end-of-buffer characters. The first causes
1576 * a transition to the end-of-buffer state. The second causes
1577 * a jam in that state.
1579 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1580 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1582 b->yy_buf_pos = &b->yy_ch_buf[0];
1585 b->yy_buffer_status = YY_BUFFER_NEW;
1587 if ( b == yy_current_buffer )
1588 yy_load_buffer_state();
1592 #ifndef YY_NO_SCAN_BUFFER
1593 #ifdef YY_USE_PROTOS
1594 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1596 YY_BUFFER_STATE yy_scan_buffer( base, size )
1604 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1605 base[size-1] != YY_END_OF_BUFFER_CHAR )
1606 /* They forgot to leave room for the EOB's. */
1609 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1611 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1613 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1614 b->yy_buf_pos = b->yy_ch_buf = base;
1615 b->yy_is_our_buffer = 0;
1616 b->yy_input_file = 0;
1617 b->yy_n_chars = b->yy_buf_size;
1618 b->yy_is_interactive = 0;
1620 b->yy_fill_buffer = 0;
1621 b->yy_buffer_status = YY_BUFFER_NEW;
1623 yy_switch_to_buffer( b );
1630 #ifndef YY_NO_SCAN_STRING
1631 #ifdef YY_USE_PROTOS
1632 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1634 YY_BUFFER_STATE yy_scan_string( yy_str )
1635 yyconst char *yy_str;
1639 for ( len = 0; yy_str[len]; ++len )
1642 return yy_scan_bytes( yy_str, len );
1647 #ifndef YY_NO_SCAN_BYTES
1648 #ifdef YY_USE_PROTOS
1649 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1651 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1652 yyconst char *bytes;
1661 /* Get memory for full buffer, including space for trailing EOB's. */
1663 buf = (char *) yy_flex_alloc( n );
1665 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1667 for ( i = 0; i < len; ++i )
1670 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1672 b = yy_scan_buffer( buf, n );
1674 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1676 /* It's okay to grow etc. this buffer, and we should throw it
1677 * away when we're done.
1679 b->yy_is_our_buffer = 1;
1686 #ifndef YY_NO_PUSH_STATE
1687 #ifdef YY_USE_PROTOS
1688 static void yy_push_state( int new_state )
1690 static void yy_push_state( new_state )
1694 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1698 yy_start_stack_depth += YY_START_STACK_INCR;
1699 new_size = yy_start_stack_depth * sizeof( int );
1701 if ( ! yy_start_stack )
1702 yy_start_stack = (int *) yy_flex_alloc( new_size );
1705 yy_start_stack = (int *) yy_flex_realloc(
1706 (void *) yy_start_stack, new_size );
1708 if ( ! yy_start_stack )
1710 "out of memory expanding start-condition stack" );
1713 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1720 #ifndef YY_NO_POP_STATE
1721 static void yy_pop_state()
1723 if ( --yy_start_stack_ptr < 0 )
1724 YY_FATAL_ERROR( "start-condition stack underflow" );
1726 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1731 #ifndef YY_NO_TOP_STATE
1732 static int yy_top_state()
1734 return yy_start_stack[yy_start_stack_ptr - 1];
1738 #ifndef YY_EXIT_FAILURE
1739 #define YY_EXIT_FAILURE 2
1742 #ifdef YY_USE_PROTOS
1743 static void yy_fatal_error( yyconst char msg[] )
1745 static void yy_fatal_error( msg )
1749 (void) fprintf( stderr, "%s\n", msg );
1750 exit( YY_EXIT_FAILURE );
1755 /* Redefine yyless() so it works in section 3 code. */
1761 /* Undo effects of setting up yytext. */ \
1762 yytext[yyleng] = yy_hold_char; \
1763 yy_c_buf_p = yytext + n; \
1764 yy_hold_char = *yy_c_buf_p; \
1765 *yy_c_buf_p = '\0'; \
1771 /* Internal utility routines. */
1774 #ifdef YY_USE_PROTOS
1775 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1777 static void yy_flex_strncpy( s1, s2, n )
1784 for ( i = 0; i < n; ++i )
1789 #ifdef YY_NEED_STRLEN
1790 #ifdef YY_USE_PROTOS
1791 static int yy_flex_strlen( yyconst char *s )
1793 static int yy_flex_strlen( s )
1798 for ( n = 0; s[n]; ++n )
1806 #ifdef YY_USE_PROTOS
1807 static void *yy_flex_alloc( yy_size_t size )
1809 static void *yy_flex_alloc( size )
1813 return (void *) malloc( size );
1816 #ifdef YY_USE_PROTOS
1817 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1819 static void *yy_flex_realloc( ptr, size )
1824 /* The cast to (char *) in the following accommodates both
1825 * implementations that use char* generic pointers, and those
1826 * that use void* generic pointers. It works with the latter
1827 * because both ANSI C and C++ allow castless assignment from
1828 * any pointer type to void*, and deal with argument conversions
1829 * as though doing an assignment.
1831 return (void *) realloc( (char *) ptr, size );
1834 #ifdef YY_USE_PROTOS
1835 static void yy_flex_free( void *ptr )
1837 static void yy_flex_free( ptr )
1859 while ((c = input ()) != EOF)
1872 yyerror (_("error: EOF in comment"));
1878 yyerror (_("error: EOF in comment"));
1889 read_string (len_return)
1890 unsigned int *len_return;
1909 yyerror (_("error: EOF in string constant"));
1950 goto unexpected_eof;
1959 for (i = 0; i < 3; i++)
1962 if ('0' <= ch && ch <= '7')
1963 val = val * 8 + ch - '0';
1977 if (bufpos >= buflen)
1980 buf = (char *) xrealloc (buf, buflen);
1987 buf2 = (char *) xmalloc (bufpos + 1);
1988 memcpy (buf2, buf, bufpos);
1989 buf2[bufpos] = '\0';
1992 *len_return = bufpos;
2016 yyerror (_("error: EOF in regular expression"));
2056 goto unexpected_eof;
2065 for (i = 0; i < 3; i++)
2068 if ('0' <= ch && ch <= '7')
2069 val = val * 8 + ch - '0';
2080 /* Pass it through. */
2089 if (bufpos >= buflen)
2092 buf = (char *) xrealloc (buf, buflen);
2099 /* Possible options. */
2107 /* Case-insensitive regular expression. */
2108 node->u.re.flags |= fRE_CASE_INSENSITIVE;
2112 /* Unknown option => this belongs to the next token. */
2119 buf2 = (char *) xmalloc (bufpos + 1);
2120 memcpy (buf2, buf, bufpos);
2121 buf2[bufpos] = '\0';
2124 node->u.re.data = buf2;
2125 node->u.re.len = bufpos;