Update to GPLv3
[enscript.git] / states / lex.c
1 /* A lexical scanner generated by flex */
2
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 $
5  */
6
7 #define FLEX_SCANNER
8 #define YY_FLEX_MAJOR_VERSION 2
9 #define YY_FLEX_MINOR_VERSION 5
10
11 #include <stdio.h>
12
13
14 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
15 #ifdef c_plusplus
16 #ifndef __cplusplus
17 #define __cplusplus
18 #endif
19 #endif
20
21
22 #ifdef __cplusplus
23
24 #include <stdlib.h>
25 #include <unistd.h>
26
27 /* Use prototypes in function declarations. */
28 #define YY_USE_PROTOS
29
30 /* The "const" storage-class-modifier is valid. */
31 #define YY_USE_CONST
32
33 #else   /* ! __cplusplus */
34
35 #if __STDC__
36
37 #define YY_USE_PROTOS
38 #define YY_USE_CONST
39
40 #endif  /* __STDC__ */
41 #endif  /* ! __cplusplus */
42
43 #ifdef __TURBOC__
44  #pragma warn -rch
45  #pragma warn -use
46 #include <io.h>
47 #include <stdlib.h>
48 #define YY_USE_CONST
49 #define YY_USE_PROTOS
50 #endif
51
52 #ifdef YY_USE_CONST
53 #define yyconst const
54 #else
55 #define yyconst
56 #endif
57
58
59 #ifdef YY_USE_PROTOS
60 #define YY_PROTO(proto) proto
61 #else
62 #define YY_PROTO(proto) ()
63 #endif
64
65 /* Returned upon end-of-file. */
66 #define YY_NULL 0
67
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
71  * double cast.
72  */
73 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
74
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.
78  */
79 #define BEGIN yy_start = 1 + 2 *
80
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
83  * compatibility.
84  */
85 #define YY_START ((yy_start - 1) / 2)
86 #define YYSTATE YY_START
87
88 /* Action number for EOF rule of a given start state. */
89 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
90
91 /* Special action meaning "start processing a new file". */
92 #define YY_NEW_FILE yyrestart( yyin )
93
94 #define YY_END_OF_BUFFER_CHAR 0
95
96 /* Size of default input buffer. */
97 #define YY_BUF_SIZE 16384
98
99 typedef struct yy_buffer_state *YY_BUFFER_STATE;
100
101 extern int yyleng;
102 extern FILE *yyin, *yyout;
103
104 #define EOB_ACT_CONTINUE_SCAN 0
105 #define EOB_ACT_END_OF_FILE 1
106 #define EOB_ACT_LAST_MATCH 2
107
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:
111  *
112  *      if ( condition_holds )
113  *              yyless( 5 );
114  *      else
115  *              do_something_else();
116  *
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.
120  */
121
122 /* Return all but the first 'n' matched characters back to the input stream. */
123
124 #define yyless(n) \
125         do \
126                 { \
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 */ \
132                 } \
133         while ( 0 )
134
135 #define unput(c) yyunput( c, yytext_ptr )
136
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).
140  */
141 typedef unsigned int yy_size_t;
142
143
144 struct yy_buffer_state
145         {
146         FILE *yy_input_file;
147
148         char *yy_ch_buf;                /* input buffer */
149         char *yy_buf_pos;               /* current position in input buffer */
150
151         /* Size of input buffer in bytes, not including room for EOB
152          * characters.
153          */
154         yy_size_t yy_buf_size;
155
156         /* Number of characters read into yy_ch_buf, not including EOB
157          * characters.
158          */
159         int yy_n_chars;
160
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
163          * delete it.
164          */
165         int yy_is_our_buffer;
166
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
170          * each newline.
171          */
172         int yy_is_interactive;
173
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
176          * not.
177          */
178         int yy_at_bol;
179
180         /* Whether to try to fill the input buffer when we reach the
181          * end of it.
182          */
183         int yy_fill_buffer;
184
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.
193          *
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.
197          */
198 #define YY_BUFFER_EOF_PENDING 2
199         };
200
201 static YY_BUFFER_STATE yy_current_buffer = 0;
202
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
205  * "scanner state".
206  */
207 #define YY_CURRENT_BUFFER yy_current_buffer
208
209
210 /* yy_hold_char holds the character lost when yytext is formed. */
211 static char yy_hold_char;
212
213 static int yy_n_chars;          /* number of characters read into yy_ch_buf */
214
215
216 int yyleng;
217
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 */
222
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 ...
225  */
226 static int yy_did_buffer_switch_on_eof;
227
228 void yyrestart YY_PROTO(( FILE *input_file ));
229
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 )
237
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 ));
241
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 * ));
245
246 #define yy_new_buffer yy_create_buffer
247
248 #define yy_set_interactive(is_interactive) \
249         { \
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; \
253         }
254
255 #define yy_set_bol(at_bol) \
256         { \
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; \
260         }
261
262 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
263
264 typedef unsigned char YY_CHAR;
265 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
266 typedef int yy_state_type;
267 extern char *yytext;
268 #define yytext_ptr yytext
269
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[] ));
274
275 /* Done after the current pattern has been matched and before the
276  * corresponding action - sets up yytext.
277  */
278 #define YY_DO_BEFORE_ACTION \
279         yytext_ptr = yy_bp; \
280         yyleng = (int) (yy_cp - yy_bp); \
281         yy_hold_char = *yy_cp; \
282         *yy_cp = '\0'; \
283         yy_c_buf_p = yy_cp;
284
285 #define YY_NUM_RULES 39
286 #define YY_END_OF_BUFFER 40
287 static yyconst short int yy_accept[114] =
288     {   0,
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,
299
300        37,   37,   17,   37,   12,   37,   37,   37,   37,   16,
301        37,   19,    0
302     } ;
303
304 static yyconst int yy_ec[256] =
305     {   0,
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,
316
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,
327
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,
333         1,    1,    1,    1,    1
334     } ;
335
336 static yyconst int yy_meta[46] =
337     {   0,
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,
342         3,    3,    3,    3,    1
343     } ;
344
345 static yyconst short int yy_base[118] =
346     {   0,
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,
357
358        40,   44,    0,   36,    0,   46,   41,   35,   42,    0,
359        27,    0,  138,   64,   67,   60,   70
360     } ;
361
362 static yyconst short int yy_def[118] =
363     {   0,
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,
374
375       116,  116,  116,  116,  116,  116,  116,  116,  116,  116,
376       116,  116,    0,  113,  113,  113,  113
377     } ;
378
379 static yyconst short int yy_nxt[184] =
380     {   0,
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,
391
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,
400       113,  113,  113
401     } ;
402
403 static yyconst short int yy_chk[184] =
404     {   0,
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,
415
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,
424       113,  113,  113
425     } ;
426
427 static yy_state_type yy_last_accepting_state;
428 static char *yy_last_accepting_cpos;
429
430 /* The intent behind this definition is that it'll catch
431  * any uses of REJECT which flex missed.
432  */
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
437 char *yytext;
438 #line 1 "lex.l"
439 #define INITIAL 0
440 #line 2 "lex.l"
441 /*
442  * Lexer for states.
443  * Copyright (c) 1997-1998 Markku Rossi.
444  *
445  * Author: Markku Rossi <mtr@iki.fi>
446  */
447
448 /*
449  * This file is part of GNU Enscript.
450  *
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.
455  *
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.
460  *
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/>.
463  */
464
465 /*
466  * $Id: lex.c,v 1.1.1.1 2003/03/05 07:25:52 mtr Exp $
467  */
468
469 #include "defs.h"
470 #include "gram.h"
471
472 static void eat_comment ();
473 static char *read_string ___P ((unsigned int *len_return));
474 static void read_regexp ___P ((Node *node));
475 #line 478 "lex.yy.c"
476
477 /* Macros after this point can all be overridden by user definitions in
478  * section 1.
479  */
480
481 #ifndef YY_SKIP_YYWRAP
482 #ifdef __cplusplus
483 extern "C" int yywrap YY_PROTO(( void ));
484 #else
485 extern int yywrap YY_PROTO(( void ));
486 #endif
487 #endif
488
489 #ifndef YY_NO_UNPUT
490 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
491 #endif
492
493 #ifndef yytext_ptr
494 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
495 #endif
496
497 #ifdef YY_NEED_STRLEN
498 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
499 #endif
500
501 #ifndef YY_NO_INPUT
502 #ifdef __cplusplus
503 static int yyinput YY_PROTO(( void ));
504 #else
505 static int input YY_PROTO(( void ));
506 #endif
507 #endif
508
509 #if YY_STACK_USED
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 ));
515 #endif
516 #ifndef YY_NO_POP_STATE
517 static void yy_pop_state YY_PROTO(( void ));
518 #endif
519 #ifndef YY_NO_TOP_STATE
520 static int yy_top_state YY_PROTO(( void ));
521 #endif
522
523 #else
524 #define YY_NO_PUSH_STATE 1
525 #define YY_NO_POP_STATE 1
526 #define YY_NO_TOP_STATE 1
527 #endif
528
529 #ifdef YY_MALLOC_DECL
530 YY_MALLOC_DECL
531 #else
532 #if __STDC__
533 #ifndef __cplusplus
534 #include <stdlib.h>
535 #endif
536 #else
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).
540  */
541 #endif
542 #endif
543
544 /* Amount of stuff to slurp up with each read. */
545 #ifndef YY_READ_BUF_SIZE
546 #define YY_READ_BUF_SIZE 8192
547 #endif
548
549 /* Copy whatever the last rule matched to the standard output. */
550
551 #ifndef ECHO
552 /* This used to be an fputs(), but since the string might contain NUL's,
553  * we now use fwrite().
554  */
555 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
556 #endif
557
558 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
559  * is returned in "result".
560  */
561 #ifndef YY_INPUT
562 #define YY_INPUT(buf,result,max_size) \
563         if ( yy_current_buffer->yy_is_interactive ) \
564                 { \
565                 int c = '*', n; \
566                 for ( n = 0; n < max_size && \
567                              (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
568                         buf[n] = (char) c; \
569                 if ( c == '\n' ) \
570                         buf[n++] = (char) c; \
571                 if ( c == EOF && ferror( yyin ) ) \
572                         YY_FATAL_ERROR( "input in flex scanner failed" ); \
573                 result = n; \
574                 } \
575         else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
576                   && ferror( yyin ) ) \
577                 YY_FATAL_ERROR( "input in flex scanner failed" );
578 #endif
579
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.
583  */
584 #ifndef yyterminate
585 #define yyterminate() return YY_NULL
586 #endif
587
588 /* Number of entries by which start-condition stack grows. */
589 #ifndef YY_START_STACK_INCR
590 #define YY_START_STACK_INCR 25
591 #endif
592
593 /* Report a fatal error. */
594 #ifndef YY_FATAL_ERROR
595 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
596 #endif
597
598 /* Default declaration of generated scanner - a define so the user can
599  * easily add parameters.
600  */
601 #ifndef YY_DECL
602 #define YY_DECL int yylex YY_PROTO(( void ))
603 #endif
604
605 /* Code executed at the beginning of each rule, after yytext and yyleng
606  * have been set up.
607  */
608 #ifndef YY_USER_ACTION
609 #define YY_USER_ACTION
610 #endif
611
612 /* Code executed at the end of each rule. */
613 #ifndef YY_BREAK
614 #define YY_BREAK break;
615 #endif
616
617 #define YY_RULE_SETUP \
618         YY_USER_ACTION
619
620 YY_DECL
621         {
622         register yy_state_type yy_current_state;
623         register char *yy_cp, *yy_bp;
624         register int yy_act;
625
626 #line 44 "lex.l"
627
628
629 #line 632 "lex.yy.c"
630
631         if ( yy_init )
632                 {
633                 yy_init = 0;
634
635 #ifdef YY_USER_INIT
636                 YY_USER_INIT;
637 #endif
638
639                 if ( ! yy_start )
640                         yy_start = 1;   /* first start state */
641
642                 if ( ! yyin )
643                         yyin = stdin;
644
645                 if ( ! yyout )
646                         yyout = stdout;
647
648                 if ( ! yy_current_buffer )
649                         yy_current_buffer =
650                                 yy_create_buffer( yyin, YY_BUF_SIZE );
651
652                 yy_load_buffer_state();
653                 }
654
655         while ( 1 )             /* loops until end-of-file is reached */
656                 {
657                 yy_cp = yy_c_buf_p;
658
659                 /* Support of yytext. */
660                 *yy_cp = yy_hold_char;
661
662                 /* yy_bp points to the position in yy_ch_buf of the start of
663                  * the current run.
664                  */
665                 yy_bp = yy_cp;
666
667                 yy_current_state = yy_start;
668 yy_match:
669                 do
670                         {
671                         register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
672                         if ( yy_accept[yy_current_state] )
673                                 {
674                                 yy_last_accepting_state = yy_current_state;
675                                 yy_last_accepting_cpos = yy_cp;
676                                 }
677                         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
678                                 {
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];
682                                 }
683                         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
684                         ++yy_cp;
685                         }
686                 while ( yy_base[yy_current_state] != 138 );
687
688 yy_find_action:
689                 yy_act = yy_accept[yy_current_state];
690                 if ( yy_act == 0 )
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];
695                         }
696
697                 YY_DO_BEFORE_ACTION;
698
699
700 do_action:      /* This label is used only to access EOF actions. */
701
702
703                 switch ( yy_act )
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;
710                         goto yy_find_action;
711
712 case 1:
713 YY_RULE_SETUP
714 #line 46 "lex.l"
715 { eat_comment (); }
716         YY_BREAK
717 case 2:
718 YY_RULE_SETUP
719 #line 47 "lex.l"
720 { ; }
721         YY_BREAK
722 case 3:
723 YY_RULE_SETUP
724 #line 48 "lex.l"
725 { linenum++; }
726         YY_BREAK
727 case 4:
728 YY_RULE_SETUP
729 #line 50 "lex.l"
730 { yylval.node = node_alloc (nSTRING);
731                   yylval.node->u.str.data
732                     = read_string (&yylval.node->u.str.len);
733                   return tSTRING;
734                 }
735         YY_BREAK
736 case 5:
737 YY_RULE_SETUP
738 #line 56 "lex.l"
739 { yylval.node = node_alloc (nINTEGER);
740                   yylval.node->u.integer = yytext[1];
741                   return tINTEGER;
742                 }
743         YY_BREAK
744 case 6:
745 YY_RULE_SETUP
746 #line 61 "lex.l"
747 { yylval.node = node_alloc (nINTEGER);
748                   switch (yytext[2])
749                     {
750                     case 'n':
751                       yylval.node->u.integer = '\n';
752                       break;
753
754                     case 't':
755                       yylval.node->u.integer = '\t';
756                       break;
757
758                     case 'v':
759                       yylval.node->u.integer = '\v';
760                       break;
761
762                     case 'b':
763                       yylval.node->u.integer = '\b';
764                       break;
765
766                     case 'r':
767                       yylval.node->u.integer = '\r';
768                       break;
769
770                     case 'f':
771                       yylval.node->u.integer = '\f';
772                       break;
773
774                     case 'a':
775                       yylval.node->u.integer = '\a';
776                       break;
777
778                     default:
779                       yylval.node->u.integer = yytext[2];
780                       break;
781                     }
782
783                   return tINTEGER;
784                 }
785         YY_BREAK
786 case 7:
787 YY_RULE_SETUP
788 #line 100 "lex.l"
789 { yylval.node = node_alloc (nREGEXP);
790                   read_regexp (yylval.node);
791                   return tREGEXP;
792                 }
793         YY_BREAK
794 case 8:
795 YY_RULE_SETUP
796 #line 105 "lex.l"
797 { return tBEGIN; }
798         YY_BREAK
799 case 9:
800 YY_RULE_SETUP
801 #line 106 "lex.l"
802 { return tEND; }
803         YY_BREAK
804 case 10:
805 YY_RULE_SETUP
806 #line 107 "lex.l"
807 { return tDIV; }
808         YY_BREAK
809 case 11:
810 YY_RULE_SETUP
811 #line 108 "lex.l"
812 { return tELSE; }
813         YY_BREAK
814 case 12:
815 YY_RULE_SETUP
816 #line 109 "lex.l"
817 { return tEXTENDS; }
818         YY_BREAK
819 case 13:
820 YY_RULE_SETUP
821 #line 110 "lex.l"
822 { return tFOR; }
823         YY_BREAK
824 case 14:
825 YY_RULE_SETUP
826 #line 111 "lex.l"
827 { return tIF; }
828         YY_BREAK
829 case 15:
830 YY_RULE_SETUP
831 #line 112 "lex.l"
832 { return tLOCAL; }
833         YY_BREAK
834 case 16:
835 YY_RULE_SETUP
836 #line 113 "lex.l"
837 { return tNAMERULES; }
838         YY_BREAK
839 case 17:
840 YY_RULE_SETUP
841 #line 114 "lex.l"
842 { return tRETURN; }
843         YY_BREAK
844 case 18:
845 YY_RULE_SETUP
846 #line 115 "lex.l"
847 { return tSTART; }
848         YY_BREAK
849 case 19:
850 YY_RULE_SETUP
851 #line 116 "lex.l"
852 { return tSTARTRULES; }
853         YY_BREAK
854 case 20:
855 YY_RULE_SETUP
856 #line 117 "lex.l"
857 { return tSTATE; }
858         YY_BREAK
859 case 21:
860 YY_RULE_SETUP
861 #line 118 "lex.l"
862 { return tSUB; }
863         YY_BREAK
864 case 22:
865 YY_RULE_SETUP
866 #line 119 "lex.l"
867 { return tWHILE; }
868         YY_BREAK
869 case 23:
870 YY_RULE_SETUP
871 #line 121 "lex.l"
872 { return tEQ; }
873         YY_BREAK
874 case 24:
875 YY_RULE_SETUP
876 #line 122 "lex.l"
877 { return tNE; }
878         YY_BREAK
879 case 25:
880 YY_RULE_SETUP
881 #line 123 "lex.l"
882 { return tLE; }
883         YY_BREAK
884 case 26:
885 YY_RULE_SETUP
886 #line 124 "lex.l"
887 { return tGE; }
888         YY_BREAK
889 case 27:
890 YY_RULE_SETUP
891 #line 125 "lex.l"
892 { return tAND; }
893         YY_BREAK
894 case 28:
895 YY_RULE_SETUP
896 #line 126 "lex.l"
897 { return tOR; }
898         YY_BREAK
899 case 29:
900 YY_RULE_SETUP
901 #line 127 "lex.l"
902 { return tPLUSPLUS; }
903         YY_BREAK
904 case 30:
905 YY_RULE_SETUP
906 #line 128 "lex.l"
907 { return tMINUSMINUS; }
908         YY_BREAK
909 case 31:
910 YY_RULE_SETUP
911 #line 129 "lex.l"
912 { return tADDASSIGN; }
913         YY_BREAK
914 case 32:
915 YY_RULE_SETUP
916 #line 130 "lex.l"
917 { return tSUBASSIGN; }
918         YY_BREAK
919 case 33:
920 YY_RULE_SETUP
921 #line 131 "lex.l"
922 { return tMULASSIGN; }
923         YY_BREAK
924 case 34:
925 YY_RULE_SETUP
926 #line 132 "lex.l"
927 { return tDIVASSIGN; }
928         YY_BREAK
929 case 35:
930 YY_RULE_SETUP
931 #line 134 "lex.l"
932 { yylval.node = node_alloc (nREAL);
933                   yylval.node->u.real = atof (yytext);
934                   return tREAL;
935                 }
936         YY_BREAK
937 case 36:
938 YY_RULE_SETUP
939 #line 138 "lex.l"
940 { yylval.node = node_alloc (nINTEGER);
941                   yylval.node->u.integer = atoi (yytext);
942                   return tINTEGER;
943                 }
944         YY_BREAK
945 case 37:
946 YY_RULE_SETUP
947 #line 142 "lex.l"
948 { yylval.node = node_alloc (nSYMBOL);
949                   yylval.node->u.sym = xstrdup (yytext);
950                   return tSYMBOL;
951                 }
952         YY_BREAK
953 case 38:
954 YY_RULE_SETUP
955 #line 147 "lex.l"
956 { return yytext[0]; }
957         YY_BREAK
958 case 39:
959 YY_RULE_SETUP
960 #line 149 "lex.l"
961 ECHO;
962         YY_BREAK
963 #line 966 "lex.yy.c"
964 case YY_STATE_EOF(INITIAL):
965         yyterminate();
966
967         case YY_END_OF_BUFFER:
968                 {
969                 /* Amount of text matched not including the EOB char. */
970                 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
971
972                 /* Undo the effects of YY_DO_BEFORE_ACTION. */
973                 *yy_cp = yy_hold_char;
974                 YY_RESTORE_YY_MORE_OFFSET
975
976                 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
977                         {
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.
986                          */
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;
990                         }
991
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
997                  * in input().
998                  */
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;
1002
1003                         yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
1004
1005                         yy_current_state = yy_get_previous_state();
1006
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).
1014                          */
1015
1016                         yy_next_state = yy_try_NUL_trans( yy_current_state );
1017
1018                         yy_bp = yytext_ptr + YY_MORE_ADJ;
1019
1020                         if ( yy_next_state )
1021                                 {
1022                                 /* Consume the NUL. */
1023                                 yy_cp = ++yy_c_buf_p;
1024                                 yy_current_state = yy_next_state;
1025                                 goto yy_match;
1026                                 }
1027
1028                         else
1029                                 {
1030                                 yy_cp = yy_c_buf_p;
1031                                 goto yy_find_action;
1032                                 }
1033                         }
1034
1035                 else switch ( yy_get_next_buffer() )
1036                         {
1037                         case EOB_ACT_END_OF_FILE:
1038                                 {
1039                                 yy_did_buffer_switch_on_eof = 0;
1040
1041                                 if ( yywrap() )
1042                                         {
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.
1051                                          */
1052                                         yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
1053
1054                                         yy_act = YY_STATE_EOF(YY_START);
1055                                         goto do_action;
1056                                         }
1057
1058                                 else
1059                                         {
1060                                         if ( ! yy_did_buffer_switch_on_eof )
1061                                                 YY_NEW_FILE;
1062                                         }
1063                                 break;
1064                                 }
1065
1066                         case EOB_ACT_CONTINUE_SCAN:
1067                                 yy_c_buf_p =
1068                                         yytext_ptr + yy_amount_of_matched_text;
1069
1070                                 yy_current_state = yy_get_previous_state();
1071
1072                                 yy_cp = yy_c_buf_p;
1073                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1074                                 goto yy_match;
1075
1076                         case EOB_ACT_LAST_MATCH:
1077                                 yy_c_buf_p =
1078                                 &yy_current_buffer->yy_ch_buf[yy_n_chars];
1079
1080                                 yy_current_state = yy_get_previous_state();
1081
1082                                 yy_cp = yy_c_buf_p;
1083                                 yy_bp = yytext_ptr + YY_MORE_ADJ;
1084                                 goto yy_find_action;
1085                         }
1086                 break;
1087                 }
1088
1089         default:
1090                 YY_FATAL_ERROR(
1091                         "fatal flex scanner internal error--no action found" );
1092         } /* end of action switch */
1093                 } /* end of scanning one token */
1094         } /* end of yylex */
1095
1096
1097 /* yy_get_next_buffer - try to read in a new buffer
1098  *
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
1103  */
1104
1105 static int yy_get_next_buffer()
1106         {
1107         register char *dest = yy_current_buffer->yy_ch_buf;
1108         register char *source = yytext_ptr;
1109         register int number_to_move, i;
1110         int ret_val;
1111
1112         if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1113                 YY_FATAL_ERROR(
1114                 "fatal flex scanner internal error--end of buffer missed" );
1115
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 )
1119                         {
1120                         /* We matched a single character, the EOB, so
1121                          * treat this as a final EOF.
1122                          */
1123                         return EOB_ACT_END_OF_FILE;
1124                         }
1125
1126                 else
1127                         {
1128                         /* We matched some text prior to the EOB, first
1129                          * process it.
1130                          */
1131                         return EOB_ACT_LAST_MATCH;
1132                         }
1133                 }
1134
1135         /* Try to read more data. */
1136
1137         /* First move last chars to start of buffer. */
1138         number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1139
1140         for ( i = 0; i < number_to_move; ++i )
1141                 *(dest++) = *(source++);
1142
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,
1145                  * just force an EOF
1146                  */
1147                 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1148
1149         else
1150                 {
1151                 int num_to_read =
1152                         yy_current_buffer->yy_buf_size - number_to_move - 1;
1153
1154                 while ( num_to_read <= 0 )
1155                         { /* Not enough room in the buffer - grow it. */
1156 #ifdef YY_USES_REJECT
1157                         YY_FATAL_ERROR(
1158 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1159 #else
1160
1161                         /* just a shorter name for the current buffer */
1162                         YY_BUFFER_STATE b = yy_current_buffer;
1163
1164                         int yy_c_buf_p_offset =
1165                                 (int) (yy_c_buf_p - b->yy_ch_buf);
1166
1167                         if ( b->yy_is_our_buffer )
1168                                 {
1169                                 int new_size = b->yy_buf_size * 2;
1170
1171                                 if ( new_size <= 0 )
1172                                         b->yy_buf_size += b->yy_buf_size / 8;
1173                                 else
1174                                         b->yy_buf_size *= 2;
1175
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 );
1180                                 }
1181                         else
1182                                 /* Can't grow it, we don't own it. */
1183                                 b->yy_ch_buf = 0;
1184
1185                         if ( ! b->yy_ch_buf )
1186                                 YY_FATAL_ERROR(
1187                                 "fatal error - scanner input buffer overflow" );
1188
1189                         yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1190
1191                         num_to_read = yy_current_buffer->yy_buf_size -
1192                                                 number_to_move - 1;
1193 #endif
1194                         }
1195
1196                 if ( num_to_read > YY_READ_BUF_SIZE )
1197                         num_to_read = YY_READ_BUF_SIZE;
1198
1199                 /* Read in more data. */
1200                 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1201                         yy_n_chars, num_to_read );
1202
1203                 yy_current_buffer->yy_n_chars = yy_n_chars;
1204                 }
1205
1206         if ( yy_n_chars == 0 )
1207                 {
1208                 if ( number_to_move == YY_MORE_ADJ )
1209                         {
1210                         ret_val = EOB_ACT_END_OF_FILE;
1211                         yyrestart( yyin );
1212                         }
1213
1214                 else
1215                         {
1216                         ret_val = EOB_ACT_LAST_MATCH;
1217                         yy_current_buffer->yy_buffer_status =
1218                                 YY_BUFFER_EOF_PENDING;
1219                         }
1220                 }
1221
1222         else
1223                 ret_val = EOB_ACT_CONTINUE_SCAN;
1224
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;
1228
1229         yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1230
1231         return ret_val;
1232         }
1233
1234
1235 /* yy_get_previous_state - get the state just before the EOB char was reached */
1236
1237 static yy_state_type yy_get_previous_state()
1238         {
1239         register yy_state_type yy_current_state;
1240         register char *yy_cp;
1241
1242         yy_current_state = yy_start;
1243
1244         for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1245                 {
1246                 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1247                 if ( yy_accept[yy_current_state] )
1248                         {
1249                         yy_last_accepting_state = yy_current_state;
1250                         yy_last_accepting_cpos = yy_cp;
1251                         }
1252                 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1253                         {
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];
1257                         }
1258                 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1259                 }
1260
1261         return yy_current_state;
1262         }
1263
1264
1265 /* yy_try_NUL_trans - try to make a transition on the NUL character
1266  *
1267  * synopsis
1268  *      next_state = yy_try_NUL_trans( current_state );
1269  */
1270
1271 #ifdef YY_USE_PROTOS
1272 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1273 #else
1274 static yy_state_type yy_try_NUL_trans( yy_current_state )
1275 yy_state_type yy_current_state;
1276 #endif
1277         {
1278         register int yy_is_jam;
1279         register char *yy_cp = yy_c_buf_p;
1280
1281         register YY_CHAR yy_c = 1;
1282         if ( yy_accept[yy_current_state] )
1283                 {
1284                 yy_last_accepting_state = yy_current_state;
1285                 yy_last_accepting_cpos = yy_cp;
1286                 }
1287         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1288                 {
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];
1292                 }
1293         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1294         yy_is_jam = (yy_current_state == 113);
1295
1296         return yy_is_jam ? 0 : yy_current_state;
1297         }
1298
1299
1300 #ifndef YY_NO_UNPUT
1301 #ifdef YY_USE_PROTOS
1302 static void yyunput( int c, register char *yy_bp )
1303 #else
1304 static void yyunput( c, yy_bp )
1305 int c;
1306 register char *yy_bp;
1307 #endif
1308         {
1309         register char *yy_cp = yy_c_buf_p;
1310
1311         /* undo effects of setting up yytext */
1312         *yy_cp = yy_hold_char;
1313
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];
1322
1323                 while ( source > yy_current_buffer->yy_ch_buf )
1324                         *--dest = *--source;
1325
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;
1330
1331                 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1332                         YY_FATAL_ERROR( "flex scanner push-back overflow" );
1333                 }
1334
1335         *--yy_cp = (char) c;
1336
1337
1338         yytext_ptr = yy_bp;
1339         yy_hold_char = *yy_cp;
1340         yy_c_buf_p = yy_cp;
1341         }
1342 #endif  /* ifndef YY_NO_UNPUT */
1343
1344
1345 #ifdef __cplusplus
1346 static int yyinput()
1347 #else
1348 static int input()
1349 #endif
1350         {
1351         int c;
1352
1353         *yy_c_buf_p = yy_hold_char;
1354
1355         if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1356                 {
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.
1360                  */
1361                 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1362                         /* This was really a NUL. */
1363                         *yy_c_buf_p = '\0';
1364
1365                 else
1366                         { /* need more input */
1367                         int offset = yy_c_buf_p - yytext_ptr;
1368                         ++yy_c_buf_p;
1369
1370                         switch ( yy_get_next_buffer() )
1371                                 {
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.
1381                                          */
1382
1383                                         /* Reset buffer status. */
1384                                         yyrestart( yyin );
1385
1386                                         /* fall through */
1387
1388                                 case EOB_ACT_END_OF_FILE:
1389                                         {
1390                                         if ( yywrap() )
1391                                                 return EOF;
1392
1393                                         if ( ! yy_did_buffer_switch_on_eof )
1394                                                 YY_NEW_FILE;
1395 #ifdef __cplusplus
1396                                         return yyinput();
1397 #else
1398                                         return input();
1399 #endif
1400                                         }
1401
1402                                 case EOB_ACT_CONTINUE_SCAN:
1403                                         yy_c_buf_p = yytext_ptr + offset;
1404                                         break;
1405                                 }
1406                         }
1407                 }
1408
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;
1412
1413
1414         return c;
1415         }
1416
1417
1418 #ifdef YY_USE_PROTOS
1419 void yyrestart( FILE *input_file )
1420 #else
1421 void yyrestart( input_file )
1422 FILE *input_file;
1423 #endif
1424         {
1425         if ( ! yy_current_buffer )
1426                 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1427
1428         yy_init_buffer( yy_current_buffer, input_file );
1429         yy_load_buffer_state();
1430         }
1431
1432
1433 #ifdef YY_USE_PROTOS
1434 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1435 #else
1436 void yy_switch_to_buffer( new_buffer )
1437 YY_BUFFER_STATE new_buffer;
1438 #endif
1439         {
1440         if ( yy_current_buffer == new_buffer )
1441                 return;
1442
1443         if ( yy_current_buffer )
1444                 {
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;
1449                 }
1450
1451         yy_current_buffer = new_buffer;
1452         yy_load_buffer_state();
1453
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.
1458          */
1459         yy_did_buffer_switch_on_eof = 1;
1460         }
1461
1462
1463 #ifdef YY_USE_PROTOS
1464 void yy_load_buffer_state( void )
1465 #else
1466 void yy_load_buffer_state()
1467 #endif
1468         {
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;
1473         }
1474
1475
1476 #ifdef YY_USE_PROTOS
1477 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1478 #else
1479 YY_BUFFER_STATE yy_create_buffer( file, size )
1480 FILE *file;
1481 int size;
1482 #endif
1483         {
1484         YY_BUFFER_STATE b;
1485
1486         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1487         if ( ! b )
1488                 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1489
1490         b->yy_buf_size = size;
1491
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.
1494          */
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()" );
1498
1499         b->yy_is_our_buffer = 1;
1500
1501         yy_init_buffer( b, file );
1502
1503         return b;
1504         }
1505
1506
1507 #ifdef YY_USE_PROTOS
1508 void yy_delete_buffer( YY_BUFFER_STATE b )
1509 #else
1510 void yy_delete_buffer( b )
1511 YY_BUFFER_STATE b;
1512 #endif
1513         {
1514         if ( ! b )
1515                 return;
1516
1517         if ( b == yy_current_buffer )
1518                 yy_current_buffer = (YY_BUFFER_STATE) 0;
1519
1520         if ( b->yy_is_our_buffer )
1521                 yy_flex_free( (void *) b->yy_ch_buf );
1522
1523         yy_flex_free( (void *) b );
1524         }
1525
1526
1527 #ifndef YY_ALWAYS_INTERACTIVE
1528 #ifndef YY_NEVER_INTERACTIVE
1529 extern int isatty YY_PROTO(( int ));
1530 #endif
1531 #endif
1532
1533 #ifdef YY_USE_PROTOS
1534 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1535 #else
1536 void yy_init_buffer( b, file )
1537 YY_BUFFER_STATE b;
1538 FILE *file;
1539 #endif
1540
1541
1542         {
1543         yy_flush_buffer( b );
1544
1545         b->yy_input_file = file;
1546         b->yy_fill_buffer = 1;
1547
1548 #if YY_ALWAYS_INTERACTIVE
1549         b->yy_is_interactive = 1;
1550 #else
1551 #if YY_NEVER_INTERACTIVE
1552         b->yy_is_interactive = 0;
1553 #else
1554         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1555 #endif
1556 #endif
1557         }
1558
1559
1560 #ifdef YY_USE_PROTOS
1561 void yy_flush_buffer( YY_BUFFER_STATE b )
1562 #else
1563 void yy_flush_buffer( b )
1564 YY_BUFFER_STATE b;
1565 #endif
1566
1567         {
1568         if ( ! b )
1569                 return;
1570
1571         b->yy_n_chars = 0;
1572
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.
1576          */
1577         b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1578         b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1579
1580         b->yy_buf_pos = &b->yy_ch_buf[0];
1581
1582         b->yy_at_bol = 1;
1583         b->yy_buffer_status = YY_BUFFER_NEW;
1584
1585         if ( b == yy_current_buffer )
1586                 yy_load_buffer_state();
1587         }
1588
1589
1590 #ifndef YY_NO_SCAN_BUFFER
1591 #ifdef YY_USE_PROTOS
1592 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1593 #else
1594 YY_BUFFER_STATE yy_scan_buffer( base, size )
1595 char *base;
1596 yy_size_t size;
1597 #endif
1598         {
1599         YY_BUFFER_STATE b;
1600
1601         if ( size < 2 ||
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. */
1605                 return 0;
1606
1607         b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1608         if ( ! b )
1609                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1610
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;
1617         b->yy_at_bol = 1;
1618         b->yy_fill_buffer = 0;
1619         b->yy_buffer_status = YY_BUFFER_NEW;
1620
1621         yy_switch_to_buffer( b );
1622
1623         return b;
1624         }
1625 #endif
1626
1627
1628 #ifndef YY_NO_SCAN_STRING
1629 #ifdef YY_USE_PROTOS
1630 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1631 #else
1632 YY_BUFFER_STATE yy_scan_string( yy_str )
1633 yyconst char *yy_str;
1634 #endif
1635         {
1636         int len;
1637         for ( len = 0; yy_str[len]; ++len )
1638                 ;
1639
1640         return yy_scan_bytes( yy_str, len );
1641         }
1642 #endif
1643
1644
1645 #ifndef YY_NO_SCAN_BYTES
1646 #ifdef YY_USE_PROTOS
1647 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1648 #else
1649 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1650 yyconst char *bytes;
1651 int len;
1652 #endif
1653         {
1654         YY_BUFFER_STATE b;
1655         char *buf;
1656         yy_size_t n;
1657         int i;
1658
1659         /* Get memory for full buffer, including space for trailing EOB's. */
1660         n = len + 2;
1661         buf = (char *) yy_flex_alloc( n );
1662         if ( ! buf )
1663                 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1664
1665         for ( i = 0; i < len; ++i )
1666                 buf[i] = bytes[i];
1667
1668         buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1669
1670         b = yy_scan_buffer( buf, n );
1671         if ( ! b )
1672                 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1673
1674         /* It's okay to grow etc. this buffer, and we should throw it
1675          * away when we're done.
1676          */
1677         b->yy_is_our_buffer = 1;
1678
1679         return b;
1680         }
1681 #endif
1682
1683
1684 #ifndef YY_NO_PUSH_STATE
1685 #ifdef YY_USE_PROTOS
1686 static void yy_push_state( int new_state )
1687 #else
1688 static void yy_push_state( new_state )
1689 int new_state;
1690 #endif
1691         {
1692         if ( yy_start_stack_ptr >= yy_start_stack_depth )
1693                 {
1694                 yy_size_t new_size;
1695
1696                 yy_start_stack_depth += YY_START_STACK_INCR;
1697                 new_size = yy_start_stack_depth * sizeof( int );
1698
1699                 if ( ! yy_start_stack )
1700                         yy_start_stack = (int *) yy_flex_alloc( new_size );
1701
1702                 else
1703                         yy_start_stack = (int *) yy_flex_realloc(
1704                                         (void *) yy_start_stack, new_size );
1705
1706                 if ( ! yy_start_stack )
1707                         YY_FATAL_ERROR(
1708                         "out of memory expanding start-condition stack" );
1709                 }
1710
1711         yy_start_stack[yy_start_stack_ptr++] = YY_START;
1712
1713         BEGIN(new_state);
1714         }
1715 #endif
1716
1717
1718 #ifndef YY_NO_POP_STATE
1719 static void yy_pop_state()
1720         {
1721         if ( --yy_start_stack_ptr < 0 )
1722                 YY_FATAL_ERROR( "start-condition stack underflow" );
1723
1724         BEGIN(yy_start_stack[yy_start_stack_ptr]);
1725         }
1726 #endif
1727
1728
1729 #ifndef YY_NO_TOP_STATE
1730 static int yy_top_state()
1731         {
1732         return yy_start_stack[yy_start_stack_ptr - 1];
1733         }
1734 #endif
1735
1736 #ifndef YY_EXIT_FAILURE
1737 #define YY_EXIT_FAILURE 2
1738 #endif
1739
1740 #ifdef YY_USE_PROTOS
1741 static void yy_fatal_error( yyconst char msg[] )
1742 #else
1743 static void yy_fatal_error( msg )
1744 char msg[];
1745 #endif
1746         {
1747         (void) fprintf( stderr, "%s\n", msg );
1748         exit( YY_EXIT_FAILURE );
1749         }
1750
1751
1752
1753 /* Redefine yyless() so it works in section 3 code. */
1754
1755 #undef yyless
1756 #define yyless(n) \
1757         do \
1758                 { \
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'; \
1764                 yyleng = n; \
1765                 } \
1766         while ( 0 )
1767
1768
1769 /* Internal utility routines. */
1770
1771 #ifndef yytext_ptr
1772 #ifdef YY_USE_PROTOS
1773 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1774 #else
1775 static void yy_flex_strncpy( s1, s2, n )
1776 char *s1;
1777 yyconst char *s2;
1778 int n;
1779 #endif
1780         {
1781         register int i;
1782         for ( i = 0; i < n; ++i )
1783                 s1[i] = s2[i];
1784         }
1785 #endif
1786
1787 #ifdef YY_NEED_STRLEN
1788 #ifdef YY_USE_PROTOS
1789 static int yy_flex_strlen( yyconst char *s )
1790 #else
1791 static int yy_flex_strlen( s )
1792 yyconst char *s;
1793 #endif
1794         {
1795         register int n;
1796         for ( n = 0; s[n]; ++n )
1797                 ;
1798
1799         return n;
1800         }
1801 #endif
1802
1803
1804 #ifdef YY_USE_PROTOS
1805 static void *yy_flex_alloc( yy_size_t size )
1806 #else
1807 static void *yy_flex_alloc( size )
1808 yy_size_t size;
1809 #endif
1810         {
1811         return (void *) malloc( size );
1812         }
1813
1814 #ifdef YY_USE_PROTOS
1815 static void *yy_flex_realloc( void *ptr, yy_size_t size )
1816 #else
1817 static void *yy_flex_realloc( ptr, size )
1818 void *ptr;
1819 yy_size_t size;
1820 #endif
1821         {
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.
1828          */
1829         return (void *) realloc( (char *) ptr, size );
1830         }
1831
1832 #ifdef YY_USE_PROTOS
1833 static void yy_flex_free( void *ptr )
1834 #else
1835 static void yy_flex_free( ptr )
1836 void *ptr;
1837 #endif
1838         {
1839         free( ptr );
1840         }
1841
1842 #if YY_MAIN
1843 int main()
1844         {
1845         yylex();
1846         return 0;
1847         }
1848 #endif
1849 #line 149 "lex.l"
1850
1851
1852 static void
1853 eat_comment ()
1854 {
1855   int c;
1856
1857   while ((c = input ()) != EOF)
1858     {
1859       if (c == '\n')
1860         linenum++;
1861       else if (c == '*')
1862         {
1863           c = input ();
1864           if (c == '/')
1865             /* All done. */
1866             return;
1867
1868           if (c == EOF)
1869             {
1870               yyerror (_("error: EOF in comment"));
1871               break;
1872             }
1873           unput (c);
1874         }
1875     }
1876   yyerror (_("error: EOF in comment"));
1877 }
1878
1879
1880 int
1881 yywrap ()
1882 {
1883   return 1;
1884 }
1885
1886 static char *
1887 read_string (len_return)
1888      unsigned int *len_return;
1889 {
1890   char *buf = NULL;
1891   char *buf2;
1892   int buflen = 0;
1893   int bufpos = 0;
1894   int ch;
1895   int done = 0;
1896
1897   while (!done)
1898     {
1899       ch = input ();
1900       if (ch == '\n')
1901         linenum++;
1902
1903       switch (ch)
1904         {
1905         case EOF:
1906         unexpected_eof:
1907           yyerror (_("error: EOF in string constant"));
1908           done = 1;
1909           break;
1910
1911         case '"':
1912           done = 1;
1913           break;
1914
1915         case '\\':
1916           ch = input ();
1917           switch (ch)
1918             {
1919             case 'n':
1920               ch = '\n';
1921               break;
1922
1923             case 't':
1924               ch = '\t';
1925               break;
1926
1927             case 'v':
1928               ch = '\v';
1929               break;
1930
1931             case 'b':
1932               ch = '\b';
1933               break;
1934
1935             case 'r':
1936               ch = '\r';
1937               break;
1938
1939             case 'f':
1940               ch = '\f';
1941               break;
1942
1943             case 'a':
1944               ch = '\a';
1945               break;
1946
1947             case EOF:
1948               goto unexpected_eof;
1949               break;
1950
1951             default:
1952               if (ch == '0')
1953                 {
1954                   int i;
1955                   int val = 0;
1956
1957                   for (i = 0; i < 3; i++)
1958                     {
1959                       ch = input ();
1960                       if ('0' <= ch && ch <= '7')
1961                         val = val * 8 + ch - '0';
1962                       else
1963                         {
1964                           unput (ch);
1965                           break;
1966                         }
1967                     }
1968                   ch = val;
1969                 }
1970               break;
1971             }
1972           /* FALLTHROUGH */
1973
1974         default:
1975           if (bufpos >= buflen)
1976             {
1977               buflen += 1024;
1978               buf = (char *) xrealloc (buf, buflen);
1979             }
1980           buf[bufpos++] = ch;
1981           break;
1982         }
1983     }
1984
1985   buf2 = (char *) xmalloc (bufpos + 1);
1986   memcpy (buf2, buf, bufpos);
1987   buf2[bufpos] = '\0';
1988   xfree (buf);
1989
1990   *len_return = bufpos;
1991
1992   return buf2;
1993 }
1994
1995
1996 static void
1997 read_regexp (node)
1998      Node *node;
1999 {
2000   char *buf = NULL;
2001   char *buf2;
2002   int buflen = 0;
2003   int bufpos = 0;
2004   int ch;
2005   int done = 0;
2006
2007   while (!done)
2008     {
2009       ch = input ();
2010       switch (ch)
2011         {
2012         case EOF:
2013         unexpected_eof:
2014           yyerror (_("error: EOF in regular expression"));
2015           done = 1;
2016           break;
2017
2018         case '/':
2019           done = 1;
2020           break;
2021
2022         case '\\':
2023           ch = input ();
2024           switch (ch)
2025             {
2026             case '\n':
2027               /* Line break. */
2028               linenum++;
2029               continue;
2030               break;
2031
2032             case 'n':
2033               ch = '\n';
2034               break;
2035
2036             case 'r':
2037               ch = '\r';
2038               break;
2039
2040             case 'f':
2041               ch = '\f';
2042               break;
2043
2044             case 't':
2045               ch = '\t';
2046               break;
2047
2048             case '/':
2049             case '\\':
2050               /* Quote these. */
2051               break;
2052
2053             case EOF:
2054               goto unexpected_eof;
2055               break;
2056
2057             default:
2058               if (ch == '0')
2059                 {
2060                   int i;
2061                   int val = 0;
2062
2063                   for (i = 0; i < 3; i++)
2064                     {
2065                       ch = input ();
2066                       if ('0' <= ch && ch <= '7')
2067                         val = val * 8 + ch - '0';
2068                       else
2069                         {
2070                           unput (ch);
2071                           break;
2072                         }
2073                     }
2074                   ch = val;
2075                 }
2076               else
2077                 {
2078                   /* Pass it through. */
2079                   unput (ch);
2080                   ch = '\\';
2081                 }
2082               break;
2083             }
2084           /* FALLTHROUGH */
2085
2086         default:
2087           if (bufpos >= buflen)
2088             {
2089               buflen += 1024;
2090               buf = (char *) xrealloc (buf, buflen);
2091             }
2092           buf[bufpos++] = ch;
2093           break;
2094         }
2095     }
2096
2097   /* Possible options. */
2098   done = 0;
2099   while (!done)
2100     {
2101       ch = input ();
2102       switch (ch)
2103         {
2104         case 'i':
2105           /* Case-insensitive regular expression. */
2106           node->u.re.flags |= fRE_CASE_INSENSITIVE;
2107           break;
2108
2109         default:
2110           /* Unknown option => this belongs to the next token. */
2111           unput (ch);
2112           done = 1;
2113           break;
2114         }
2115     }
2116
2117   buf2 = (char *) xmalloc (bufpos + 1);
2118   memcpy (buf2, buf, bufpos);
2119   buf2[bufpos] = '\0';
2120   xfree (buf);
2121
2122   node->u.re.data = buf2;
2123   node->u.re.len = bufpos;
2124 }
2125
2126 \f
2127 /*
2128 Local variables:
2129 mode: c
2130 End:
2131 */